faster isNull, isNotNull

This commit is contained in:
2024-11-26 18:11:47 -06:00
parent 72b76831e8
commit 1563da604c
2 changed files with 8 additions and 6 deletions

View File

@@ -186,7 +186,8 @@ class Kiss {
"readDirectory" => Symbol("Prelude.readDirectory"),
"substr" => Symbol("Prelude.substr"),
"isListExp" => Symbol("Prelude.isListExp"),
"isNull" => Symbol("Prelude.isNull")
"isNull" => Symbol("Prelude.isNull"),
"isNotNull" => Symbol("Prelude.isNotNull")
/* zip functions used to live here as aliases but now they are macros that also
apply (the Array<Array<Dynamic>>) to the result */
/* intersect used to live here as an alias but now it is in a macro that also

View File

@@ -431,11 +431,12 @@ class Prelude {
public static var joinPath:Function = Reflect.makeVarArgs(_joinPath);
public static function isNull<T>(v:T) {
return switch (Type.typeof(v)) {
case TNull: true;
default: false;
}
public static function isNull<T>(v:Null<T>) {
return v == null;
}
public static function isNotNull<T>(v:Null<T>) {
return v != null;
}
public static dynamic function truthy<T>(v:T) {