From: Theo Norvell <[EMAIL PROTECTED]>

>See http://www.engr.mun.ca/~theo/Publications/indExamp.lgs
>for three versions. The simplest is just
>
>> p 0 n = n+1
>> p (m+1) 0 = p m 1
>> p (m+1) (n+1) = p m (p (m+1) n)


    Thanks!  =)

    Of course it was so simple that I couldn't figure it out.


>The other two illustrate how to do it using combinators rather than
>explicit recursion.


    Yes, I've heard of this too.  Looking forward to trying them out
(already snagged the file).


>If you are comparing speed, I doubt Hugs will outperform a compiled C
or
>Pascal program, as Hugs is an interpreter. It might be interesting to
>compare compiled Haskell to C or Pascal.


    Yes, I've taken that into account... wasn't really planning on
comparing Hugs speed to any compiled C.  Was more interested in
comparing the "cleanliness" of the code (for which Haskell is _very_
eloquent).  Haven't tried any compiled Haskell as of yet, but I'm slowly
working towards it.  Got started with Simon Thompson's book (Haskell:
The Craft of Functional Programming, 2nd ed), in which Hugs generally
referred to.


>Cheers,
>Theo Norvell
>
>----------------------------
>Dr. Theodore Norvell
[EMAIL PROTECTED]
>Electrical and Computer Engineering
http://www.engr.mun.ca/~theo
>Engineering and Applied Science                           Phone: (709)
737-8962
>Memorial University of Newfoundland                         Fax: (709)
737-4042
>St. John's, NF, Canada, A1B 3X5


    Thanks again.

Regards,
    W.Young

Reply via email to