سبع الليل Posted March 7, 2013 Share Posted March 7, 2013 بسم الليه الرحمن الرحيم الحمد لله رب العالمين ، و الصلاة و السلام على أشرف المرسلين ، أشهد أن لا إله إلا الله ، و أن محمداً رسول الله ، و أن عيسى المسيح عبد الله و رسوله و كلمته ألقاها إلى مريم ،، و بعد : Hii Guys and cad msters : I hope your help to do something that i tried many times and searched alot but failed i think it is easy , but i dont know how my question is : i have that list (setq A (list 2 9 7 12 3 4 8 )) i need a list "b" is the arrangement of list "A" asscending (from smallest to largest " How ??? and also :: I have that recatangle point list (list (5 1 ) ( 0 1) ( 0 3 ) (5 3)) I need to arrange it from the smallest x-coordinate to the largest one ,,, I.E (list ( 0 1) (5 1 ) (5 3) ( 0 3 ) ) How ??? Thank you ,,, and i love you Quote Link to comment Share on other sites More sharing options...
MSasu Posted March 7, 2013 Share Posted March 7, 2013 For sorting please check the VL-SORT function: (vl-load-com) (setq A (list 2 9 7 12 3 4 8 )) (setq B (vl-sort A '<)) Regarding the second sorting, seems that you are looking to parse the corners in clock-wise sense, not to sort them ascending by X coordinate. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 7, 2013 Share Posted March 7, 2013 Here is the answer for the first part of your question . (setq a (list 2 9 7 12 3 4 ) (vl-sort a '(lambda (j k) (< j k))) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 7, 2013 Share Posted March 7, 2013 And here is the second answer for your question . (setq lst '((5 1) (0 1) (0 3) (5 3))) (vl-sort lst '(lambda (j k) (< (car j) (car k)))) Quote Link to comment Share on other sites More sharing options...
سبع الليل Posted March 7, 2013 Author Share Posted March 7, 2013 Thank you alot Mr Msasu ,, I love you جزاك الله خيراً مهندس ثروت مش حضرتك مهندس ثروت 313 في ملتقى المهندسيتن العرب ؟؟ منتدى الأوتوكاد منور بحضرتك و الله Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 7, 2013 Share Posted March 7, 2013 Correct Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 7, 2013 Share Posted March 7, 2013 (vl-sort a '(lambda (j k) (< j k))) This is the same as: (vl-sort a '<) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 7, 2013 Share Posted March 7, 2013 This is the same as: (vl-sort a '<) Correct , That operator ( less than ) did not come up to my mind before lambda function . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.