Re: doubly linked list

2000-04-28 Thread Peter Hancock
> "Jerzy" == Jerzy Karczmarczuk <[EMAIL PROTECTED]> writes: > The idea of double lists was to permit a fast two-directional > navigation, > and the ease of insertion/deletion. > But in Haskell, where the beasts are not mutable: > ... Actually, has anybody really used the

Re: doubly linked list

2000-04-28 Thread Marc van Dongen
Jerzy Karczmarczuk ([EMAIL PROTECTED]) wrote: : But in Haskell, where the beasts are not mutable: : : ... Actually, has anybody really used them for practical purposes? I have used doubly linked lists in Haskell about four years ago to implement a queue from which objects could be added at fron

Re: doubly linked list

2000-04-28 Thread Jerzy Karczmarczuk
Chris Angus: > > Would it not be better to tag a start point then we can manipulate this > easier > and move it back to a singly linked list etc. > > data Db a = Dd (Db a) a (Db a) > | DStart (Db a) a (Db a) > > ... Well, I am sufficiently old to confess that one of my favourite OO l

RE: doubly linked list

2000-04-28 Thread Chris Angus
a right (DStart _ _ a) = a val (Dd _ x _) = x val (DStart _ x _) = x rewind (Dd a _ _) = rewind a rewind a = a ffwd (Dd _ _ a) = ffwd a ffwd a = a > -Original Message- > From: Jerzy Karczmarczuk [mailto:[EMAIL PROTECTED]] > Sent: 28 April 2000 11:12 > Cc: [EMAIL PROTECTED] > Subje

RE: doubly linked list

2000-04-28 Thread Chris Angus
> -Original Message- > From: Peter Hancock [mailto:[EMAIL PROTECTED]] > Sent: 28 April 2000 10:23 > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: doubly linked list > > > >>>>> "Jan" == Jan Kort <[EMAIL PROTECTED]

Re: doubly linked list

2000-04-28 Thread Peter Hancock
> "Jan" == Jan Kort <[EMAIL PROTECTED]> writes: > Anyway, a doubly linked list could be defined like this: That was very interesting. It seems to generalise to put back-pointers and other context info in a variety of data structures. This seems a pretty performance-enhancing thing to do

Re: doubly linked list

2000-04-28 Thread Jerzy Karczmarczuk
> Jan Brosius wrote: > I wonder if it is possible to simulate a doubly linked list in > Haskell. ... and the number of answers was impressive... Want some more? This is a short for *making* true double lists, and as an extra bonus it is circular. Slightly longer than the solution of Jan Kort, n

Re: doubly linked list

2000-04-27 Thread Jan Brosius
- Original Message - From: Chris Okasaki <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 27, 2000 4:13 PM Subject: Re: doubly linked list > > I wonder if it is possible to simulate a doubly linked list in > > Haskell. > > Depends on w

Re: doubly linked list

2000-04-27 Thread Keith Wansbrough
Herewith the comp.lang.functional version of my article. I may have tidied it up a little for the Wiki; if so, those changes are lost. Let it hereby enter the Haskell List archive! The following message is a courtesy copy of an article that has been posted as well. Matti Nykanen <[EMAIL P

Re: doubly linked list

2000-04-27 Thread Jan Kort
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

Re: doubly linked list

2000-04-27 Thread Keith Wansbrough
Jan Brosius wrote: > > > I wonder if it is possible to simulate a doubly linked list > > in Haskell. I wrote: > > No need to simulate it... it's perfectly possible. See my > > Wiki article. Chris Angus wrote: > Where is this article. > I looked on Haskell.org to no avail Good point! I ha

Re: doubly linked list

2000-04-27 Thread Chris Okasaki
> I wonder if it is possible to simulate a doubly linked list in > Haskell. Depends on what you mean. - Using mutable state in a monad you can implement a doubly linked list directly. - If you store all the nodes of the doubly linked list in an array and simulate the pointers with

Re: doubly linked list

2000-04-27 Thread Keith Wansbrough
> I wonder if it is possible to simulate a doubly linked list in Haskell. No need to simulate it... it's perfectly possible. See my Wiki article. --KW 8-) -- : Keith Wansbrough, MSc, BSc(Hons) (Auckland) ---: : PhD Student, Computer Laboratory, University of Cambridge, UK. : :