Minor progress on Lisp functions

This commit is contained in:
Simon Brooke 2023-03-29 16:56:13 +01:00
parent 37ba03f05e
commit c3b327f760
8 changed files with 116 additions and 3 deletions

View file

@ -1 +0,0 @@
(DEFUN COUNT (L) (COND ((EQ '() L) 0) (T (PLUS 1 (COUNT (CDR L))))))

View file

@ -1,3 +1,5 @@
gcd[x;y] = [x>y -> gcd[y;x];
rem[y;x] = 0 -> x;
T -> gcd[rem[y;x];x]]
T -> gcd[rem[y;x];x]]
;; gcd[x;y] = [x>y -> gcd[y;x]; rem[y;x] = 0 -> x; T -> gcd[rem[y;x];x]]

1
resources/length.lsp Normal file
View file

@ -0,0 +1 @@
(DEFUN LENGTH (L) (COND ((EQ NIL L) 0) (T (ADD1 (LENGTH (CDR L))))))

View file

@ -7,6 +7,7 @@
;; Binding all system functions to NIL so that you can see on the OBLIST that
;; they exist.
(ADD1 . NIL)
(AND . NIL)
(APPEND . NIL)
(APPLY . NIL)
(ATOM . NIL)