On 12/07/2025 11:12, 胡峻豪 wrote:
(do ((i 0 (+ i 1)))

     ((= i 2))

     (begin

         (define x 2)

         (display x)

     )

)

Can be done by redefining 'do'

Basically, let '(new-do x y body ...)' be '(do x y (let () body ...))' and redefine 'do' by 'new-do' in some way (it is convenient to import the old 'do' under a different name). Or take the old definition of 'do', copy it, and insert a surrounding 'let' in the right lace.

Same applies to many other situations.

(Also, that 'begin' serves no purpose there.)

Best regards,
Maxime Devos


Reply via email to