Racket has built-in fundamental form 2-arm if
, but it doesn't have the word else
, so I want to add the else
word to it.
This code works:
(require syntax/parse/define)
(define-syntax-rule (myif Cond Form1 else Form2)
(if Cond Form1 Form2)
)
(myif #t (displayln 1) else (displayln 2))
However myif
is undesired as keyword, changing it to if
raises error:
if: use does not match pattern: (if Cond Form1 else Form2)
in: (if #t (displayln 1) (displayln 2))
How to redefine the form if
?