On Sat, 22 Dec 2007, Cristian Baboi wrote: > On Sat, 22 Dec 2007 16:55:08 +0200, Miguel Mitrofanov > <[EMAIL PROTECTED]> wrote: > > > > > > In Haskell I cannot pass a function to a function, only its > > > > > expansion. > > > > > > > What do you mean by "expansion"? Can you clarify this? > > > > > > f1=\x->x+1 > > > f2=\x->2*x > > > g=\x->x.f1 > > > h=\x->x.(\x->x+1) > > > > > > h is g > > > > Not clear. Try starting with "function's expansion is..." > > > function's expansion is ... just like macro expansion.
No, it's not. Expanding variables (swapping f1 for \x->x+1) isn't the evaluation mechanism in haskell, g and h really are semantically equivalent values and we can't do actual computation just by expanding variables. Whereas expanding a macro is equivalent to beta-reduction (evaluating a function application), which isn't required before passing something in Haskell. We pass functions, not just their results. Here's a trivial example that does so: (\x -> x) (\x -> x) A lambda calculus classic that doesn't typecheck in Haskell: (\x -> x x) (\x -> x x) Feel free to try evaluating it! -- [EMAIL PROTECTED] "I think you mean Philippa. I believe Phillipa is the one from an alternate universe, who has a beard and programs in BASIC, using only gotos for control flow." -- Anton van Straaten on Lambda the Ultimate _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe