Message from discussion Lisp vs. Scheme
The group you are posting to is a Usenet group
. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From: Joe Marshall <j...@ccs.neu.edu>
Date: Fri, 19 Sep 2003 09:38:42 -0400
Local: Fri, Sep 19 2003 9:38 am
Subject: Re: Lisp vs. Scheme
(require (lib "defmacro.ss"))
@jpl.nasa.gov (Erann Gat) writes:
> In article <b295356a.0309181447.44dbe...
@gmx.net (thelifter) wrote:
>> Can anyone give a simple example where you do some computational task
>> with Lisp that would be much harder to do with Scheme so that the
>> advantage of Lisp becomes more apparent?
> (defmacro compile-time-factorial (n)
> (if (numberp n)
> (if (and (integerp n) (> n 0))
> (factorial n)
> (error "Can't take the factorial of ~S" n))
> (if (or (symbolp n) (listp n))
> `(factorial ,n)
> (error "Can't take the factorial of ~S" n))))
(defmacro compile-time-factorial (n)
(define (factorial x)
(if (zero? x)
(* x (factorial (sub1 x)))))
(if (number? n)
(if (and (integer? n) (> n 0))
(error "Can't take the factorial of " n))
(if (or (symbol? n) (list? n))
(error "Can't take the factorial of " n))))
You must Sign in
before you can post messages.
You do not have the permission required to post.