- Title
- stable-sort
- Type
- Function
- Arguments
- stable-sort SEQUENCE PREDICATE &key :key
- Package
- lisp
- Section
- シーケンス
- File
- builtin.l
SEQUENCE を PREDICATE に従った順番に並び替えたものを返します。元の SEQUENCE
は変更されます。 stable-sort は安定なソートを行います。つまり PREDICATE によっ
て同順と見なされる要素間の順序は、ソート前と同じであることが保証されます。
SEQUENCE : ソートするシーケンスを指定します。
PREDICATE : 比較関数を指定します。
:key : 比較対象を取得する関数を指定します。
使用例:
(setq *test-seq* '(("foo") ("bar") ("hoge")))
=> (("foo") ("bar") ("hoge"))
(setq *test-seq* (stable-sort *test-seq* #'string-lessp :key #'car))
=> (("bar") ("foo") ("hoge"))
*test-seq*
=> (("bar") ("foo") ("hoge"))
(setq *test-seq* '(("foo") ("bar") ("hoge")))
=> (("foo") ("bar") ("hoge"))
(stable-sort *test-seq* #'string-lessp :key #'car)
=> (("bar") ("foo") ("hoge"))
*test-seq*
=> (("foo") ("hoge"))
- Seealso
- sort
- Link
- [xyzzy:06221]