scm.mes: add list-ref.
This commit is contained in:
parent
2983578531
commit
82a89c680f
5
scm.mes
5
scm.mes
|
@ -246,6 +246,11 @@
|
|||
(display rest)
|
||||
(newline))
|
||||
|
||||
(define (list-ref lst k)
|
||||
(let loop ((lst lst) (k k))
|
||||
(if (= 0 k) (car lst)
|
||||
(loop (cdr lst) (- k 1)))))
|
||||
|
||||
;; srfi-1
|
||||
(define (last-pair lst)
|
||||
(let loop ((lst lst))
|
||||
|
|
Loading…
Reference in a new issue