From: Doug Coleman Date: Sat, 25 Feb 2023 15:08:13 +0000 (-0600) Subject: factor: use ?call X-Git-Tag: 0.99~519 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=633d6db551f909ccce6d50389fba4a01e583d26f factor: use ?call --- diff --git a/basis/alien/libraries/finder/freebsd/freebsd.factor b/basis/alien/libraries/finder/freebsd/freebsd.factor index 8523717cb6..b7c7bd19e2 100644 --- a/basis/alien/libraries/finder/freebsd/freebsd.factor +++ b/basis/alien/libraries/finder/freebsd/freebsd.factor @@ -23,5 +23,5 @@ PRIVATE> M: freebsd find-library* "l" prepend load-ldconfig-cache - [ name-matches? ] with find nip ?first dup [ ".so" append ] when ; + [ name-matches? ] with find nip ?first [ ".so" append ] ?call ; diff --git a/basis/alien/libraries/libraries.factor b/basis/alien/libraries/libraries.factor index 0c17e186f9..5d6aee0a28 100644 --- a/basis/alien/libraries/libraries.factor +++ b/basis/alien/libraries/libraries.factor @@ -41,7 +41,7 @@ GENERIC: library-dll ( obj -- dll ) M: f library-dll ; M: library library-dll - dup [ dll>> ] when ; + [ dll>> ] ?call ; M: string library-dll ( library -- dll ) lookup-library library-dll ; diff --git a/basis/cache/cache.factor b/basis/cache/cache.factor index 09268d3e5b..ed502b4768 100644 --- a/basis/cache/cache.factor +++ b/basis/cache/cache.factor @@ -19,7 +19,7 @@ M: cache-entry dispose value>> dispose ; M: cache-assoc assoc-size assoc>> assoc-size ; -M: cache-assoc at* assoc>> at* [ dup [ 0 >>age value>> ] when ] dip ; +M: cache-assoc at* assoc>> at* [ [ 0 >>age value>> ] ?call ] dip ; M: cache-assoc set-at check-disposed diff --git a/basis/cocoa/nibs/nibs.factor b/basis/cocoa/nibs/nibs.factor index 548dece519..9c051308b1 100644 --- a/basis/cocoa/nibs/nibs.factor +++ b/basis/cocoa/nibs/nibs.factor @@ -11,7 +11,7 @@ IN: cocoa.nibs : nib-named ( nib-name -- anNSNib ) NSNib -> alloc swap f -> initWithNibNamed:bundle: - dup [ -> autorelease ] when ; + [ -> autorelease ] ?call ; : nib-objects ( anNSNib -- objects/f ) f diff --git a/basis/compiler/cfg/builder/alien/alien-tests.factor b/basis/compiler/cfg/builder/alien/alien-tests.factor index 46eef2e0e5..dc88fa935c 100644 --- a/basis/compiler/cfg/builder/alien/alien-tests.factor +++ b/basis/compiler/cfg/builder/alien/alien-tests.factor @@ -49,7 +49,7 @@ ${ } [ f f cdecl f "libc" "malloc" alien-invoke-params boa caller-linkage - dup [ path>> alien>native-string ] when + [ path>> alien>native-string ] ?call ] unit-test SYMBOL: foo diff --git a/basis/compiler/cfg/linear-scan/allocation/allocation.factor b/basis/compiler/cfg/linear-scan/allocation/allocation.factor index f3f48beed2..aa980dfe0a 100644 --- a/basis/compiler/cfg/linear-scan/allocation/allocation.factor +++ b/basis/compiler/cfg/linear-scan/allocation/allocation.factor @@ -35,7 +35,7 @@ IN: compiler.cfg.linear-scan.allocation : spill-at-sync-point? ( sync-point live-interval -- ? ) { [ drop keep-dst?>> not ] - [ [ n>> ] dip find-use dup [ def-rep>> ] when not ] + [ [ n>> ] dip find-use [ def-rep>> ] ?call not ] } 2|| ; : spill-at-sync-point ( sync-point live-interval -- ? ) diff --git a/basis/compiler/cfg/linear-scan/linear-scan-tests.factor b/basis/compiler/cfg/linear-scan/linear-scan-tests.factor index a20bff465b..8438faa597 100644 --- a/basis/compiler/cfg/linear-scan/linear-scan-tests.factor +++ b/basis/compiler/cfg/linear-scan/linear-scan-tests.factor @@ -64,7 +64,7 @@ H{ } representations set : clean-up-split ( a b -- a b ) - [ dup [ [ >vector ] change-uses [ >vector ] change-ranges ] when ] bi@ ; + [ [ [ >vector ] change-uses [ >vector ] change-ranges ] ?call ] bi@ ; { T{ live-interval-state diff --git a/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor b/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor index 3cede64e85..88d5cb4432 100644 --- a/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor +++ b/basis/compiler/cfg/linear-scan/live-intervals/live-intervals.factor @@ -37,7 +37,7 @@ TUPLE: live-interval-state :: find-use ( insn# live-interval -- vreg-use/f ) insn# live-interval (find-use) - dup [ dup n>> insn# = [ drop f ] unless ] when ; + [ dup n>> insn# = [ drop f ] unless ] ?call ; : ( vreg -- live-interval ) \ live-interval-state new diff --git a/basis/compiler/cfg/ssa/construction/construction.factor b/basis/compiler/cfg/ssa/construction/construction.factor index 0bec5cebcb..6cb69d9083 100644 --- a/basis/compiler/cfg/ssa/construction/construction.factor +++ b/basis/compiler/cfg/ssa/construction/construction.factor @@ -71,7 +71,7 @@ SYMBOLS: stacks pushed ; : top-name ( vreg -- vreg' ) (top-name) - dup [ dup used-vregs get push-front ] when ; + [ dup used-vregs get push-front ] ?call ; RENAMING: ssa-rename [ gen-name ] [ top-name ] [ ] diff --git a/basis/compiler/codegen/gc-maps/gc-maps.factor b/basis/compiler/codegen/gc-maps/gc-maps.factor index e373aa0745..abfe6fa6ed 100644 --- a/basis/compiler/codegen/gc-maps/gc-maps.factor +++ b/basis/compiler/codegen/gc-maps/gc-maps.factor @@ -8,7 +8,7 @@ IN: compiler.codegen.gc-maps SYMBOLS: return-addresses gc-maps ; : gc-map-needed? ( gc-map/f -- ? ) - dup [ tuple-slots [ empty? ] all? not ] when ; + [ tuple-slots [ empty? ] all? not ] ?call ; : gc-map-here ( gc-map -- ) dup gc-map-needed? [ diff --git a/extra/combinators/extras/extras.factor b/extra/combinators/extras/extras.factor index a0a95b122f..eb69949e2d 100644 --- a/extra/combinators/extras/extras.factor +++ b/extra/combinators/extras/extras.factor @@ -87,17 +87,13 @@ MACRO: n*obj ( n obj -- quot ) MACRO:: n-falsify ( n -- quot ) [ n ndup n n-and [ n ndrop n f n*obj ] unless ] ; -! plox -: ?1res ( ..a obj/f quot -- ..b ) - dupd when ; inline - ! when both args are true, call quot. otherwise dont : ?2res ( ..a obj1 obj2 quot: ( obj1 obj2 -- ? ) -- ..b ) [ 2dup and ] dip [ 2drop f ] if ; inline ! try the quot, keep the original arg if quot is true : ?1arg ( obj quot: ( obj -- ? ) -- obj/f ) - [ ?1res ] keepd '[ _ ] [ f ] if ; inline + [ ?call ] keepd '[ _ ] [ f ] if ; inline : ?2arg ( obj1 obj2 quot: ( obj1 obj2 -- ? ) -- obj1/f obj2/f ) [ ?2res ] 2keepd '[ _ _ ] [ f f ] if ; inline