basis: fewer tokens when possible using if*.

db4
John Benediktsson 2013-03-23 22:25:02 -07:00
parent 244fca37a9
commit 1754ab73bd
4 changed files with 8 additions and 8 deletions

View File

@ -99,12 +99,12 @@ M: conversations call-responder*
<redirect> ; <redirect> ;
: restore-conversation ( seq -- ) : restore-conversation ( seq -- )
conversation get dup [ conversation get [
namespace>> namespace>>
[ '[ _ key? ] filter ] [ '[ _ key? ] filter ]
[ '[ [ _ at ] keep set ] each ] [ '[ [ _ at ] keep set ] each ]
bi bi
] [ 2drop ] if ; ] [ drop ] if* ;
M: conversations modify-form ( conversations -- xml/f ) M: conversations modify-form ( conversations -- xml/f )
drop drop

View File

@ -58,8 +58,8 @@ SYMBOL: generic-dependencies
[ class-or ] when* ; [ class-or ] when* ;
: add-depends-on-generic ( class generic -- ) : add-depends-on-generic ( class generic -- )
generic-dependencies get dup generic-dependencies get
[ [ ?class-or ] change-at ] [ 3drop ] if ; [ [ ?class-or ] change-at ] [ 2drop ] if* ;
! Conditional dependencies are re-evaluated when classes change; ! Conditional dependencies are re-evaluated when classes change;
! if any fail, the word is recompiled ! if any fail, the word is recompiled
@ -69,7 +69,7 @@ GENERIC: satisfied? ( dependency -- ? )
: add-conditional-dependency ( ... class -- ) : add-conditional-dependency ( ... class -- )
boa conditional-dependencies get boa conditional-dependencies get
dup [ adjoin ] [ 2drop ] if ; inline [ adjoin ] [ drop ] if* ; inline
TUPLE: depends-on-class-predicate class1 class2 result ; TUPLE: depends-on-class-predicate class1 class2 result ;

View File

@ -20,10 +20,10 @@ exclude-vocabs { "math" "accessors" } swap set-global
SYMBOL: end SYMBOL: end
: include? ( vocab -- ? ) : include? ( vocab -- ? )
include-vocabs get dup [ member? ] [ 2drop t ] if ; include-vocabs get [ member? ] [ drop t ] if* ;
: exclude? ( vocab -- ? ) : exclude? ( vocab -- ? )
exclude-vocabs get dup [ member? ] [ 2drop f ] if ; exclude-vocabs get [ member? ] [ drop f ] if* ;
: into? ( obj -- ? ) : into? ( obj -- ? )
{ {

View File

@ -32,7 +32,7 @@ SYMBOL: changed-vocabs
[ unchanged-vocab ] each ; [ unchanged-vocab ] each ;
: changed-vocab? ( vocab -- ? ) : changed-vocab? ( vocab -- ? )
changed-vocabs get dup [ key? ] [ 2drop t ] if ; changed-vocabs get [ key? ] [ drop t ] if* ;
: filter-changed ( vocabs -- vocabs' ) : filter-changed ( vocabs -- vocabs' )
[ changed-vocab? ] filter ; [ changed-vocab? ] filter ;