|
SketchyLISP Reference |
Copyright (C) 2007 Nils M Holm |
| <<[map] | [Index] | [map-cdr]>> |
Conformance: SketchyLISP Core
Purpose: Map a function over a list.
Arguments:
F - function to apply
A - list
Implementation:
(define (map-car f a)
(letrec
((mapc
(lambda (a r)
(cond ((null? a) (reverse r))
(else (mapc (cdr a)
(cons (f (car a)) r)))))))
(mapc a '())))
Example:
:l lib/minus.scm - (map-car - '(1 2 3)) => (-1 -2 -3)
| <<[map] | [Index] | [map-cdr]>> |