#lang racket (define (list-length list) (match list [`() 0] [(cons head tail) (cons (f head) (list-length f tail))])) (module+ test (require rackunit) (check-equal? (list-length '(1 2 3)) 3) (check-equal? (list-length '()) 0)) (define (my-map2 f lst) (match lst ['() '()] [(list head tail ...) (cons (f head) (my-map2 f tail))]))