TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: hunterxyz on May 18, 2007, 09:11:49 AM
-
EXP:
(SETQ GTQQ(LIST 1 1 1))
(SETQ LTQQ '((51 17 32)
(28 42 68)
(53 25 19)
(12 25 89)) )
Extracts: _$ (53 42 89)
Use the following procedure to extract
CODE:
(MAPCAR '(LAMBDA (X) (SETQ GTQQ(LIST
(MAX (CAR GTQQ)(CAR X))
(MAX(CADR GTQQ)(CADR X))
(MAX(CADDR GTQQ)(CADDR X))
))) LTQQ)
But if for under such in series, the non- fixed in series value, how should process?
(SETQ LSPNB '((11 4 8 17 2 20 22 7 5 12)
(5 10 2 17 1 20 22 7 5 12)
(9 6 6 17 1 20 22 7 5 12)
(9 6 6 17 1 20 22 7 5 12)
(3 12 17 1 4 11 3 22 7 5 12)
(9 6 6 17 1 6 13 22 7 5 12)
(7 8 4 17 1 20 22 7 5 12)
(9 6 6 17 1 4 11 3 22 7 5 12)
(7 8 4 17 1 4 11 3 22 7 5 12)
(9 6 6 17 1 4 11 3 22 7 5 12)
(1 13 1 15 1 16 3 22 7 5 12)
(7 8 4 17 1 4 11 3 22 7 5 12)
(13 2 14 1 4 11 3 22 7 5 12)
(3 12 1 16 4 4 11 3 20 2 6 6 11)
(7 8 5 16 4 4 11 3 20 2 6 6 11)
(5 10 3 16 4 20 20 2 6 6 11)
(15 13 16 4 20 20 2 6 6 11)
(1 14 4 13 16 4 20 16 3 2 6 6 11)
(10 16 2 20 20 2 6 6 11)
(10 16 2 20 20 2 6 6 11)
(11 14 17 1 1 20 20 2 6 6 11)
(3 12 1 16 2 4 15 20 2 6 6 11)
(13 2 10 16 4 20 20 2 6 6 11)
(24 18 1 10 18 2 20 22 7 5 12)) )
Requests master help to answer, thanks ~
-
(apply 'mapcar (cons 'max LTQQ))
(apply 'mapcar (cons 'max LSPNB))
-
Or maybe
(defun CreateMaxList(pList)
(mapcar '(lambda(x) (apply 'max x)) pList)
)
(defun c:TestCreateMaxList()
(SETQ LSPNB '((11 4 8 17 2 20 22 7 5 12)
(115 10 2 17 1 20 22 7 5 12)
(119 6 6 17 1 20 22 7 5 12)
(229 6 6 17 1 20 22 7 5 12)
(3 12 17 1 4 611 3 22 7 5 12)
(9 6 6 17 1 66 13 22 7 5 12)
(7 8 4 17 1 720 22 7 5 12)
(9 6 6 17 1 4 11 3 22 7 5 712)
(7 8 4 17 1 4 11 3 22 7 5 12)
(9 6 6 17 1 4 11 3 22 7 5 12)
(771 13 1 15 1 16 3 22 7 5 12)
(7 8 4 17 1 4 11 3 22 7 5 12)
(13 2 14 1 4 11 3 22 7 5 12)
(3 12 1 16 4 4 11 3 20 2 6 6 11)
(7 8 5 1776 4 4 11 3 20 2 6 6 11)
(5 10 3 16 4 20 20 2 6 6 11)
(15 13 16 4 20 20 2 6 6 11)
(1 14 4 13 16 4 20 16 3 2 6 6 11)
(10 16 2 20 20 2 6 6 11)
(10 16 2 20 20 2 6 6 11)
(11 14 17 1 1 20 20 2 6 6 11)
(3 12 1 16 2 4 15 20 2 6 6 11)
(13 2 10 16 4 20 20 2 6 6 11)
(24 18 1 10 18 2 20 22 7 5 12))
);setq
(createMaxList LSPNB)
)
I'm not exactly sure how you want the output formatted
-
THANK ~ ElpanovEvgeniy
(SETQ A (apply 'mapcar (cons 'max LSPNB)))
_$ (771 18 17 1776 20 720 22 22 22)
(LENGTH A)
_$ 9
BUT,
LSPNB LIST, EXP: (7 8 5 1776 4 4 11 3 20 2 6 6 11)
Has in series is bigger than 9, not to process ?
-
Interesting :?
-
Interesting :?
Why am I having a flashback to Rowan and Martins 'Laugh In'
"Look that up in your Funk and Wagnalls."