[Haskell-cafe] compiler implementation details
José Miguel Vilaça
jmvilaca at di.uminho.pt
Tue Jun 5 06:37:03 EDT 2007
Hi,
Im curious about how the Haskell compilers nowadays take care of a simple
function definition like append
append [] l = l
append (h:t) l = h: (append t l)
Do they take a rewriting way like
append [1,2] [3,4] ==> 1: (append [2] [3,4])
==> 1: (2 : (append [] [3,4]) )
==> 1 : (2: [3,4])
==> [1,2,3,4]
Or do they converte the append definintion to some lambda-calculus flavour
language
append = Y (\f -> \l1 l2 -> case l1 of
[] -> l2
(h:t) -> h: (f t l2))
And then apply this converted definition to the arguments?
Best
Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070605/9a3bdf25/attachment.htm
More information about the Haskell-Cafe
mailing list