Hi Jon, > I can accept your explanation, but then I think the docs should make it > clear that the sorted list is what's returned by the function, and that > the state of the "input list" afterwards can be somewhat unpredictable.
I agree that the documentation is rather terse, but that's a feature ;-) In general it should be understood that "destructive" functions (may) modify their argument values in individual ways. Take 'flip', the destructive version of 'reverse' : (setq L (1 2 3 4 5 6)) -> (1 2 3 4 5 6) : (flip L) -> (6 5 4 3 2 1) : L -> (1) or 'conc', archetype of all destructive functions. While it sometimes works as one might expect : (setq A (1 2 3) B (4 5 6)) -> (4 5 6) : (conc A B) -> (1 2 3 4 5 6) : A -> (1 2 3 4 5 6) : B -> (4 5 6) 'A' is modified the way you expected for 'sort' (i.e. holding the return value). This is not the case, however, if the first argument is 'NIL' : (setq A NIL B (4 5 6)) -> (4 5 6) : (conc A B) -> (4 5 6) : A -> NIL : B -> (4 5 6) Then there is nothing to concat to, and only the return value is meaningful. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe