KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to teach myself Haskell. One thing I have tried to do is to write an alternative function to return the last element of a list by recursing through the list until the tail is the empty set and then returning the head. I have... mylast [] = [] mylast (x:[]) = x mylast (x:xs) = mylast xs ...but I get an error when I try any non-empty list :( Any suggestions as to what I have done wrong? TIA.
Tags (comma-separated)
Save Edits
Cancel