Get the hyphens out of dict specforms
This commit is contained in:
@@ -154,12 +154,12 @@ class Macros {
|
|||||||
exps[2]
|
exps[2]
|
||||||
]).withPosOf(wholeExp);
|
]).withPosOf(wholeExp);
|
||||||
}
|
}
|
||||||
macros["set-nth"] = (wholeExp:ReaderExp, exps:Array<ReaderExp>, k:KissState) -> {
|
macros["setNth"] = (wholeExp:ReaderExp, exps:Array<ReaderExp>, k:KissState) -> {
|
||||||
wholeExp.checkNumArgs(3, 3, "(set-nth [list] [index] [value])");
|
wholeExp.checkNumArgs(3, 3, "(setNth [list] [index] [value])");
|
||||||
arraySet(wholeExp, exps, k);
|
arraySet(wholeExp, exps, k);
|
||||||
};
|
};
|
||||||
macros["dict-set"] = (wholeExp:ReaderExp, exps:Array<ReaderExp>, k:KissState) -> {
|
macros["dictSet"] = (wholeExp:ReaderExp, exps:Array<ReaderExp>, k:KissState) -> {
|
||||||
wholeExp.checkNumArgs(3, 3, "(dict-set [dict] [key] [value])");
|
wholeExp.checkNumArgs(3, 3, "(dictSet [dict] [key] [value])");
|
||||||
arraySet(wholeExp, exps, k);
|
arraySet(wholeExp, exps, k);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -32,8 +32,8 @@ class SpecialForms {
|
|||||||
wholeExp.checkNumArgs(2, 2, "(nth [list] [idx])");
|
wholeExp.checkNumArgs(2, 2, "(nth [list] [idx])");
|
||||||
arrayAccess(wholeExp, args, k);
|
arrayAccess(wholeExp, args, k);
|
||||||
};
|
};
|
||||||
map["dict-get"] = (wholeExp:ReaderExp, args:Array<ReaderExp>, k:KissState) -> {
|
map["dictGet"] = (wholeExp:ReaderExp, args:Array<ReaderExp>, k:KissState) -> {
|
||||||
wholeExp.checkNumArgs(2, 2, "(dict-get [dict] [key])");
|
wholeExp.checkNumArgs(2, 2, "(dictGet [dict] [key])");
|
||||||
arrayAccess(wholeExp, args, k);
|
arrayAccess(wholeExp, args, k);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ class SpecialForms {
|
|||||||
for (nameExp in nameExps)
|
for (nameExp in nameExps)
|
||||||
toVar(nameExp, switch (nameExp.def) {
|
toVar(nameExp, switch (nameExp.def) {
|
||||||
case KeyValueExp(keyExp, nameExp):
|
case KeyValueExp(keyExp, nameExp):
|
||||||
CallExp(Symbol("dict-get").withPosOf(valueExp), [uniqueVarSymbol, keyExp]).withPosOf(valueExp);
|
CallExp(Symbol("dictGet").withPosOf(valueExp), [uniqueVarSymbol, keyExp]).withPosOf(valueExp);
|
||||||
default:
|
default:
|
||||||
CallExp(Symbol("nth").withPosOf(valueExp),
|
CallExp(Symbol("nth").withPosOf(valueExp),
|
||||||
[uniqueVarSymbol, Symbol(Std.string(idx++)).withPosOf(valueExp)]).withPosOf(valueExp);
|
[uniqueVarSymbol, Symbol(Std.string(idx++)).withPosOf(valueExp)]).withPosOf(valueExp);
|
||||||
|
@@ -332,8 +332,8 @@
|
|||||||
(defun _testMaps []
|
(defun _testMaps []
|
||||||
(deflocal :Map<String,String> myMap [=>"hey" "you"
|
(deflocal :Map<String,String> myMap [=>"hey" "you"
|
||||||
=>"found" "me"])
|
=>"found" "me"])
|
||||||
(Assert.equals "you" (dict-get myMap "hey"))
|
(Assert.equals "you" (dictGet myMap "hey"))
|
||||||
(Assert.equals "me" (dict-get myMap "found"))
|
(Assert.equals "me" (dictGet myMap "found"))
|
||||||
(doFor =>key value myMap
|
(doFor =>key value myMap
|
||||||
(Assert.isTrue (<= 0 (.indexOf ["hey" "found"] key)))
|
(Assert.isTrue (<= 0 (.indexOf ["hey" "found"] key)))
|
||||||
(Assert.isTrue (<= 0 (.indexOf ["you" "me"] value))))
|
(Assert.isTrue (<= 0 (.indexOf ["you" "me"] value))))
|
||||||
|
Reference in New Issue
Block a user