Help understanding Scheme's syntax, procedures and calls

Fran franbarlow at mail.com
Thu Aug 12 16:16:01 EDT 2004


Peter Hickman <peter at semantico.com> wrote in message news:<411b577a$0$20523$afc38c87 at news.easynet.co.uk>...
> Unfortunately it looks more like 'broken scheme'.
> 
> Fran wrote:
> > (define (this n)
> > 	(if (=n 0)
> > 	         0
> > 	          (= n (this (- n 1)))))
> 
> That looks fine, however:
> 
> > (define (f1 a b)
> > 	(if >b a)
> > 	       0
> > 	       (+ b (f1 a (+ b 1)))))
> 
> Has 6 (s and 7 )s. I expect that the seconds line should read
> 	(if (> b a)
> 
> > (define (that n)
> > (f1 n1)
> 
> Again there is an imbalance in the ( and ), I think the second line should read 
> (f1 n 1)), note the space between then 'n' and the '1'.
> 
> Is this someone's homework by any chance?

Thanks for the help. It's not homework but from an old exam paper, but
the girl's English isn't absolutely fluent and I'm looking for a
simple way to explain the expressions and functions.

FRAN



More information about the Python-list mailing list