Getting the manual going
This commit is contained in:
@@ -29,16 +29,16 @@ the (rest) of the last element of the sequence." (if (pair? seq) (begin (define
|
||||
(define (append seq elem) "Appends an element to a sequence, by extendeing the list
|
||||
with (pair elem nil)." (extend seq (pair elem nil)))
|
||||
|
||||
(define (length seq) "Returns the length of the given sequence." (if (nil? seq) 0.000000 (+ 1.000000 (length (rest seq)))))
|
||||
(define (length seq) "Returns the length of the given sequence." (if (nil? seq) 0 (+ 1 (length (rest seq)))))
|
||||
|
||||
(define (increment val) "Adds one to the argument." (+ val 1.000000))
|
||||
(define (increment val) "Adds one to the argument." (+ val 1))
|
||||
|
||||
(define (decrement val) "Subtracts one from the argument." (- val 1.000000))
|
||||
(define (decrement val) "Subtracts one from the argument." (- val 1))
|
||||
|
||||
(define (range :keys from :defaults-to 0.000000 to) "Returns a sequence of numbers starting with the number defined
|
||||
by the key 'from' and ends with the number defined in 'to'." (if (< from to) ([C-function] (pair from (range :from (+ 1.000000 from) :to to))) nil))
|
||||
(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'." (if (< from to) ([C-function] (pair from (range :from (+ 1 from) :to to))) nil))
|
||||
|
||||
(define (range-while :keys from :defaults-to 0.000000 to) "Returns a sequence of numbers starting with the number defined
|
||||
(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)
|
||||
|
||||
(define (map fun seq) "Takes a function and a sequence as arguments and returns a new
|
||||
@@ -63,6 +63,8 @@ added to a list, which in the end is returned." (if seq ([C-function] (if (fun (
|
||||
|
||||
(define (zip l1 l2) (if (and (nil? l1) (nil? l2)) nil (pair (list (first l1) (first l2)) (zip (rest l1) (rest l2)))))
|
||||
|
||||
(define (enumerate seq) (define (enumerate-inner seq next-num) (if seq ([C-function] (pair (list (first seq) next-num) (enumerate-inner (rest seq) (+ 1 next-num)))) nil)) (enumerate-inner seq 0))
|
||||
|
||||
(define (printf :keys sep :defaults-to " " end :defaults-to "
|
||||
" :rest args) "A wrapper for the built-in (print) that accepts a variable number
|
||||
of arguments and also provides keywords for specifying the printed
|
||||
|
||||
Reference in New Issue
Block a user