glip/startup.lisp

16 lines
471 B
Common Lisp
Raw Permalink Normal View History

2024-05-06 07:02:04 -05:00
(let defun (mac (name args body)
(list let name nil)
(list = name (list fun args body))))
2021-08-13 11:18:25 -05:00
2024-05-06 07:02:04 -05:00
(defun square (x) (* x x))
2021-08-13 11:18:25 -05:00
2024-05-06 07:02:04 -05:00
(let inc (mac (s) (list (q =) s (list (q +) s 1))))
2021-08-13 11:18:25 -05:00
2024-05-06 07:02:04 -05:00
(defun to-upper (str) (capture-upper (print str)))
(defun to-lower (str) (capture-lower (print str)))
2021-08-13 11:18:25 -05:00
2024-05-06 07:02:04 -05:00
(defun last (x) (if (cdr x) (last (cdr x)) (car x)))
(defun del-last (x) (if (cdr (cdr x)) (del-last (cdr x)) (setcdr x nil)))
2021-08-13 11:18:25 -05:00
2024-05-06 07:02:04 -05:00
(defun nth (a n) (if (is n 0) (car a) (nth (cdr a) (- n 1))))