From b398daf4727e660165418a418925ed10a6db71ff Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 21 Mar 2013 17:57:03 -0700 Subject: [PATCH] boxes: don't check occupied twice. --- basis/boxes/boxes.factor | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/basis/boxes/boxes.factor b/basis/boxes/boxes.factor index 15c22bea88..22b28b8434 100644 --- a/basis/boxes/boxes.factor +++ b/basis/boxes/boxes.factor @@ -18,11 +18,18 @@ ERROR: box-empty box ; : check-box ( box -- box ) dup occupied>> [ box-empty ] unless ; inline + ( box -- value ) + [ f ] change-value f >>occupied drop ; inline + +PRIVATE> + : box> ( box -- value ) - check-box [ f ] change-value f >>occupied drop ; inline + check-box box-unsafe> ; inline : ?box ( box -- value/f ? ) - dup occupied>> [ box> t ] [ drop f f ] if ; inline + dup occupied>> [ box-unsafe> t ] [ drop f f ] if ; inline : if-box? ( box quot -- ) [ ?box ] dip [ drop ] if ; inline