using [ ... ] [ drop ] if* instead of dup [ ... ] [ 2drop ] if.
parent
9667ae962e
commit
8d077a96ad
|
@ -98,4 +98,4 @@ PRIVATE>
|
|||
(measure-metrics) combine-metrics ;
|
||||
|
||||
: measure-height ( children sizes -- height )
|
||||
(measure-metrics) dup [ combine-metrics + ] [ 3drop ] if ;
|
||||
(measure-metrics) [ combine-metrics + ] [ 2drop ] if* ;
|
||||
|
|
|
@ -22,7 +22,7 @@ M: clipboard set-clipboard-contents contents<< ;
|
|||
GENERIC: paste-clipboard ( gadget clipboard -- )
|
||||
|
||||
M: object paste-clipboard
|
||||
clipboard-contents dup [ swap user-input ] [ 2drop ] if ;
|
||||
clipboard-contents [ swap user-input ] [ drop ] if* ;
|
||||
|
||||
GENERIC: copy-clipboard ( string gadget clipboard -- )
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ M: table model-changed
|
|||
row-rect [ { 0 1 } v* ] change-dim ;
|
||||
|
||||
: scroll-to-row ( table n -- )
|
||||
dup [ [ thin-row-rect ] [ drop ] 2bi scroll>rect ] [ 2drop ] if ;
|
||||
[ [ thin-row-rect ] [ drop ] 2bi scroll>rect ] [ drop ] if* ;
|
||||
|
||||
: (select-row) ( table n -- )
|
||||
[ scroll-to-row ]
|
||||
|
|
|
@ -92,7 +92,7 @@ M: gadget gadget-foreground dup interior>> pen-foreground ;
|
|||
[ { 0 0 } ] dip dim>> gl-fill-rect ;
|
||||
|
||||
: draw-standard-background ( object -- )
|
||||
dup interior>> dup [ draw-interior ] [ 2drop ] if ;
|
||||
dup interior>> [ draw-interior ] [ drop ] if* ;
|
||||
|
||||
: draw-background ( gadget -- )
|
||||
origin get [
|
||||
|
|
|
@ -13,7 +13,7 @@ GENERIC: history-value ( object -- value )
|
|||
GENERIC: set-history-value ( value object -- )
|
||||
|
||||
: (add-history) ( history to -- )
|
||||
swap owner>> history-value dup [ swap push ] [ 2drop ] if ;
|
||||
swap owner>> history-value [ swap push ] [ drop ] if* ;
|
||||
|
||||
:: go-back/forward ( history to from -- )
|
||||
from empty? [
|
||||
|
|
|
@ -61,7 +61,7 @@ M: utf16be decode-char
|
|||
] [ append-nums ] if ;
|
||||
|
||||
: begin-utf16le ( stream byte -- stream char )
|
||||
over stream-read1 dup [ double-le ] [ 2drop replacement-char ] if ;
|
||||
over stream-read1 [ double-le ] [ drop replacement-char ] if* ;
|
||||
|
||||
M: utf16le decode-char
|
||||
drop dup stream-read1 dup [ begin-utf16le ] when nip ;
|
||||
|
|
|
@ -16,7 +16,7 @@ sequences.private strings tools.test ;
|
|||
CHAR: H 0 SBUF" hello world" [ set-nth ] keep first
|
||||
] unit-test
|
||||
|
||||
{ SBUF" x" } [ 1 <sbuf> CHAR: x >bignum over push ] unit-test
|
||||
{ SBUF" x" } [ 1 <sbuf> CHAR: x >bignum suffix! ] unit-test
|
||||
|
||||
{ fixnum } [ 1 >bignum SBUF" " new-sequence length class-of ] unit-test
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ ERROR: not-an-fdb-filename string ;
|
|||
ERROR: not-a-string-number string ;
|
||||
|
||||
: ?string>number ( string -- n )
|
||||
dup string>number dup [ nip ] [ not-a-string-number ] if ;
|
||||
dup string>number [ ] [ not-a-string-number ] ?if ;
|
||||
|
||||
: change-string-number ( string quot -- string' )
|
||||
[ [ string>number ] dip call number>string ] 2keep drop
|
||||
|
|
|
@ -50,7 +50,7 @@ M: subgraph dot.
|
|||
"subgraph " write [ id. ] [ statements. ] bi ;
|
||||
|
||||
: attribute, ( attr value -- )
|
||||
dup [ quote-string "%s=%s," printf ] [ 2drop ] if ;
|
||||
[ quote-string "%s=%s," printf ] [ drop ] if* ;
|
||||
|
||||
: attributes. ( attrs -- )
|
||||
"[" write
|
||||
|
|
|
@ -41,7 +41,7 @@ CONSTANT: N 5
|
|||
|
||||
: ?register ( acc seq -- )
|
||||
complete rotate-bits
|
||||
dup [ 2 N ^ mod ] map all-unique? [ infimum swap push ] [ 2drop ] if ;
|
||||
[ 2 N ^ mod ] map all-unique? [ infimum swap push ] [ drop ] if* ;
|
||||
|
||||
: add-bit ( seen bit -- seen' t/f )
|
||||
over last 2 * + 2 N ^ mod
|
||||
|
|
Loading…
Reference in New Issue