Re: [Haskell-cafe] List spine traversal

2009-07-01 Thread Matthias Görgens
As a side note, (allowing seq and unsafePerformIO if necessary) is it possible to implement a map that preserves cycles (instead of transparently replacing them with infinite copies?  Not horribly useful, but would be quite cute. Baltasar Trancon y Widemann gave a talk on a generalized

Re: [Haskell-cafe] List spine traversal

2009-07-01 Thread Andrew Hunter
2009/7/1 Matthias Görgens matthias.goerg...@googlemail.com: As a side note, (allowing seq and unsafePerformIO if necessary) is it possible to implement a map that preserves cycles (instead of transparently replacing them with infinite copies?  Not horribly useful, but would be quite cute.

Re: [Haskell-cafe] List spine traversal

2009-07-01 Thread Martin Huschenbett
Hi Andrew, you will find it there but it's written in German. http://opus.kobv.de/tuberlin/volltexte/2008/1755/ Regards, Martin. Andrew Hunter schrieb: 2009/7/1 Matthias Görgens matthias.goerg...@googlemail.com: As a side note, (allowing seq and unsafePerformIO if necessary) is it possible

Re: [Haskell-cafe] List spine traversal

2009-07-01 Thread Matthias Görgens
you will find it there but it's written in German. Yes. But at least there's an English abstract. Matthias. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] List spine traversal

2009-06-30 Thread Ryan Ingram
On Mon, Jun 29, 2009 at 7:36 PM, Geoffrey Marchantgeoffrey.march...@gmail.com wrote: I think I can see the point of forcing a list without forcing the actual data, but is there a way to do this that works on circular lists as well? There can't be a way to do so that is pure, because such a

Re: [Haskell-cafe] List spine traversal

2009-06-30 Thread Andrew Hunter
On Mon, Jun 29, 2009 at 11:30 PM, Ryan Ingramryani.s...@gmail.com wrote: There can't be a way to do so that is pure, because such a function could distinguish between xs1 = () : xs1 and xs2 = f () where f () = () : f () But doesn't seq and friends cause many of our normal referential

Re: [Haskell-cafe] List spine traversal

2009-06-30 Thread Don Stewart
andrewhhunter: On Mon, Jun 29, 2009 at 11:30 PM, Ryan Ingramryani.s...@gmail.com wrote: There can't be a way to do so that is pure, because such a function could distinguish between xs1 = () : xs1 and xs2 = f () where f () = () : f () But doesn't seq and friends cause many of our

Re: [Haskell-cafe] List spine traversal

2009-06-30 Thread Ryan Ingram
seq allows you to distinguish (undefined) from (const undefined) case allows you to distinguish (undefined) from the pair (undefined, undefined) isFun f = f `seq` True isPair p = case p of (_,_) - True isFun undefined - undefined isFun (const undefined) - True isPair undefined - undefined

Re: [Haskell-cafe] List spine traversal

2009-06-29 Thread Martijn van Steenbergen
Tony Morris wrote: Is there a canonical function for traversing the spine of a list? I could use e.g. (seq . length) but this feels dirty, so I have foldl' (const . const $ ()) () which still doesn't feel right. What's the typical means of doing this? (seq . length) doesn't sound that bad to

Re: [Haskell-cafe] List spine traversal

2009-06-29 Thread Deniz Dogan
2009/6/29 Martijn van Steenbergen mart...@van.steenbergen.nl: Tony Morris wrote: Is there a canonical function for traversing the spine of a list? I could use e.g. (seq . length) but this feels dirty, so I have foldl' (const . const $ ()) () which still doesn't feel right. What's the

Re: [Haskell-cafe] List spine traversal

2009-06-29 Thread Ketil Malde
Deniz Dogan deniz.a.m.do...@gmail.com writes: What is the spine of a list? Google seems to fail me on this one. A (single-linked) list can be seen as a set of cons cells, where each cell contains two pointers, one to the next cons cell, and one to the cell's data contents ('car' and 'cdr' in

Re: [Haskell-cafe] List spine traversal

2009-06-29 Thread Graham Fawcett
On Sun, Jun 28, 2009 at 10:05 PM, Tony Morristonymor...@gmail.com wrote: Is there a canonical function for traversing the spine of a list? I could use e.g. (seq . length) but this feels dirty, so I have foldl' (const . const $ ()) () which still doesn't feel right. What's the typical means of

Re: [Haskell-cafe] List spine traversal

2009-06-29 Thread Geoffrey Marchant
I think I can see the point of forcing a list without forcing the actual data, but is there a way to do this that works on circular lists as well? On Mon, Jun 29, 2009 at 3:30 AM, Ketil Malde ke...@malde.org wrote: Deniz Dogan deniz.a.m.do...@gmail.com writes: What is the spine of a list?

[Haskell-cafe] List spine traversal

2009-06-28 Thread Tony Morris
Is there a canonical function for traversing the spine of a list? I could use e.g. (seq . length) but this feels dirty, so I have foldl' (const . const $ ()) () which still doesn't feel right. What's the typical means of doing this? -- Tony Morris http://tmorris.net/