Post Scarcity 0.0.6
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
documentation.lisp
Go to the documentation of this file.
1;; This function depends on:
2;; `member` (from file `member.lisp`)
3;; `nth` (from `nth.lisp`)
4;; `string?` (from `types.lisp`)
5
6(set! nil? (lambda
7 (o)
8 "`(nil? object)`: Return `t` if object is `nil`, else `t`."
9 (= o nil)))
10
11(set! member? (lambda
12 (item collection)
13 "`(member? item collection)`: Return `t` if this `item` is a member of this `collection`, else `nil`."
14 (cond
15 ((= 0 (count collection)) nil)
16 ((= item (car collection)) t)
17 (t (member? item (cdr collection))))))
18
19;; (member? (type member?) '("LMDA" "NLMD"))
20
21(set! nth (lambda (n l)
22 "Return the `n`th member of this list `l`, or `nil` if none."
23 (cond ((= nil l) nil)
24 ((= n 1) (car l))
25 (t (nth (- n 1) (cdr l))))))
26
27(set! string? (lambda (o) "True if `o` is a string." (= (type o) "STRG") ) )
28
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))))
35 (cond ((string? d) d)
36 (t (source object)))))
37 (t object))))
38
39(set! doc documentation)
40
41(documentation apply)
42
43;; (documentation member?)
44