Add list-head, list-tail.
* module/mes/scm (list-head, list-tail): New function.
This commit is contained in:
parent
738eabbe0e
commit
dab37a844b
|
@ -32,6 +32,14 @@
|
||||||
|
|
||||||
(define (list . rest) rest)
|
(define (list . rest) rest)
|
||||||
|
|
||||||
|
(define (list-head x n)
|
||||||
|
(if (= 0 n) '()
|
||||||
|
(cons (car x) (list-head (cdr x) (- n 1)))))
|
||||||
|
|
||||||
|
(define (list-tail x n)
|
||||||
|
(if (= 0 n) x
|
||||||
|
(list-tail (cdr x) (- n 1))))
|
||||||
|
|
||||||
(define-macro (case val . args)
|
(define-macro (case val . args)
|
||||||
(if (null? args) #f
|
(if (null? args) #f
|
||||||
(let ((clause (car args)))
|
(let ((clause (car args)))
|
||||||
|
|
Loading…
Reference in a new issue