Last active
March 7, 2016 22:01
-
-
Save delonnewman/b71e551d242929861f5c to your computer and use it in GitHub Desktop.
Some macros written in WonderScript as JavaScript data structures (found in the core library).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ws.eval( | |
['defmacro', 'let', ['form'], | |
['do', | |
['def', 'bindings', | |
['map', ['pair', ['form', 1]] , ['fn', ['x'], ['.concat', ['array', '`def'], 'x']]]], | |
['def', 'exprs', ['.slice', 'form', 2]], | |
['.concat', ['array', '`do'], 'bindings', 'exprs']]]); | |
ws.eval( | |
['defmacro', 'deftype', ['form'], | |
['list', ['symbol', '"def"'], ['form', 1], | |
['.concat', ['list', ['symbol', '"dataType"']], ['.slice', 'form', 2]]]]); | |
ws.eval( | |
['defmacro', 'defprotocol', ['form'], | |
['list', ['symbol', '"def"'], ['form', 1], | |
['.concat', ['list', ['symbol', '"protocol"']], ['.slice', 'form', 2]]]]); | |
ws.eval( | |
['defmacro', 'while', ['form'], | |
['list', ['symbol', '"doWhile"'], | |
['list', ['symbol', '"fn"'], ['list'], ['form', 1]], | |
['list', ['symbol', '"fn"'], ['list'], ['form', 2]]]]); | |
ws.eval( | |
['defmacro', 'until', ['form'], | |
['list', ['symbol', '"doWhile"'], | |
['list', ['symbol', '"fn"'], ['list'], | |
['list', ['symbol', '"not"'], ['form', 1]]], | |
['list', ['symbol', '"fn"'], ['list'], | |
['.concat', ['list', ['symbol', '"do"']], ['.slice', 'form', 2]]]]]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment