2009/3/27 Kirk Martinez <[email protected]>: > 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.
That's because it is. It's an array whose elements are computed on demand. > This harks back to my Scheme days when we > learned about the close relationship between code and data. > > I wonder: does the converse exist? Haskell data constructors which are > really functions? How and for what might one use those? Sure. You can use Church encoding to represent any Haskell data type as a function. -- Dave Menendez <[email protected]> <http://www.eyrie.org/~zednenem/> _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
