add aliases for call, pipe and func"

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-19 02:09:35 +03:00
parent 98eaf7a9c2
commit 6f94ad4a53
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -66,6 +66,7 @@ let
++ [ (raw "") ]
);
pipe = join ".";
pipe1 = lft: rgt: pipe [ lft rgt ];
spaceBetween = join " ";
wrap = start: end: expr:
@ -74,7 +75,9 @@ let
call = fnName: args:
concat [ (validFuncName fnName) (wrapParen (join ", " args)) ];
require = name: call "require" [ name ];
call0 = call [ ];
call1 = arg: call [ arg ];
require = name: call1 "require" name;
kw_and = raw "and";
kw_or = raw "or";
@ -127,6 +130,7 @@ let
++ body
++ [ kw_end ])
);
lambda = func "";
return = expr: spaceBetween ([ kw_return expr ]);
return_void = return null;
@ -204,6 +208,8 @@ in
# useful aliases
var = raw;
vars = map raw;
inherit call0 call1;
inherit lambda;
inherit validString;
}