Welcome to the CHICKEN Scheme pasting service

expansion of (with-definitions ((define a ) (define (b) (with-definitions ((define a ) (define (b) 2)) a)2)) a) added by C-Keen on Thu Oct 20 09:03:07 2011

$ csc -debug 1 ch11_with-definitions.scm 
[source]
(define-syntax
  with-def
  (syntax-rules
    (define)
    ((_ (define (sym . args) body-first . body-rest))
     (sym (lambda args body-first . body-rest)))
    ((_ (define sym form)) (sym form))))

(define-syntax
  with-definitions
  (syntax-rules
    ()
    ((_ (def ...) body-first . body-rest)
     (letrec ((with-def def) ...) body-first . body-rest))))

(define (example x)
  (with-definitions
    ((define (is-even? x) (zero? (remainder x 2)))
     (define rofl "rolling on the floor laughing"))
    (if (is-even? x) (display rofl) (display ":("))))

$ csc -debug 2 ch11_with-definitions.scm 
[canonicalized]
(##core#callunit "library")

(##core#callunit "eval")

(##core#undefined)

(##core#undefined)

(##core#undefined)

(set! example
  (##core#lambda
    (x95)
    (let ((with-def9798 (##core#undefined)) (with-def9799 (##core#undefined)))
      (let ((t103 (set! with-def9798
                    (set! is-even?
                      (##core#lambda (x101) (zero? (remainder x101 '2)))))))
        (let ((t104 (set! with-def9798
                      (set! rofl '"rolling on the floor laughing"))))
          (let () (if (is-even? x95) (display rofl) (display '":("))))))))

((##sys#implicit-exit-handler))

(##core#undefined)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
`call/cc' is a short name for which procedure?
Visually impaired? Let me spell it for you (wav file) download WAV