using when instead of [ ] if.

char-rename
John Benediktsson 2017-02-09 16:29:14 -08:00
parent 9d3b5cb44b
commit d63c992d97
6 changed files with 10 additions and 13 deletions

View File

@ -266,8 +266,7 @@ M:: aes-decrypt (expand-key) ( K Nr -- sched )
K Nr (expand-enc-key) dup length :> key-length
[
[ 4 >= ] [ key-length 4 - < ] bi and
[ subword ui32-rev> d-transform ]
[ ] if
[ subword ui32-rev> d-transform ] when
] map-index ;
M: aes-decrypt (first-round) ( aes -- aes' )

View File

@ -102,7 +102,7 @@ TUPLE: vbo
B{ 0 0 0 } >>bitmap ;
: make-texture ( pathname alt -- texture )
swap [ nip load-image ] [ ] if*
swap [ nip load-image ] when*
[
[ component-order>> ]
[ component-type>> ] bi

View File

@ -114,7 +114,7 @@ CONSTRUCTOR: <mdb-connection> mdb-connection ( instance -- mdb-connection ) ;
: eval-ismaster-result ( node result -- )
[
[ "ismaster" ] dip at dup string?
[ >integer 1 = ] [ ] if >>master? drop
[ >integer 1 = ] when >>master? drop
] [
[ "remote" ] dip at
[ split-host-str <inet> f <mdb-node> >>remote ] when* drop

View File

@ -104,8 +104,6 @@ M: tuple tuple>selector ( tuple -- assoc )
prepare-assoc [ tuple>selector ] write-tuple-fields ;
: assoc>tuple ( assoc -- tuple )
dup assoc?
[ [ dup tuple-info?
[ make-tuple ]
[ ] if ] [ drop ] recover
] [ ] if ; inline recursive
dup assoc? [
[ dup tuple-info? [ make-tuple ] when ] ignore-errors
] when ; inline recursive

View File

@ -6,8 +6,7 @@ webbrowser ;
IN: oauth2
: console-prompt ( query -- str/f )
write flush readln [ blank? ] trim
dup "" = [ drop f ] [ ] if ;
write flush readln [ blank? ] trim [ f ] when-empty ;
: post-json-request ( params token-uri -- assoc )
<post-request> dup header>> "application/json" "Accept" rot set-at

View File

@ -13,8 +13,9 @@ TUPLE: readline-reader { prompt initial: f } ;
INSTANCE: readline-reader input-stream
M: readline-reader stream-readln
flush [ prompt>> dup [ " " append ] [ ] if readline ]
keep f >>prompt drop ;
flush
[ dup [ " " append ] when readline f ] change-prompt
drop ;
M: readline-reader prompt.
>>prompt drop ;