Keith Wansbrough wrote:
> 
> 
> Good point!  I have no idea... it looks like the Wiki has gone AWOL.  If someone 
>would tell me where my article has gone, I'd be very grateful!
> 

If you find it, maybe you could put it in the "Haskell bookshelf" ?
I found very useful and Wiki has been "AWOL" for quite a while now.

Anyway, a doubly linked list could be defined like this:

data DL a
  = Node (DL a) a (DL a)
  | Empty

And the conversion from a list would look like this:

fromList :: [a] -> DL a
fromList xs = fromList2 Empty xs

fromList2 :: DL a -> [a] -> DL a
fromList2 a [] = Empty
fromList2 a (x:xs)
  = r
    where
      r = Node a x s
      s = (fromList2 r xs)

Or did I make a mistake somewhere ? I still find it hard
to wrap my brain around these kind of things.

  Jan

Reply via email to