--- title: Memo tags: macro --- ## Fear of Macrosメモ --- ## syntax->datum syntaxからデータに変換 ```ocaml= > (syntax->datum #'a) 'a > (syntax->datum #'(x . y)) '(x . y) > (syntax->datum #'#(1 2 (+ 3 4))) '#(1 2 (+ 3 4)) > (syntax->datum #'#&"hello world") '#&"hello world" > (syntax->datum #'#hash((imperial . "yellow") (festival . "green"))) '#hash((festival . "green") (imperial . "yellow")) > (syntax->datum #'#(point 3 4)) '#(point 3 4) > (syntax->datum #'3) 3 > (syntax->datum #'"three") "three" > (syntax->datum #'#t) #t ``` --- ## datum->syntax データからsyntaxに変換 ```ocaml= > (datum->syntax #f "wards") #<syntax "wards"> ``` --- ## values Returns the given vs. That is, values returns its provided arguments. Examples: ```ocaml= > (values 1) 1 > (values 1 2 3) 1 2 3 > (values) ``` --- ## cond ```ocaml= (define (fee age) (cond ((or (<= age 3) (>= age 65)) 0) ((<= 4 age 6) 50) ((<= 7 age 12) 100) ((<= 13 age 15) 150) ((<= 16 age 18) 180) (else 200))) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up