Fixed runaway recursion in cond. However, let is still segfaulting, and member
does not work correctly.
This commit is contained in:
parent
d34d891211
commit
8c63272214
12 changed files with 358 additions and 156 deletions
|
|
@ -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))))))
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
(set! nil? (lambda (o) (= o nil)))
|
||||
(set! nil? (lambda
|
||||
(o)
|
||||
"`(nil? object)`: Return `t` if object is `nil`, else `t`."
|
||||
(= o nil)))
|
||||
|
||||
(set! member (lambda
|
||||
(item collection)
|
||||
"Return `t` if this `item` is a member of this `collection`, else `nil`."
|
||||
"`(member item collection)`: Return `t` if this `item` is a member of this `collection`, else `nil`."
|
||||
(cond
|
||||
((nil? collection) nil)
|
||||
((= item (car collection)) t)
|
||||
(t (member item (cdr collection))))))
|
||||
(t (member item (cdr collection))))))
|
||||
|
||||
(member (type member) '("LMDA" "NLMD"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue