[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MCL 2.0b1p3 sort problems




  This looks like correct behavior:

  If the structure of foo looks like

   

             1       2       3
             |       |       |
  foo ->    [^][>]--[^][>]--[^][nil]


  After the destructive sort, we get:


             3       2       1
             |       |       |
            [^][>]--[^][>]--[^][nil]   <- foo


  foo still points at the same place (the car of
  the cons cell holding 1), but that list now
  dead-ends almost immediately.  So it returns 
  the correct answer, and foo gets destroyed.

  If you wanted to avoid the destruction, maybe
  doing a copy-list to another variable and sorting
  that instead would be good.  You could also
  do something like (setf foo (sort foo #'>)).


  ... Rick