Add tags

Add tags to the following comment

Squeak Smalltalk で。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
| sort |
sort := [:min :max :size :data |
    | bag out |
    bag := data asBag.
    out := OrderedCollection new: size.
    min to: max do: [:each |
        (bag occurrencesOf: each) timesRepeat: [out add: each]].
    out asArray].

sort valueWithArguments: #(-1 10 10 (-1 9 4 8 9 6 3 9 5 2))
"=> #(-1 2 3 4 5 6 8 9 9 9) "

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...