I have a list containing structures. How can I sort the list on one of
the structure-fields using the sort-function? My structure has a :name
field on which I wish to sort the list.
Thanks,
Ernest
Ernest Smit <····@oce.nl> writes:
> I have a list containing structures. How can I sort the list on one of
> the structure-fields using the sort-function? My structure has a :name
> field on which I wish to sort the list.
(sort list-of-mystructs #'string-< :key #'mystruct-name)
--- or something like it.
--
Raymond Wiker
·············@fast.no
Ernest Smit <····@oce.nl> writes:
> I have a list containing structures. How can I sort the list on one of
> the structure-fields using the sort-function? My structure has a :name
> field on which I wish to sort the list.
(defstruct foo
name)
(sort foos #'string< :key #'foo-name) ; not tested
See http://www.xanalys.com/software_tools/reference/HyperSpec/Body/fun_sortcm_stable-sort.html for details.
--
Janis Dzerins
If million people say a stupid thing it's still a stupid thing.