Very, very nearly ready for 0.0.6. Too tired to press the burron tonight.

This commit is contained in:
Simon Brooke 2026-02-27 02:43:21 +00:00
parent b720211b7b
commit 1900bca706
29 changed files with 567 additions and 800 deletions

View file

@ -1,20 +1,17 @@
;; This version segfaults, I think due to a bug in `let`?
;; (set! documentation (lambda (object)
;; (cond ((= (type object) "LMDA")
;; (let ((d . (nth 3 (source object))))
;; (cond ((string? d) d)
;; (t (source object)))))
;; ((member (type object) '("FUNC" "SPFM"))
;; (:documentation (meta object))))))
;;
;; (set! doc documentation)
;; This function depends on:
;; `member` (from file `member.lisp`)
;; `nth` (from `nth.lisp`)
;; `string?` (from `types.lisp`)
(set! documentation (lambda (object)
"`(documentation object)`: Return documentation for the specified `object`, if available, else `nil`."
(cond ((member? (type object) '("FUNC" "SPFM"))
(:documentation (meta object)))
((member? (type object) '("LMDA" "NLMD"))
(let ((d . (nth 3 (source object))))
(cond ((string? d) d)
(t (source object)))))
(t object))))
(set! doc documentation)
;; This version returns nil even when documentation exists, but doesn't segfault.
(set! documentation
(lambda (object)
"`(documentation object)`: Return documentation for the specified `object`, if available, else `nil`."
(cond ((and (member (type object) '("LMDA" "NLMD"))
(string? (nth 3 (source object))))
(nth 3 (source object)))
((member (type object) '("FUNC" "SPFM"))
(:documentation (meta object))))))