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:))

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
2 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
W00dp3ckr
1 year ago

A list consists exactly of a pair where the second item is an empty list