Thank you for your comment

Beau­tiful Racket / racket school 2019

  1. "str"
    42
    1
    2
    "str"
    42
    
    copy to clipboard
    (#%datum . "str")
    (#%datum . 42)
    1
    2
    (#%datum . "str")
    (#%datum . 42)
    
    copy to clipboard
    (define-macro (#%datum . X)
      #'(list X X))
    42
    1
    2
    3
    (define-macro (#%datum . X)
      #'(list X X))
    42
    
    copy to clipboard
  2. (+ 42 -15)
    1
    (+ 42 -15)
    
    copy to clipboard
    (#%app + 42 -15)
    1
    (#%app + 42 -15)
    
    copy to clipboard
    (define-macro (#%app OP ARG ...)
      #'(OP (abs ARG) ...))
    (+ 42 -15)
    1
    2
    3
    (define-macro (#%app OP ARG ...)
      #'(OP (abs ARG) ...))
    (+ 42 -15)
    
    copy to clipboard
  3. (define-macro-cases m
      [(m ARG1) #''one]
      [(m ARG1 ARG2) #''two]
      [(m . ARGS) #`#,(length (syntax->list #'ARGS))])

    (m foo) ; 'one
    (m foo 42) ; 'two
    (m foo 42 "yeah") ; 3
    1
    2
    3
    4
    5
    6
    7
    8
    (define-macro-cases m
      [(m ARG1) #''one]
      [(m ARG1 ARG2) #''two]
      [(m . ARGS) #`#,(length (syntax->list #'ARGS))])
    
    (m foo) ; 'one
    (m foo 42) ; 'two
    (m foo 42 "yeah") ; 3
    
    copy to clipboard
  4. (define-macro (m THING)
      (define datum (syntax->datum #'THING))
      (cond
        [(number? datum) #'"wow!"]
        [else #'THING]))

    (m 99)
    (m "foo")
    (define x 42)
    (m x)
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    (define-macro (m THING)
      (define datum (syntax->datum #'THING))
      (cond
        [(number? datum) #'"wow!"]
        [else #'THING]))
    
    (m 99)
    (m "foo")
    (define x 42)
    (m x)
    
    copy to clipboard
injunction/test.rkt
#lang injunction

"hello world"
(+ 1 (* 2 (- x)))
1
2
3
4
#lang injunction

"hello world"
(+ 1 (* 2 (- x)))
copy to clipboard
injunction/main.rkt
#lang br

;; smop ···

(module reader syntax/module-reader
  injunction)
1
2
3
4
5
6
#lang br

;; smop ···

(module reader syntax/module-reader
  injunction)
copy to clipboard
← prev next →