tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | README | LICENSE

commit 4f23a8d4c6d830f5e25c6ffd8d45fadf34b1bc5d
parent 2740014e6554f18e46fa10a9c858b7764a782948
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Fri, 31 Dec 2021 19:42:13 -0500

Add convert list function

Mtib/core.tsp | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/tib/core.tsp b/tib/core.tsp @@ -289,6 +289,7 @@ (eval (map @(list 'quote it) ; prevent proc and args from being evaluated twice (cons proc args)))) +; TODO allow for map proc to access index and lst (def (map proc lst) ; TODO many lsts for proc w/ multi arguments "Evaluate each element of list by giving it to the procedure, returning new list" (if lst @@ -296,6 +297,11 @@ (map proc (cdr lst))) Nil)) +(def (convert from to lst) + "Convert every member from of list into to" + (map @(if (= from it) to it) lst)) + +; TODO assoc memp procedure equivalent (def (assoc key table) "Return first list in table where the first element matches the key If not found, return nil"