Introduce key-bytes symbol and with-key
parent
b5dd6e1065
commit
5a7d699b3b
|
@ -44,8 +44,16 @@ TUPLE: cb-node < node byte# bits ;
|
||||||
! ** Insertion
|
! ** Insertion
|
||||||
! Explain...
|
! Explain...
|
||||||
|
|
||||||
|
! Keep the byte sequence of the current key in =key-bytes= and provide a working
|
||||||
|
! environment for it with =with-key=.
|
||||||
|
SYMBOL: key-bytes
|
||||||
|
|
||||||
|
: with-key ( key quot -- )
|
||||||
|
[ key-bytes ] dip with-variable ; inline
|
||||||
|
|
||||||
DEFER: cb-set
|
DEFER: cb-set
|
||||||
|
|
||||||
|
! TODO Rewrite with =with-key=.
|
||||||
: cb-insert ( value key node -- node taller? created? )
|
: cb-insert ( value key node -- node taller? created? )
|
||||||
2dup [ byte#>> ] [ bits>> ] bi
|
2dup [ byte#>> ] [ bits>> ] bi
|
||||||
[ swap get-byte-at ] dip key-side [
|
[ swap get-byte-at ] dip key-side [
|
||||||
|
|
Loading…
Reference in New Issue