Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-30 Thread Henning Thielemann
On Wed, 28 May 2008, Ketil Malde wrote: Bulat Ziganshin [EMAIL PROTECTED] writes: well, i don't understand difference between your idea and lazybs implementation HT said earlier that: This would still allow the nice tricks for recursive Fibonacci sequence definition. Which I guess

Re[2]: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-29 Thread Henning Thielemann
On Thu, 29 May 2008, Bulat Ziganshin wrote: Hello Andrew, Wednesday, May 28, 2008, 10:37:47 PM, you wrote: looks like lazy.bytestring generalized to any a That sounds like a darn useful thing to have... well, support on only Word8 as base type isn't some fundamental limit, just creators

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Bulat Ziganshin
Hello Henning, Wednesday, May 28, 2008, 9:51:28 AM, you wrote: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End by an unboxed array with a cursor to the next element to be evaluated and a function that generates the next element.

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Henning Thielemann
On Wed, 28 May 2008, Bulat Ziganshin wrote: Hello Henning, Wednesday, May 28, 2008, 9:51:28 AM, you wrote: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End by an unboxed array with a cursor to the next element to be evaluated and

Re[2]: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Bulat Ziganshin
Hello Henning, Wednesday, May 28, 2008, 12:22:54 PM, you wrote: Whenever an element with an index beyond the cursor is requested, sufficiently many new elements are written to the array and the cursor is advanced. As far as I know, ByteString.Lazy is chunky, that is laziness occurs only

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Bulat Ziganshin [EMAIL PROTECTED] writes: well, i don't understand difference between your idea and lazybs implementation HT said earlier that: This would still allow the nice tricks for recursive Fibonacci sequence definition. Which I guess refers to something like: fibs = 1 : 1 :

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Henning Thielemann
On Wed, 28 May 2008, Duncan Coutts wrote: On Wed, 2008-05-28 at 10:22 +0200, Henning Thielemann wrote: On Wed, 28 May 2008, Bulat Ziganshin wrote: Hello Henning, Wednesday, May 28, 2008, 9:51:28 AM, you wrote: We could simulate a list with strict elements, i.e. data StrictList a

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: You've lost me at least. ...but perhaps I can find my way back on my own? Today, you can choose between Array, with lazy elements, or UArray, with strict elements. Lazy arrays have the elements defined in advance, strict ones have them calculated in

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Duncan Coutts
On Wed, 2008-05-28 at 10:22 +0200, Henning Thielemann wrote: On Wed, 28 May 2008, Bulat Ziganshin wrote: Hello Henning, Wednesday, May 28, 2008, 9:51:28 AM, you wrote: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Henning Thielemann [EMAIL PROTECTED] writes: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End by an unboxed array with a cursor to the next element to be evaluated and a function that generates the next element. [...] looks like

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Henning Thielemann
On Wed, 28 May 2008, Ketil Malde wrote: Bulat Ziganshin [EMAIL PROTECTED] writes: well, i don't understand difference between your idea and lazybs implementation HT said earlier that: This would still allow the nice tricks for recursive Fibonacci sequence definition. Which I guess

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Don Stewart
lemming: I wonder whether the following idea has been investigated or implemented somewhere: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End I've used the above structure itself, as a useful alternative to fully lazy lists.

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Henning Thielemann
On Wed, 28 May 2008, Ketil Malde wrote: Ketil Malde [EMAIL PROTECTED] writes: You've lost me at least. ...but perhaps I can find my way back on my own? Today, you can choose between Array, with lazy elements, or UArray, with strict elements. ... and ByteStrings, where in principle the

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Henning Thielemann
On Wed, 28 May 2008, Don Stewart wrote: by an unboxed array with a cursor to the next element to be evaluated and a function that generates the next element. Whenever an element with an index beyond the cursor is requested, sufficiently many new elements are written to the array and the

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Andrew Coppin
Bulat Ziganshin wrote: Hello Henning, looks like lazy.bytestring generalized to any a That sounds like a darn useful thing to have... [OTOH, currently unboxed arrays are available only for a select few types, so good luck implementing this in a clean way!]

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Don Stewart
bulat.ziganshin: Hello Andrew, Wednesday, May 28, 2008, 10:37:47 PM, you wrote: looks like lazy.bytestring generalized to any a That sounds like a darn useful thing to have... well, support on only Word8 as base type isn't some fundamental limit, just creators of bytestring package was

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: http://code.haskell.org/~dons/uvector http://code.haskell.org/~dons/code/uvector (I presume? The other URL gives a 404) -k -- If I haven't seen further, it is by standing in the footprints of giants ___

[Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-27 Thread Henning Thielemann
I wonder whether the following idea has been investigated or implemented somewhere: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End by an unboxed array with a cursor to the next element to be evaluated and a function that generates