add symbolName() for macros

This commit is contained in:
2021-05-21 17:25:54 -06:00
parent f9dcfab167
commit ab032545f2
2 changed files with 9 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ class Kiss {
"zip" => Symbol("Prelude.zip"), "zip" => Symbol("Prelude.zip"),
"pairs" => Symbol("Prelude.pairs"), // TODO test pairs "pairs" => Symbol("Prelude.pairs"), // TODO test pairs
"memoize" => Symbol("Prelude.memoize"), // TODO test memoize "memoize" => Symbol("Prelude.memoize"), // TODO test memoize
"symbolName" => Symbol("Prelude.symbolName"),
"map" => Symbol("Lambda.map"), "map" => Symbol("Lambda.map"),
"filter" => Symbol("Lambda.filter"), // TODO use truthy as the default filter function "filter" => Symbol("Lambda.filter"), // TODO use truthy as the default filter function
"has" => Symbol("Lambda.has"), "has" => Symbol("Lambda.has"),

View File

@@ -277,6 +277,14 @@ class Prelude {
return v; return v;
} }
// ReaderExp helpers for macros:
public static function symbolName(s:ReaderExp):ReaderExpDef {
return switch (s.def) {
case Symbol(name): StrExp(name);
default: throw 'expected $s to be a plain symbol';
};
}
#if sys #if sys
private static var kissProcess:Process = null; private static var kissProcess:Process = null;
#end #end