[Haskell-cafe] Design Patterns by Gamma or equivalent
Don Stewart
dons at galois.com
Sun Mar 15 01:43:21 EDT 2009
wren:
> There also a number of "idioms" which are similar in scope to the idioms
> that arise in other languages: using tail recursion, accumulators,
> continuation-passing transformations, closures over recursion[6],
> Schwartzian transforms, etc.
> [6] For lack of a better name. I mean doing this:
>
> > -- Here the a,b,c,d variables are captured in the closure for go
> > recursive a b c d = go
> > where
> > go 0 = ...a...b...
> > go n = ...c...d...go (n-1)
>
> instead of this:
>
> > -- ...instead of needing to be passed through the recursion each time
> > recursive a b c d 0 = ...a...b...
> > recursive a b c d n = ...c...d...recursive a b c d (n-1)
>
Static argument transformation:
http://hackage.haskell.org/trac/ghc/ticket/888
http://www.haskell.org/pipermail/cvs-ghc/2008-April/041959.html
Or more generally worker/wrapper
http://www.workerwrapper.com/
Take your pick :)
More information about the Haskell-Cafe
mailing list