[Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread GüŸnther Schmidt
Hi Bulat, that is so cool! Günther Bulat Ziganshin schrieb: Hello Gü?nther, Friday, March 27, 2009, 11:30:41 PM, you wrote: Some of the memoizing functions, they actually remember stuff *between* calls? what i've seen in haskell - functions relying on lazy datastructures that ensure

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Kirk Martinez
It seems there is a very close correspondence between data structures and functions in Haskell. Your powersOfTwo function, since it gets memoized automatically (is this the case for all functions of zero arguments?), seems exactly like a data structure. This harks back to my Scheme days when we

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Jonathan Cast
On Fri, 2009-03-27 at 14:26 -0700, Kirk Martinez wrote: Your powersOfTwo function, since it gets memoized automatically (is this the case for all functions of zero arguments?), It is the case for all functions which have zero arguments *at the time they are presented to the code generator*.

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread David Menendez
2009/3/27 Kirk Martinez kirk.marti...@gmail.com: It seems there is a very close correspondence between data structures and functions in Haskell.  Your powersOfTwo function, since it gets memoized automatically (is this the case for all functions of zero arguments?), seems exactly like a data

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Dan Piponi
2009/3/27 Kirk Martinez kirk.marti...@gmail.com: I wonder: does the converse exist? Haskell data constructors which are really functions? How and for what might one use those? You might enjoy reading about the use of tries for memoisation. Conal Elliott explains nicely how you can an

[Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Gü?nther Schmidt
Hi Dan, yep, I've come across that one too and wouldn't you know it, the by now infamous Luke Palmer has left an interesting insight on that blog too :). So I reckon here the cycle closes. Günther Dan Piponi schrieb: 2009/3/27 Kirk Martinez kirk.marti...@gmail.com: I wonder: does the

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Martijn van Steenbergen
Kirk Martinez wrote: It seems there is a very close correspondence between data structures and functions in Haskell. Your powersOfTwo function, since it gets memoized automatically (is this the case for all functions of zero arguments?), seems exactly like a data structure. This harks back