[racket] define, let, and any other options?

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Oct 19 04:56:42 EDT 2010

Four minutes ago, 김태윤 wrote:
> every time I want to use variable, do I have to use "define" for
> global scope and "let" for local scope?  I can't use define in
> function and I have to define body when I using "let" is there any
> easy way to use variable? as like other language?  thanks in
> advanced

You can also use `define' for local bindings:

  (define (foo x)
    (define y (* x 8))
    (+ x y))
  (foo 5) => 45

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.