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