auto doc generation

This commit is contained in:
Felix Brendel
2019-06-11 01:17:36 +02:00
parent d01269aa13
commit 6f5ecc87b0
22 changed files with 2375 additions and 229 deletions
+11 -9
View File
@@ -1,4 +1,4 @@
(define (nil? x) "Checks if the argument is nil." (= x nil))
(define (nil? x) "Checks if the argument is =nil=." (= x nil))
(define (number? x) "Checks if the argument is a number." (= (type x) :number))
@@ -12,11 +12,13 @@
(define (lambda? x) "Checks if the argument is a function." (= (type x) :lambda))
(define (special-lambda? x) "Checks if the argument is a macro." (= (type x) :dynamic-macro))
(define (macro? x) "Checks if the argument is a macro." (= (type x) :macro))
(define (special-lambda? x) "Checks if the argument is a special-lambda." (= (type x) :dynamic-macro))
(define (built-in-function? x) "Checks if the argument is a built-in function." (= (type x) :built-in-function))
(define (callable? x) (or (lambda? x) (special-lambda? x) (built-in-function? x)))
(define (callable? x) (or (lambda? x) (special-lambda? x) (macro? x) (built-in-function? x)))
(define (end seq) "Returns the last pair in the sqeuence." (if (or (nil? seq) (not (pair? (rest seq)))) seq (end (rest seq))))
@@ -37,8 +39,8 @@ with (pair elem nil)." (extend seq (pair elem ())))
(define (decrement val) "Subtracts one from the argument." (- val 1))
(define (range :keys from :defaults-to 0 to) "Returns a sequence of numbers starting with the number defined
by the key 'from' and ends with the number defined in 'to'." (when (< from to) (pair from (range :from (+ 1 from) :to to))))
(define (range :keys from :defaults-to 0 to) "Returns a sequence of numbers starting with the number defined by the
key =from= and ends with the number defined in =to=." (when (< from to) (pair from (range :from (+ 1 from) :to to))))
(define (range-while :keys from :defaults-to 0 to) "Returns a sequence of numbers starting with the number defined
by the key 'from' and ends with the number defined in 'to'." (define result (list (copy from))) (define head result) (mutate from (increment from)) (while (< from to) (begin (mutate head (pair (first head) (pair (copy from) nil))) (define head (rest head)) (mutate from (increment from)))) result)
@@ -47,10 +49,10 @@ by the key 'from' and ends with the number defined in 'to'." (define result (lis
sequence which contains the results of using the first sequences
elemens as argument to that function." (if (nil? seq) seq (pair (fun (first seq)) (map fun (rest seq)))))
(define (reduce fun seq) "Takes a function and a sequence as arguments and applies the
function to the argument sequence. This only works correctly if
the given function accepts a variable amount of parameters. If
your funciton is limited to two arguments, use `reduce-binary'
(define (reduce fun seq) "Takes a function and a sequence as arguments and applies the
function to the argument sequence. This only works correctly if the
given function accepts a variable amount of parameters. If your
funciton is limited to two arguments, use [[=reduce-binary=]]
instead." (apply fun seq))
(define (reduce-binary fun seq) "Takes a function and a sequence as arguments and applies the