Subject: Re: Detecting Infinite Looping From: Paul Prescod <papresco@xxxxxxxxxxxxxxxx> Date: Tue, 03 Feb 1998 18:27:47 -0500 |
I didn't see an answer to this old question. Sorry if it has come through and I missed it. > At 09:40 AM 1/29/98 +0000, Henry Thompson wrote: > >PS. You can see the tail recursion more clearly by using a named 'let' > > > >(define f1 > > (lambda (arg) > > (let loop ((x arg) > > (result BASE)) > > (if P > > result > > (loop NEXT (append result (list F))))))) W. Eliot Kimber wrote: > > Also, what is the significance of the lamba in the above? I've never been > able to grasp the significance of using lamba instead of a simple let > statement. I know it has something to do with variable binding and scope, > but I'm dashed as to what it is. Lambda creates a function. These are equivalent: (define (f1 arg) ...) (define f1 (lambda (arg) ...) The former syntax gets rid of the cryptic lambda, but the latter hints at more powerful things: (map (lambda (foo) (* 2 foo)) (list 1 2 3 4)) This creates an anonymous function that takes one argument and doubles it. Map applies it to the list. The result is (2 4 6 8) > I'm the sure the problem is with name > lambda--it means nothing to me (at least with respect to mathematics--it > does have a political connotation, at least in the United States). At SGML/XML 97 I pointed out the "House of Lambda" to Matthew Fuchs, a big fan of Scheme. The name comes from the "lambda calculus" -- the mathematical foundation of functional languages. I think it was an arbitrary choice of a greek letter (which is typical in mathematics). Scheme and Lisp are unfortunately littered with these historical names ("car", "cdr", etc.). Non-parenthesized functional languages seem to have had more success choosing more meaningful names ("hd", "tl", "func"). Paul Prescod DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: DSSSL/XSL course Louvain (Belgi, Paul Hermans | Thread | RE: Detecting Infinite Looping, Frank A. Christoph |
RE: DSSSL/XSL course Louvain (Belgi, Paul Hermans | Date | Questions about DSSSL evaluation or, KAZUMI Saito |
Month |