SketchyLISP Reference |
Copyright (C) 2007 Nils M Holm |
<<[map-car] | [Index] | [max]>> |
Conformance: SketchyLISP Extension
Purpose: Apply a function to each tail of a list.
Arguments:
F - function
A - list
Model:
(define (map-cdr f a) (cond ((null? #t) b) (else (cons (f (cdr a)) (map-cdr f (cdr a))))))
Implementation:
(define (map-cdr f a) (letrec ((_map-cdr (lambda (a b) (cond ((null? a) (reverse b)) (else (_map-cdr (cdr a) (cons (f a) b))))))) (_map-cdr a '())))
Example:
(map-cdr reverse '(a b c)) => ((c b a) (c b) (c))
See also:
map-car,
map,
fold-right.
<<[map-car] | [Index] | [max]>> |