G'Day,
and phew... quite a lot of code to grok. Thanks for the answers, they're much
appreciated.
On Sun, Jan 4, 2009 at 1:43 AM, Niklas Broberg wrote:
>
> What you need is for the nodes to keep track of the length of the
> list. Here's a different solution from that oleg posted, to me it's
> sl
> Is it possible to change a particular node of the
> doubly linked list? That is to say, that would like
> to have a function:
> update :: DList a -> a -> DList a
> where
> update node newValue
> returns a list where only the value at the node
> which is passed in is set to the new Value and
> all
Thanks for the answers to all.
Untying the knot was (and still is) exactly the problem I was facing.
I knew that the whole list had to be rebuild and wasn't concerned
with performance since at that point I just wanted to know how to
do it and if it is possible at all. After I realized that it maybe
Also, it's actually really hard to tie the knot in the update; without
some kind of distinguished node that allows you to know that it is the
beginning/end of the list.
For example, in this DList:
1,1,1, lots of times, 1, 2, 1, 1, ... lots of times, 1, (loop)
If you change the 3rd "1", how
Hi Stephan,
S. Günther wrote:
Is it possible to change a particular node of the
doubly linked list? That is to say, that would like
to have a function:
update :: DList a -> a -> DList a
where
update node newValue
returns a list where only the value at the node
which is passed in is set to the ne
Hello,
I was trying to wrap my head around the stuff at
http://haskell.org/haskellwiki/Tying_the_Knot (again)
and along the way came a question:
Is it possible to change a particular node of the
doubly linked list? That is to say, that would like
to have a function:
update :: DList a -> a -> DList