This commit is contained in:
Fulton Browne 2021-08-24 12:16:11 -07:00
parent 7be09240db
commit 09eaead678
6 changed files with 37 additions and 14 deletions

View File

@ -1416,13 +1416,14 @@
-- (ASSOC EXPR ALIST) => PAIR ----------------------------------
-- (ASSQ EXPR ALIST) => PAIR ----------------------------------
-- (ASSV EXPR ALIST) => PAIR ----------------------------------
-- (ASSS EXPR ALIST) => PAIR ----------------------------------
Search the given ALIST sequentially, from left to right, for a
member with EXPR in its car field. When such a member exists,
return it, otherwise return NIL.
ASSOC uses EQUAL to identify members, ASSV uses EQV, and ASSQ
uses EQ.
ASSOC uses EQUAL to identify members, ASSV uses EQV, ASSQ
uses EQ, and ASSS uses s=.
Examples:

2
ls9.c
View File

@ -5519,7 +5519,7 @@ cell *GC_roots[] = {
*/
void usage(void) {
prints("Usage: ls9 [-L] [-i file | -] [-l file]\n");
prints("Usage: ls9 [-i file | -] [-l file]\n");
prints(" [-- argument ... | file argument ...]\n");
}

17
ls9.ls9
View File

@ -340,6 +340,11 @@ nil t
((eqv x (caar a)) (car a))
(else (assv x (cdr a)))))
(defun (asss x a)
(cond ((null a) nil)
((s= x (caar a)) (car a))
(else (s= x (cdr a)))))
(defun (assoc x a)
(cond ((null a) nil)
((equal x (caar a)) (car a))
@ -413,13 +418,23 @@ nil t
(defun (print . xs)
(cond ((null xs) (princ "\n"))
((null (cdr xs))
(prin (car xs))
(princ (car xs))
(princ "\n"))
(else
(prin (car xs))
(writec #\sp)
(apply print (cdr xs)))))
(defun (printc . xs)
(cond ((null xs) (princ "\n"))
((null (cdr xs))
(princ (car xs))
(princ "\n"))
(else
(princ (car xs))
(writec #\sp)
(apply printc (cdr xs)))))
(defun (readln . p)
(let loop ((c (apply readc p))
(a nil))

View File

@ -1,7 +1,6 @@
;; the "boot" sequence for local logins
(defun (local-boot)
(print 'starting 'LISP 'userspace)
;; TODO: put a proper init system here
;;connect to a remote machine and pull needed init files -- or pull stuff from NVRAM
(print "")
;; things that need to be run the first time a system is *activated* (if you will)
(profile 'local)
(start-repl))

View File

@ -1,2 +1,4 @@
(defun (man term))
(defun (look-man term))
(def man-pages '(("man" "Man test")))
(defun (man term)
(print (cdr (asss term man-pages))))
(defun (look-man term)) ;; TODO

View File

@ -1,8 +1,14 @@
(def user 'fulton) ;; Username as a default for remote log in's
(def user "fulton") ;; Username as a default for remote log in's
(def dump-file "fultons-session.ls9") ;; running (save) saves's the session to this file
;; Put user functions and macros here
;; edit the profile function to edit what runs on a new session
;; edit the prompt function to change the way the prompt of FREPL operates
(defun (profile mode)
(print 'Login 'user: user)
(print 'Login 'mode: mode)
(print 'for 'help 'use 'the '(man) 'function))
(printc "Login user: " user)
(printc "Login mode: " mode)
(printc "for help use the (man) function"))
;; edit the (prompt) function to control the FREPL prompt
;; BUG you must run (flush (outport)) at the end of the function
(defun (prompt)
(princ "; ") ;; A basic change
;; IDEAS: Show the time, heap space, and add auto image dumping
(flush (outport)))