Files
ulisp/lisp/tools.lsp
Kyle Isom 8f2a2be9ab symbol-def (#1)
Started branch to add `pform`, ended up pulling in `symbol-def` from the forums. Also adds the editor code from the T-Deck.

Reviewed-on: kyle/ulisp-picocalc#1
Co-authored-by: Kyle Isom <kyle@imap.cc>
Co-committed-by: Kyle Isom <kyle@imap.cc>
2025-04-07 21:41:44 +00:00

31 lines
753 B
Common Lisp

(defun pprintf (sym str)
"(pprintf sym str)
Pretty-print the function pointed to by sym to
the stream, which follows the 'format directives."
(let ((form (eval sym)))
(format str "(defun ~a ~a~%~{ ~a~^~%~})"
(string sym)
(cadr form)
(cddr form))))
(defun copy-file (source dest)
(with-sd-card (writer dest 2)
(with-sd-card (reader source)
(loop
(let ((data (read-byte reader)))
(when (null data)
(return))
(write-byte data writer))))))
(defun i2c-scan (port)
(dotimes (addr 127)
(with-i2c (str port addr)
(when str (print addr)))))
(defun i2c-scan2 (port)
(dotimes (addr 127)
(with-i2c (str port addr)
(format t "~2,0'x: " addr)
(if str (print t)
(print nil)))))