1;; This function depends on:
2;; `member` (from file `member.lisp`)
3;; `nth` (from `nth.lisp`)
4;; `string?` (from `types.lisp`)
8 "`(nil? object)`: Return `t` if object is `nil`, else `t`."
13 "`(member? item collection)`: Return `t` if this `item` is a member of this `collection`, else `nil`."
15 ((= 0 (count collection)) nil)
16 ((= item (car collection)) t)
17 (t (member? item (cdr collection))))))
19;; (member? (type member?) '("LMDA" "NLMD"))
21(set! nth (lambda (n l)
22 "Return the `n`th member of this list `l`, or `nil` if none."
25 (t (nth (- n 1) (cdr l))))))
27(set! string? (lambda (o) "True if `o` is a string." (= (type o) "STRG") ) )
29(set! documentation (lambda (object)
30 "`(documentation object)`: Return documentation for the specified `object`, if available, else `nil`."
31 (cond ((member? (type object) '("FUNC" "SPFM"))
32 (:documentation (meta object)))
33 ((member? (type object) '("LMDA" "NLMD"))
34 (let ((d . (nth 3 (source object))))
36 (t (source object)))))
39(set! doc documentation)
43;; (documentation member?)