list - Why does this function give rise to an infinite loop? -


i trying solve exercises haskell course found online , this question, have following implementation:

reverse ::   list   -> list reverse nil = nil reverse (x :. xs) = let l = (reverse xs) in l ++ (x:.nil) 

with list being defined as:

data list t =   nil   | t :. list t   deriving (eq, ord) 

it seems there infinite loop inside function. not find out why. enlighten me?

this correct implementation of reverse definition of list in exercise book. if there infinite loop somewhere in implementation of (++).


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -