Jonathan Handojo Posted January 20, 2020 Posted January 20, 2020 Hello fellow hackers, A simple question where I'm still struggling to find an answer: "I have an association list (just like you would get using (entget (car (entsel))), except that they're not dotted pairs, they're lists (all of them). How can you retrieve the longest or shortest list from that association list?" Thanks, Jonathan Handojo Quote
Jonathan Handojo Posted January 20, 2020 Author Posted January 20, 2020 Lol, actually... forget it (nth (vl-position (apply 'max (mapcar 'length lst)) (mapcar 'length lst)) lst) Quote
Lee Mac Posted January 20, 2020 Posted January 20, 2020 Alternatively - (nth (car (vl-sort-i (mapcar 'length lst) '>)) lst) Though sorting to find an extremum is likely to be slower in general. Quote
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.