Right, there's an awful lot of Lisp actually working...

This commit is contained in:
Simon Brooke 2023-03-30 14:29:20 +01:00
parent c3b327f760
commit 1f16241af7
31 changed files with 250 additions and 97 deletions

1
resources/sexpr/conc.lsp Normal file
View file

@ -0,0 +1 @@
;; TODO

View file

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

11
resources/sexpr/pair.lsp Normal file
View file

@ -0,0 +1,11 @@
;; PAIR is defined on page 60 of the manual, but the definition depends on both
;; PROG and GO, and I haven't got those working yet; so this is a pure
;; functional implementation.
;; Return a list of pairs from lists `x` and `y`, required both to have the same
;; length.
(DEFUN PAIR (X Y)
(COND ((AND (NULL X) (NULL Y)) NIL)
((NULL X) (ERROR 'F2))
((NULL Y) (ERROR 'F3))
(T (CONS (CONS (CAR X) (CAR Y)) (PAIR (CDR X) (CDR Y))))))

View file

@ -0,0 +1,6 @@
;; REPEAT is not present in the Lisp 1.5 manual, but it's so simple and so
;; useful that it seems a legitimate extension.
(DEFUN REPEAT (N X)
(COND ((EQ N 0) NIL)
(T (CONS X (REPEAT (SUB1 N) X)))))