Re: Behavior of sort

2019-05-05 Thread JmageK
1 2 3 4 9) JmageK -- Securely sent with Tutanota May 4, 2019, 8:10 PM by a...@software-lab.de: > Hi Kashyap, > >> I noticed an odd behavior of sort - >> (setq L '((2) (1) )) >> (sort L) >> > > Note that 'sort' is a destructive function, it modifies the order o

Re: Behavior of sort

2019-05-04 Thread Lindsay Lawrence
))) -> ((3) (2) (1)) : (show L) -> ((3) (2) (1)) : (setq L (sort L)) -> ((1) (2) (3)) : (show L) -> ((1) (2) (3)) : (length L) -> 3 Regards, /Lindsay On Sat, May 4, 2019 at 7:32 AM C K Kashyap wrote: > Hi all, > > I noticed an odd behavior of sort - > > (setq L '((2) (

Re: Behavior of sort

2019-05-04 Thread Alexander Burger
Hi Kashyap, > I noticed an odd behavior of sort - > (setq L '((2) (1) )) > (sort L) Note that 'sort' is a destructive function, it modifies the order of cells in-place. Thus you must use the return value of 'sort', it may return another cell than was passed to it. In the above, t

Behavior of sort

2019-05-04 Thread C K Kashyap
Hi all, I noticed an odd behavior of sort - (setq L '((2) (1) )) (println (length L)) # 2 as expected (sort L) (println (length L)) # why 1? (println L) # ((2)) (bye) I would expect sort not to change the length. Am I missing something here or is sort broken? Regards, Kashyap