Re: [isabelle] No tail-recursive code equation for

On Sat, Apr 27, 2013 at 6:20 AM, Florian Haftmann
<florian.haftmann at> wrote:
> Before making any step ahead, it would be good to collect some general
> observations which shapes of code equations are particularly suitable
> for certain target languages, e.g.
> * avoid Currying in languages which have bias towards tupled function
> arguments (Scala)
> * avoid tail recursion in lazy languages (Haskell)
> * eta-expand certain function defintions (???)
> * …

"Avoid tail recursion" is not good general advice for Haskell!

Tail-recursive implementations are preferred for many Haskell
functions, especially those that always consume the entire input
before they can produce any output. For example, "sum :: [Int] -> Int"
is best as tail-recursive. Functions like "map" and "[m..n]" are
implemented without tail recursion so that they can produce output

A better rule of thumb for Haskell is that for functions that return
lazy datatypes, equations with a lazy constructor surrounding any
recursive calls are preferable.

- Brian

This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.