auto doc generation
This commit is contained in:
+16
-27
@@ -107,14 +107,14 @@ ithe sequence as arguemens."
|
||||
(special-lambda (:rest args)
|
||||
(let ((op (first args))
|
||||
(args (rest args)))
|
||||
(cond ((= op 'pi) 3.14159265)
|
||||
(else (try (apply op args)
|
||||
(error "The package does not contain this operation"))))))
|
||||
(if (callable? (eval op))
|
||||
(apply op args)
|
||||
(eval op))))
|
||||
:package)))))
|
||||
|
||||
|
||||
(define (nil? x)
|
||||
"Checks if the argument is nil."
|
||||
"Checks if the argument is =nil=."
|
||||
(= x nil))
|
||||
|
||||
(define (number? x)
|
||||
@@ -141,8 +141,12 @@ ithe sequence as arguemens."
|
||||
"Checks if the argument is a function."
|
||||
(= (type x) :lambda))
|
||||
|
||||
(define (special-lambda? x)
|
||||
(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)
|
||||
@@ -152,6 +156,7 @@ ithe sequence as arguemens."
|
||||
(define (callable? x)
|
||||
(or (lambda? x)
|
||||
(special-lambda? x)
|
||||
(macro? x)
|
||||
(built-in-function? x)))
|
||||
|
||||
(define (end seq)
|
||||
@@ -204,25 +209,9 @@ with (pair elem nil)."
|
||||
"Subtracts one from the argument."
|
||||
(- val 1))
|
||||
|
||||
|
||||
;; (defmacro for (@symbol @from @to :rest @for-body)
|
||||
;; "Designed to resemble a C style for loop. It takes a symbol as
|
||||
;; well as its starting number and end number and executes the
|
||||
;; @for-body with the defined symbol for all numbers between @from
|
||||
;; to @to, where @to is exclusive."
|
||||
;; (if (< (eval @from) (eval @to))
|
||||
;; (macro-define @op incr)
|
||||
;; (if (> (eval @from) (eval @to))
|
||||
;; (macro-define @op decr)
|
||||
;; (macro-define @op nil)))
|
||||
;; (when @op
|
||||
;; (macro-define (eval @symbol) (eval @from))
|
||||
;; (eval (pair begin @for-body))
|
||||
;; (eval (extend (list for @symbol (@op @from) @to) @for-body))))
|
||||
|
||||
(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'."
|
||||
"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))))
|
||||
|
||||
@@ -249,10 +238,10 @@ elemens as argument to that function."
|
||||
(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'
|
||||
"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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user