14 lines
209 B
Racket
14 lines
209 B
Racket
#lang racket
|
|
|
|
|
|
(define (list-length2 rst)
|
|
(match lst
|
|
['() 0]
|
|
[(list fst rst ...) (add1 (list-length2 rst))]))
|
|
|
|
(define (list-length3 lst)
|
|
(match lst
|
|
['() 0]
|
|
[(cons fst rst) (add1 list-length3 rst)]))
|
|
|