]> gitweb.factorcode.org Git - factor.git/commitdiff
using when instead of [ ] if.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 10 Feb 2017 00:29:14 +0000 (16:29 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 10 Feb 2017 00:29:14 +0000 (16:29 -0800)
extra/crypto/aes/aes.factor
extra/model-viewer/model-viewer.factor
extra/mongodb/connection/connection.factor
extra/mongodb/tuple/persistent/persistent.factor
extra/oauth2/oauth2.factor
extra/readline-listener/readline-listener.factor

index 0695eb127a1e50651b2821f8b11bad59f5d02ea3..5e37d3d1f6c5afa8b74322b76352c033bc4604ca 100644 (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' )
index 68a7b73377a7a26c6d0206029de0e7b10af9351e..b7e518522ae1ae7218d1ecdf2aa2c6aafb612e94 100644 (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
index df468bd0fa7391d1fcafd77ff3f19a9d04b20f5d..f93f489d20efb4a5d8e93b4a215ad2826fbc871b 100644 (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
index 72c7237a775cb775ce50b13b820b1ad8e1ed3318..78fb5d8ccee6fd4af096335e14ad852d6f9e2365 100644 (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
index 09ecf548a5a52bde29fa875f1fef72877d38b4c2..daea9f950e7cffd72583ee1672579ff4361dffbc 100644 (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
index a789d33308a6fc5fc89b40900691d53583bf8416..d783e582b5eb4db2d96fd89ba2b1d2d40a70b677 100644 (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 ;