[Haskell-cafe] Strict type system allows for a maximum number of programming errors to be caught at compile time.

Daniel Peebles pumpkingod at gmail.com
Tue May 4 00:30:44 EDT 2010


prefac is just a normal factorial function with recursion factored out. fix
prefac 5 gives 120, for example.

On Tue, May 4, 2010 at 12:13 AM, Ivan Miljenovic
<ivan.miljenovic at gmail.com>wrote:

> On 4 May 2010 13:30, Luke Palmer <lrpalmer at gmail.com> wrote:
> > Here is a contrived example of what I am referring to:
> >
> > prefac f 0 = 1
> > prefac f n = n * f (n-1)
> >
> > fac = (\x -> x x) (\x -> prefac (x x))
>
> I can't work out how this works (or should work rather); is it meant
> to be using church numerals or something (assuming that they have been
> made an instance of Num so that - and * work)?
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> IvanMiljenovic.wordpress.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100503/d19af264/attachment.html


More information about the Haskell-Cafe mailing list