Author Topic: mapcar  (Read 2210 times)

0 Members and 1 Guest are viewing this topic.

rude dog

  • Guest
mapcar
« on: March 18, 2004, 11:52:59 AM »
Code: [Select]

(defun c:gl ()
(setq pt (getpoint "\nPick a point "))
(setq npt (mapcar '0.5* (list pt)))
)
(princ)

stumped...trying to multiply 0.5 by the X value of (list pt) (which then would be the X value in a new list) then the Y value  of (list pt) (which then would be the Y value in a new list) and then the Z value of  (list pt) (which then would be the Z value in a new list) I have never used mapcar before and didnt know if this (when written properly) would work.

Xlisper

  • Guest
mapcar
« Reply #1 on: March 18, 2004, 12:15:27 PM »
Try this:

   
Code: [Select]

       
        (mapcar '(lambda (x) (* x 0.5)) ptlist)

   


    where ptlist is the point list

rude dog

  • Guest
mapcar
« Reply #2 on: March 18, 2004, 12:41:53 PM »
wonderful..saves me alot of steps..thanks

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
mapcar
« Reply #3 on: March 19, 2004, 06:16:56 AM »
Also have a look at this thread;
http://theswamp.org/phpBB2/viewtopic.php?t=340
TheSwamp.org  (serving the CAD community since 2003)

rude dog

  • Guest
mapcar
« Reply #4 on: March 19, 2004, 11:23:55 AM »
thanks MT....