The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Factored library, implemented make-continuation.
[scheme.forth.jl.git]
/
src
/
scheme-library-5-lists.scm
1
;; LISTS
2
3
; Return number of items in list
4
(define (length l)
5
(define (iter a count)
6
(if (null? a)
7
count
8
(iter (cdr a) (fix:+ count 1))))
9
(iter l 0))
10
11
; Reverse the contents of a list
12
(define (reverse l)
13
(if (null? l)
14
()
15
(append (reverse (cdr l)) (list (car l)))))
16