okay, das wird wahrscheinlich im Vorspiel sein, aber: gibt es eine Standard-Bibliotheksfunktion zum Finden der einzigartigen Elemente in einer Liste? meine (Wieder-) Einführung, zur Klarstellung, ist:einzigartige Elemente in einer Haskell-Liste
has :: (Eq a) => [a] -> a -> Bool
has [] _ = False
has (x:xs) a
| x == a = True
| otherwise = has xs a
unique :: (Eq a) => [a] -> [a]
unique [] = []
unique (x:xs)
| has xs x = unique xs
| otherwise = x : unique xs
Ihre 'has' ist ebenfalls Standard; Es ist nur "Flip Elem". – Nefrubyr
Oder sogar 'hat xs = (\' elem \ 'xs)'. – yatima2975
@ yatima2975 Warum benutzt du 'elem' als Infix? – dopatraman