Fixed runaway recursion in cond. However, let is still segfaulting, and member

does not work correctly.
This commit is contained in:
Simon Brooke 2026-02-25 11:17:40 +00:00
parent d34d891211
commit 8c63272214
12 changed files with 358 additions and 156 deletions

View file

@ -1,9 +1,20 @@
(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))))))
;; 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)
(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))))))