@StanThe wrote:
If someone could explain the "lambda" parts to me or direct me where to look (Lambda for Dummies??? lol) i can figure this out. Please!
[This shouldn't have been in reply to me, but in any case....]
Admittedly Help about the (lambda) function is perhaps too terse, but as it says there, it's a way to define a function right where it is to be used, without having to give it a name as you would with (defun). It takes some getting used to, but I'll try to explain one of its uses in that code, namely:
(setq
points (mapcar '(lambda (n) (list (car n) (cadr n) 0.0)) points)
)
This takes a list of points [here in the 'points' variable] and converts it to a list in which all the points have the same X and Y coordinates they started with, but all have Z=0.0. Broken out:
(mapcar ;; apply following function across all items in list argument after function definition
'(lambda ;; open function definition
(n) ;; argument: stand-in within function for item from source list
(list ;; make a [in this case, point-coordinates] list of:
(car n) ;; X coordinate pulled from source item's point list
(cadr n) ;; Y coordinate pulled from source item's point list
0.0 ;; Z coordinate the same for all, regardless of source's Z coordinate
); list
); lambda ;; end function definition
points ;; list to apply function across
); mapcar
This (mapcar) function employing that (lambda) function returns the converted list of points, with all points forced into the drawing plane at Z=0 [in this case replacing the original list, since the surrounding (setq) function uses the same variable name for the replacement as for the original].
Kent Cooper, AIA