Haskell: tail auf einem Element aufrufen?
Hallo,
also ich habe die Funktion
f xs = tail(head xs)
Zu dieser soll ich mir eine type signature überlegen. Ich hätte erst gesagt [a] -> a, da ich ja mit head nur das erste Element nehme. Aber tail nimmt doch nur den rest einer Liste? Dann wäre doch tail(a) die leere Liste oder etwa nicht? Kann man überhaupt tail auf einem Element aufrufen? Es brauch doch eine Liste?
Schonmal vielen Dank:))
A list consists exactly of a pair where the second item is an empty list
So I get a list at the end? Since the def of head says head :: [a] -> a. So I don’t have a list when I call tail. Just a single element. Or do I have something of the kind a:[] and get the empty list with tail?