tg1e+@ANDREW.CMU.EDU ("Timothy R. Gottschalk") (12/20/89)
I have Texas Instrument's PC Scheme V3.03 and I am disappointed that for-each, apply, and map constructs can only take one list (as an argument) from which elements are drawn from. That is, they don't accept multiple list arguments as standard Scheme should. Can anyone send me a macro version of for-each, apply, and map that would take multiple args? Yes, I have given it a shot myself but with finals I'm really pressed for time. T. Gottschalk CMU
saunders@UDEL.EDU (Dave Saunders) (12/21/89)
You don't need macros. The way to handle variable numbers of parameters is with (lambda L ...) in place of (lambda (x y) ...). For example, for may you could do (untested): (define map (lambda L (map-iter (car L) (cdr L)))) (define map1 map); rename the one list mapper (define (map-iter f lists) (if (null? (car lists)) () (cons (apply f (map1 car lists)) (map-iter f (map1 cdr lists))) )) I don't understand why you include apply in this context. (apply foo arg-list) is the pattern, even in TI Scheme, I'm pretty sure. D. Saunders UDel ----------------- I have Texas Instrument's PC Scheme V3.03 and I am disappointed that for-eac h, apply, and map constructs can only take one list (as an argument) from which elements are drawn from. That is, they don't accept multiple list arguments as standard Scheme should. Can anyone send me a macro version of for-each, apply, and map that would take multiple args? Yes, I have given it a shot myself but with finals I'm really pressed for time. T. Gottschalk CMU