Welcome to the CHICKEN Scheme pasting service

interesting (define & binding forms) pasted by mario-goulart on Wed Sep 4 18:54:46 2013

(let ((a 1))
  (define (f x)
    (define b (+ a x))
    (define a 5)
    (+ a b))
  (f 10))

Error: (+) bad argument type: #<unspecified>

        Call history:

        <syntax>          (##core#begin (##core#set! f (##core#lambda (x) (define b (+ a x)) (define a 5) (+ a b))) (f 10))
        <syntax>          (##core#set! f (##core#lambda (x) (define b (+ a x)) (define a 5) (+ a b)))
        <syntax>          (##core#lambda (x) (define b (+ a x)) (define a 5) (+ a b))
        <syntax>          [f] (##core#let ((b (##core#undefined)) (a (##core#undefined))) (##core#set! b (+ a x)) (##core#set! a 5...
        <syntax>          [f] (##core#begin (##core#set! b (+ a x)) (##core#set! a 5) (+ a b))
        <syntax>          [f] (##core#set! b (+ a x))
        <syntax>          [f] (+ a x)
        <syntax>          [f] (##core#set! a 5)
        <syntax>          [f] (##core#begin (+ a b))
        <syntax>          [f] (+ a b)
        <syntax>          [f] (##core#undefined)
        <syntax>          [f] (##core#undefined)
        <syntax>          (f 10)
        <syntax>          (##core#undefined)
        <eval>    (f 10)
        <eval>    [f] (+ a x)   <--


;;; "Same" code, but with prints

(let ((a 1))
  (define (f x)
    (define b (+ a x))
    (print "b=" b)
    (define a 5)
    (print "a=" a)
    (+ a b))
  (f 10))

b=11
a=5
16

two different results are not enough added by mario-goulart on Wed Sep 4 19:23:08 2013

$ cat crazy.scm
(let ((a 1))
  (define (f x)
    (define b (+ a x))
    (define a 5)
    (+ a b))
  (print (f 10)))


$ csc crazy.scm

$ ./crazy
20

$ cat crazy2.scm
(let ((a 1))
  (define (f x)
    (define b (+ a x))
    (print "b=" b)
    (define a 5)
    (print "a=" a)
    (+ a b))
  (print (f 10)))

$ csc crazy2.scm

$ ./crazy2
b=11
a=5
16

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the result of `(and #t (or 'damn 'you 'spammers))'?
Visually impaired? Let me spell it for you (wav file) download WAV