whalesong/whalesong/examples/list-length.rkt

14 lines
245 B
Racket

#lang whalesong
(define (mylen x acc)
(cond
[(empty? x)
acc]
[else
(mylen (rest x) (add1 acc))]))
"computing length"
(define v (build-list 1000000 (lambda (i) i)))
(printf "Built list\n")
(mylen v 0)
"done computing length"