From 5a7d699b3bf83c3a0dfcbe9696dcae6d0f83c19a Mon Sep 17 00:00:00 2001 From: Michael Raitza Date: Sun, 9 Feb 2020 01:53:52 +0100 Subject: [PATCH] Introduce key-bytes symbol and with-key --- cb/cb.factor | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cb/cb.factor b/cb/cb.factor index 3ad0957..0bc0833 100644 --- a/cb/cb.factor +++ b/cb/cb.factor @@ -44,8 +44,16 @@ TUPLE: cb-node < node byte# bits ; ! ** Insertion ! 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 +! TODO Rewrite with =with-key=. : cb-insert ( value key node -- node taller? created? ) 2dup [ byte#>> ] [ bits>> ] bi [ swap get-byte-at ] dip key-side [