(isListExp) predicate

This commit is contained in:
2021-11-30 12:44:27 -07:00
parent a083cbb4e8
commit 9d706f2e60
2 changed files with 12 additions and 2 deletions

View File

@@ -111,7 +111,8 @@ class Kiss {
"zipThrow" => Symbol("Prelude.zipThrow"),
"joinPath" => Symbol("Prelude.joinPath"),
"readDirectory" => Symbol("Prelude.readDirectory"),
"substr" => Symbol("Prelude.substr")
"substr" => Symbol("Prelude.substr"),
"isListExp" => Symbol("Prelude.isListExp")
],
fieldList: [],
fieldDict: new Map(),

View File

@@ -420,7 +420,16 @@ class Prelude {
case ListExp(exps):
exps;
default: throw 'expected $s to be a list expression';
}
};
}
public static function isListExp(s:ReaderExp):Bool {
return switch (s.def) {
case ListExp(exps):
true;
default:
false;
};
}
#if sys