Handbook
Glossary
position>index ( pos gb -- i )
Vocabulary
gap-buffer
Inputs
pos
an
object
gb
an
object
Outputs
i
an
object
Definition
USING:
accessors
kernel
math
;
IN:
gap-buffer
:
position>index
( pos gb -- i )
2dup
valid-position?
[
2dup
gap-start>>
>=
[
gap-length
+
]
[
drop
]
if
]
[
position-out-of-bounds
]
if
;