static86
asked on
haskel check if number appears only once in the list
Hi,
I want check if number appears only once in the list. I wrote following code, but i don't know how to check if number already was there.
I want check if number appears only once in the list. I wrote following code, but i don't know how to check if number already was there.
once :: [Int] -> Int -> Bool
once [] n = False
once (x:xs) n
| x == n = True
| otherwise = once xs n
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry for the follow up the el = item must be == sorry. a copy+paste error.
ASKER
thx!