[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sorting lists of lists
From: |
Marius Vollmer |
Subject: |
Re: sorting lists of lists |
Date: |
19 Sep 2002 18:44:35 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Christoph Groth <address@hidden> writes:
> ~$ guile
> guile> (define l '((4) (2) (5) (1)))
> guile> (sort! l (lambda (a b) (< (car a) (car b))))
> ((1) (2) (4) (5))
> guile> l
> ((2) (4) (5))
You should do
guile> (set! l (sort! l ...))
'sort!' returns the new sorted list, it doesn't store it into the
variable. The '!' merely signifies that it is allowed to destroy the
orgininal list in the process.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405