difficulty to catch the idea jobol (23 Apr 2024 21:09 UTC)
(missing)
Re: difficulty to catch the idea Sergei Egorov (24 Apr 2024 04:13 UTC)

difficulty to catch the idea jobol 23 Apr 2024 21:09 UTC

Quoting the 2 last examples of the SRFI:

----------------------------------------------

 These two examples print “the result is: 0”:

(let ((x 0))
  (display "the result is")
  (define (foo) x)
  (display ": ")
  (define xx 42)
  (display (foo)))

(let ((x 0))
  (define-syntax define-thunk
    (syntax-rules ()
      ((_ i v) (define (i) v))))
  (display "the result is")
  (display ": ")
  (define xx 42)
  (define-thunk foo x)
  (display (foo)))

----------------------------------------------

I don't understand why in the first example the  last define is 'xx'?
My understanding is that if it was 'x' it also prints 0.

For the second example if it was 'x' instead of 'xx' I presume it
should print 42 but I'm suspecting that I misunderstand a detail.

Regards