Link to home
Start Free TrialLog in
Avatar of static86
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.
once :: [Int] -> Int -> Bool
once [] n = False
once (x:xs) n
  | x == n  = True
  | otherwise  = once xs n

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry for the  follow up the el = item must be == sorry. a copy+paste error.
Avatar of static86
static86

ASKER

thx!