[Haskell-cafe] Re: appending an element to a list

2008-06-07 Thread apfelmus
Ronald Guida wrote: Thank you, apfelmus. That was a wonderful explanation; the debit method in [1] finally makes sense. A diagram says more than a thousand words :) My explanation is not entirely faithful to Okasaki, let me elaborate. In his book, Okasaki calls the process of transferring

[Haskell-cafe] Re: appending an element to a list

2008-06-03 Thread apfelmus
Abhay Parvate wrote: I somehow thought it would be easy to talk about complexity of calculating individual elements in an infinite list should be sufficient, but that seems to be involved, and my over-generalization doesn't seem to work. Thanks for the link; particularly it has reference to

Re: [Haskell-cafe] Re: appending an element to a list

2008-06-03 Thread Ronald Guida
Thank you, apfelmus. That was a wonderful explanation; the debit method in [1] finally makes sense. [1]: Chris Okasaki. Purely Function Data Structures. http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: appending an element to a list

2008-06-01 Thread apfelmus
Tillmann Rendel wrote: Abhay Parvate wrote: I think I would like to make another note: when we talk about the complexity of a function, we are talking about the time taken to completely evaluate the result. Otherwise any expression in haskell will be O(1), since it just creates a thunk. I

Re: [Haskell-cafe] Re: appending an element to a list

2008-06-01 Thread Abhay Parvate
I somehow thought it would be easy to talk about complexity of calculating individual elements in an infinite list should be sufficient, but that seems to be involved, and my over-generalization doesn't seem to work. Thanks for the link; particularly it has reference to Wadler's papers exactly on

Re: [Haskell-cafe] Re: appending an element to a list

2008-05-31 Thread Tillmann Rendel
Abhay Parvate wrote: I think I would like to make another note: when we talk about the complexity of a function, we are talking about the time taken to completely evaluate the result. Otherwise any expression in haskell will be O(1), since it just creates a thunk. I don't like this notion of

[Haskell-cafe] Re: appending an element to a list

2008-05-30 Thread Martin Geisler
Tillmann Rendel [EMAIL PROTECTED] writes: Hi! (Cool, another guy from DAIMI on haskell-cafe!) Another (n - 1) reduction steps for the second ++ to go away. last (o ++ l) A) ~ last ('o' : ++ l)) L) ~ last ( ++ l) A) ~ last (l) L) ~ 'l' And the third and fourth ++ go away

Re: [Haskell-cafe] Re: appending an element to a list

2008-05-30 Thread Abhay Parvate
I think I would like to make another note: when we talk about the complexity of a function, we are talking about the time taken to completely evaluate the result. Otherwise any expression in haskell will be O(1), since it just creates a thunk. And then the user of the program is to be blamed for