lisp2arx
Visual Programming for AutoLisp
Mathématiques en programmation Lisp..
doc2cpp,doc2lsp, sld2lsp, bmp2dcl,
free__GifCcapture for all-CAD'platforms..
|
Lista Forumurilor Pe Tematici
|
lisp2arx | Reguli | Inregistrare | Login
POZE LISP2ARX
Nu sunteti logat.
|
Nou pe simpatie: GeorgianaIoana pe Simpatie
| Femeie 25 ani Bucuresti cauta Barbat 25 - 63 ani |
|
admin
Administrator
Din: Bucharest
Inregistrat: acum 14 ani
Postari: 517
|
|
Here sort
Code:
(Defun dfn_pointsortLefttoRight(/ i)
(setq i 0)
(while (< (setq i (1+ i)) (sslength ss))
(setq pts (cons (cdr (assoc 10 (entget (ssname ss i)))) pts))
)
(setq pts (vl-sort pts '(lambda (x y) (< (car x)(car y))))) |
I have a problem with sorting a list of strings based on the second item of the list ascendingly.
Code:
(setq the_list '(("Top Beam" "200x150") ("Left Beam" "200x100") ("Left Beam" "150x200") ("Bottom Beam" "225x75")
("Bottom Beam" "100x200") ("Right Beam" "45x35") ("Bottom Beam" "100x175") ("Right Beam" "55x25"))) |
Code:
(defun mysort ( l )
(mapcar '(lambda ( n ) (nth n l))
(vl-sort-i (mapcar '(lambda ( x ) (read (strcat "(" (vl-string-subst " " "x" (cadr x)) ")"))) l)
'(lambda ( a b )
(if (= (car a) (car b))
(< (cadr a) (cadr b))
(< (car a) (car b))
)
)
)
)
)
(setq Author "LeeMac(c)2020-05")
$ (mysort the_list)
(
("Right Beam" "45x35")
("Right Beam" "55x25")
("Bottom Beam" "100x175")
("Bottom Beam" "100x200")
("Left Beam" "150x200")
("Left Beam" "200x100")
("Top Beam" "200x150")
("Bottom Beam" "225x75")
) |
75.9KB
_______________________________________
|
|
pus acum 3 ani |
|