On Sep 19, 2008, at 6:41 PM, Puck Ja wrote: > I plan to make several flux objects to monitor the flux along a > lossy waveguide in the longitudinal direction. Trying not to hard > code each objects by doing > (define p1 (add-flux .... (center 1 0 )... > (define p2 (add-flux .... (center 2 0 )... > ...etc, > > I would appreciate any help on better way to do it. I have tried to > make list of flux objects such as > (define pn > (map (lambda (pos) > (append (add-flux ....) (add-flux ...) ...) (list 1 2 3 4)))
add-flux does not return a list, so you can't call "append" on it. You don't need to call "append" inside "map", because "map" already returns a list. You can do something like: (define pm (map (lambda (pos) (add-flux ... (center pos) ...)) (list 1 2 3 4)) There are many references on the Scheme language online that you can read to help you understand constructs like "map". Steven _______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss