Vocabulary

sorting.quick.private

Inputs

Outputs

None

Definition

sorting.quick.private

Inputs

seq | an object |

from | an object |

to | an object |

quot | a quotation with stack effect ( obj1 obj2 -- <=> ) |

Outputs

None

Definition

:: quicksort ( seq from to quot: ( obj1 obj2 -- <=> ) -- )

from to < [

from to fixnum+fast 2/ seq nth-unsafe :> pivot from to

[ 2dup <= ] [

[ over seq nth-unsafe pivot quot call +lt+ eq? ]

[ [ 1 fixnum+fast ] dip ] while

[ dup seq nth-unsafe pivot quot call +gt+ eq? ]

[ 1 fixnum-fast ] while 2dup <= [

[ seq exchange-unsafe ]

[ [ 1 fixnum+fast ] [ 1 fixnum-fast ] bi* ] 2bi

] when

] while [ seq from ] dip quot quicksort [ seq ] dip

to quot quicksort

] when ; inline recursive

from to < [

from to fixnum+fast 2/ seq nth-unsafe :> pivot from to

[ 2dup <= ] [

[ over seq nth-unsafe pivot quot call +lt+ eq? ]

[ [ 1 fixnum+fast ] dip ] while

[ dup seq nth-unsafe pivot quot call +gt+ eq? ]

[ 1 fixnum-fast ] while 2dup <= [

[ seq exchange-unsafe ]

[ [ 1 fixnum+fast ] [ 1 fixnum-fast ] bi* ] 2bi

] when

] while [ seq from ] dip quot quicksort [ seq ] dip

to quot quicksort

] when ; inline recursive

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.99 x86.64 (2203, heads/master-424edf64aa, Mar 8 2023 13:48:50)