[BULK] [plt-scheme] Using stepper

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Fri Feb 13 16:42:43 EST 2009

On Feb 13, 2009, at 4:21 PM, aditya shukla wrote:

> I am trying to use stepper to see how the code works , i am in  
> interactive student with lambda language and i have made a file eg1.ss
>  define g (lambda(x)(+ x 1))) .When i open it in stepper and click  
> on step nothing  except i just get All of the definitions have been  
> successfully evaluated.This is maybe a very silly question but any  
> help is appreciated.

Perhaps the confusion is that the word "lambda" appears just after a  
left parenthesis as though it were a function like "+" or "sqrt", so  
one might be tempted to think of "lambda" as the name of a function.   
But it is NOT a function; it's a notation for a particular kind of  
literal.

5
is a literal number.  It doesn't "stand for" anything else.  You  
could store it in a variable, e.g. (define age 5), or you can just  
use it by itself, e.g. (+ 3 5).

"hello"
is a literal string.  It doesn't "stand for" anything else.  You  
could store it in a variable, e.g. (define greeting "hello"), or you  
can just use it by itself, e.g. (string-length "hello").

'bluebird
is a literal symbol.  It doesn't "stand for" anything else.  You  
could store it in a variable, e.g. (define bird 'bluebird), or you  
can just use it by itself, e.g. (symbol=? pet 'bluebird).

(lambda (x) (+ x 1))
is a literal function.  It doesn't "stand for" anything else.  You  
could store it in a variable, e.g. (define g (lambda (x) (+ x 1)), or  
you can just use it by itself, e.g. ((lambda (x) (+ x 1)) 4).

If you wrote
(define g (lambda (x) (+ x 1)))
(g 4)
and hit "Step" in the Stepper,
the first step would be replacing the variable name "g" in the last  
line with its value "(lambda (x) (+ x 1))",
the second step would be replacing "((lambda (x) (+ x 1)) 4)" with  
"(+ 4 1)", and
the third step would be replacing "(+ 4 1)" with "5".



Stephen Bloch
sbloch at adelphi.edu



Posted on the users mailing list.