funcs "list-tail", "list-ref"
This commit is contained in:
parent
8482bd2dae
commit
9eca3ac0b9
1 changed files with 7 additions and 0 deletions
|
@ -28,3 +28,10 @@
|
||||||
(define (cddadr x) (cdr (cdr (car (cdr x)))))
|
(define (cddadr x) (cdr (cdr (car (cdr x)))))
|
||||||
(define (cdddar x) (cdr (cdr (cdr (car x)))))
|
(define (cdddar x) (cdr (cdr (cdr (car x)))))
|
||||||
(define (cddddr x) (cdr (cdr (cdr (cdr x)))))
|
(define (cddddr x) (cdr (cdr (cdr (cdr x)))))
|
||||||
|
|
||||||
|
(define (list-tail x k)
|
||||||
|
(if (zero? k)
|
||||||
|
x
|
||||||
|
(list-tail (cdr x) (- k 1))))
|
||||||
|
|
||||||
|
(define (list-ref x k) (car (list-tail x k)))
|
||||||
|
|
Loading…
Reference in a new issue