#621 odd error with sort

lisp error
pending-invalid
Sam Steingold
clisp (525)
5
2011-12-08
2011-12-05
No

It is about GNU CLISP strange behaviours. The version 2.33/2.48/2.49 were tested. Can anybody explain this oddness?

(defun xsort (l) (sort l #'<)) ;XSORT
(setq l '(3 1 2)) ;(3 1 2)
(xsort l) ;(1 2 3)
l ; surprize! (1 2 3)

The ordinal lisp function XSORT takes its argument by value but the presence of SORT-function in its body converts argument to passed by reference! Are there any reasonable explanation? BTW the POP-function doesn't make surprize:

(defun xpop (l) (pop l)) ;XPOP
(setq l '(3 1 2)) ;(3 1 2)
(xpop l) ;3
l ;(3 2 1)

Discussion

<< < 1 2 (Page 2 of 2)
  • Sam Steingold
    Sam Steingold
    2011-12-08

    • status: open-invalid --> pending-invalid
     
<< < 1 2 (Page 2 of 2)