From b51321b27fdf513a3de09d084bbd4e69a26fb76e Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 30 Apr 2024 00:12:27 +0200 Subject: Add lists --- res/builtins.lisp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'res') diff --git a/res/builtins.lisp b/res/builtins.lisp index 19bab1f..f6e2bba 100644 --- a/res/builtins.lisp +++ b/res/builtins.lisp @@ -62,4 +62,16 @@ (def hash.get core.gethash) (export hash.new hash.merge hash.get) - +(comment "Re-export List operations") +(def list.new core.list.new) +(def list.slice core.list.slice) +(def list.length core.list.length) +(def list.join core.list.join) +(def list.at core.list.at) +(defun list.map (list func) + (if [= 0 (list.length list)] + (list.new) + (list.join + (list.new (func (list.at list 0))) + (list.map (list.slice list 1 (list.length list)) func)))) +(export list.new list.slice list.length list.join list.at list.map) -- cgit