aboutsummaryrefslogtreecommitdiff
path: root/neb/std/lists.py
diff options
context:
space:
mode:
authormryouse2022-08-02 02:17:48 +0000
committermryouse2022-08-02 02:17:48 +0000
commit7be86d495ca1fbfdd2881c970c2c8036f93469d0 (patch)
tree9ebc6ca28181b8e401384f65fc48444c638d0f47 /neb/std/lists.py
parentee509e05746731b12afe64bfe34284b119f6b4ae (diff)
implement most for string/list, and reverse/last for string
Diffstat (limited to 'neb/std/lists.py')
-rw-r--r--neb/std/lists.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/neb/std/lists.py b/neb/std/lists.py
index 9335c3d..ae5e56c 100644
--- a/neb/std/lists.py
+++ b/neb/std/lists.py
@@ -185,3 +185,11 @@ prepend_func = Builtin("prepend", interpretPrepend, [Arg("list", TypeEnum.LIST),
prepend_multi = MultiFunction("prepend")
prepend_multi.register(prepend_func)
LISTS.register("prepend", prepend_multi)
+
+def interpretListMost(symbol, args, env, ns):
+ return List(args[0].args[:-1])
+
+most_func = Builtin("most", interpretListMost, [Arg("list", TypeEnum.LIST)], return_type=Type(":list"))
+most_multi = MultiFunction("most")
+most_multi.register(most_func)
+LISTS.register("most", most_multi)