macroExpand for/doFor
This commit is contained in:
@@ -696,6 +696,16 @@ class SpecialForms {
|
||||
b.callSymbol("localFunction", [expandTypeAliases(args[0])].concat(args.slice(1).map(macroExpand)));
|
||||
};
|
||||
|
||||
function forExpander (keyword:String) {
|
||||
map[keyword] = (wholeExp:ReaderExp, args:Array<ReaderExp>, k:KissState) -> {
|
||||
var b = wholeExp.expBuilder();
|
||||
|
||||
b.callSymbol(keyword, [expandTypeAliases(args[0])].concat(args.slice(1).map(macroExpand)));
|
||||
};
|
||||
}
|
||||
forExpander("for");
|
||||
forExpander("doFor");
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@@ -57,5 +57,18 @@
|
||||
(makeExampleNoValues
|
||||
(localFunction :Stream s [] (Stream.fromString "")))
|
||||
|
||||
// for/doFor
|
||||
|
||||
(localVar listOfLists [["a b c"]["d e f"]])
|
||||
(defAlias &ident lol listOfLists)
|
||||
(defAlias &type Texty String)
|
||||
|
||||
(makeExampleNoValues
|
||||
(for [:Texty t1 :Texty t2 :Texty t3] lol
|
||||
null))
|
||||
|
||||
(makeExampleNoValues
|
||||
(doFor [:Texty t1 :Texty t2 :Texty t3] lol
|
||||
null))
|
||||
|
||||
)
|
Reference in New Issue
Block a user