PasteRack.org
Paste # 96430
2019-04-24 12:28:22

Fork as a new paste.

Paste viewed 30 times.


Embed:

  1. #lang racket
  2. (define-syntax (Let^ stx)
  3.   (syntax-case stx ()
  4.     [(Let^ () body) #'body]
  5.     [(Let^ ((first-id first-val) (id val) ...) body)
  6.      #'(let ([first-id first-val])
  7.          (Let^ [(id val) ...] body))]))
  8.  
  9. (module+ test
  10.   (require rackunit)
  11.   (check-equal? (Let^ ([x 5] [y (- x 3)]) (+ y y)) 4)
  12.   (check-equal? (Let^ ([x 5] [y (- x 3)] [y x]) (* y y)) 25))

=>