Working in AutoLISP. I am looking for a more elegant way to extract the second string in this list of lists...
(("FullName") ("Larry Paige"))
Currently using the following to extract desired data.
(setq _BAMOFO(nth 0 (nth 1 Result)))
Thank you.
Working in AutoLISP. I am looking for a more elegant way to extract the second string in this list of lists...
(("FullName") ("Larry Paige"))
Currently using the following to extract desired data.
(setq _BAMOFO(nth 0 (nth 1 Result)))
Thank you.
Share Improve this question edited yesterday Kyle Fleming asked yesterday Kyle FlemingKyle Fleming 113 bronze badges New contributor Kyle Fleming is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.2 Answers
Reset to default 0Fully low-level way:
(car (car (cdr Result)))
Mixed way that is likely more readable, as it is closer to human intuition of what we want to get:
(car (nth 1 Result))
The most readable approach to me would be to be able to write:
(setq _BAMOFO (fullname result))
And you need to define a fullname
accessor function.
Then you do not really care about how it is implemented; nth
is quite readable in my opinion.
(defun fullname (list)
(nth 0 (nth 1 list)))
Or maybe you can find a more robust way to extract the name given the shape of your data, for example finding out the list the list that contains "FullName"
, that's not entirely clear to me if that makes sense in your context.