You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
364 B
15 lines
364 B
#lang racket
|
|
|
|
(define (my-map f a-list)
|
|
(if (null? a-list)
|
|
'()
|
|
(cons (f (car a-list)) (my-map f (cdr a-list)))))
|
|
|
|
(define (co-map f a-list)
|
|
(define (co-helper in-list out-list)
|
|
(if (null? in-list)
|
|
out-list
|
|
(co-helper (cdr in-list) (append out-list (list (f (car in-list)))))))
|
|
(co-helper a-list '()))
|
|
|
|
(provide my-map co-map) |