[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: functional languages



"Eric G. Miller" <egm2@jps.net> writes:

> The C and Scheme functions are essentially identical.  

Well, one important difference is that the scheme standard requires
that the language support an infinite number of tail calls.

(define (countdown x)
  (cond 
   ((<= 0 x)
    (write x) (newline)
    (countdown (- x 1)))))

will work fine when called as (countdown 1000000), the equivalent C
version might well exhaust the stack.

> In C, statements are executed in order.  I'm not too up on
> functional languages, but I seem to recall they need special syntax
> to execute statements sequentially.

Not really.  top level forms in a scheme program are executed
sequentially, and there's a number of forms that execute their
statements sequentially.  I'm not up on haskell, or other "pure"
functional languages though :)

-- 
Eric E. Moore

Attachment: pgpxFl_XwbAvv.pgp
Description: PGP signature


Reply to: