diff --git a/lib/simple-utils.lisp b/lib/simple-utils.lisp index ee64f56..370fd3d 100755 --- a/lib/simple-utils.lisp +++ b/lib/simple-utils.lisp @@ -6,20 +6,15 @@ (defun single (lst) (and (consp lst) (not (cdr lst)))) -(defun mapa-b (fn a b &optional (step 1)) - "Maps function over integers from a to b" - (do ((i a (+ i step)) - (result nil)) - ((> i b) (nreverse result)) - (push (funcall fn i) result))) - (defun map0-n (fn n) "maps from 0 to n" - (mapa-b fn 0 n)) + (loop for x from 0 to n + collect (funcall fn x))) (defun map1-n (fn n) "maps from 1 to n" - (mapa-b fn 1 n)) + (loop for x from 1 to n + collect (funcall fn x))) (defmacro mac (expr) `(pprint (macroexpand-1 ',expr)))