Handbook
Glossary
insertion-sort ( base extended -- base )
Vocabulary
punycode
.
private
Inputs
base
an
object
extended
an
object
Outputs
base
an
object
Definition
USING:
kernel
math
sequences
sequences.extras
;
IN:
punycode.private
::
insertion-sort
( base extended -- base )
N
:>
ch! -1
:>
pos!
BIAS
:>
bias! 0
:>
extpos! extended
length
:>
extlen
[
extpos extlen
<
]
[
extended extpos bias
decode-delta
:>
( newpos delta ) delta 1
+
pos
+
pos! pos base
length
1
+
/mod
pos! ch
+
ch! ch 1114111
>
[
ch
invalid-character
]
when
ch pos base
insert-nth!
delta base
length
extpos 0
=
adapt
bias! newpos extpos!
]
while
base
;