factor: put inline on same line as ; for experimentation
parent
4962151111
commit
00338f62f3
|
@ -23,8 +23,7 @@ IN: binary-search
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: search ( seq quot: ( elt -- <=> ) -- i elt )
|
: search ( seq quot: ( elt -- <=> ) -- i elt )
|
||||||
over empty? [ 2drop f f ] [ [ 0 over length ] dip (search) ] if ;
|
over empty? [ 2drop f f ] [ [ 0 over length ] dip (search) ] if ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
GENERIC: natural-search ( obj seq -- i elt )
|
GENERIC: natural-search ( obj seq -- i elt )
|
||||||
M: object natural-search [ <=> ] with search ;
|
M: object natural-search [ <=> ] with search ;
|
||||||
|
|
|
@ -248,8 +248,7 @@ SPECIAL-OBJECT: undefined-quot 65
|
||||||
|
|
||||||
: emit-object ( class quot -- addr )
|
: emit-object ( class quot -- addr )
|
||||||
[ type-number ] dip over here-as
|
[ type-number ] dip over here-as
|
||||||
[ swap emit-header call align-here ] dip ;
|
[ swap emit-header call align-here ] dip ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
! Write an object to the image.
|
! Write an object to the image.
|
||||||
GENERIC: ' ( obj -- ptr )
|
GENERIC: ' ( obj -- ptr )
|
||||||
|
|
|
@ -53,5 +53,5 @@ IN: compiler.tree.combinators
|
||||||
: until-fixed-point ( ... #recursive quot: ( ... node -- ... ) -- ... )
|
: until-fixed-point ( ... #recursive quot: ( ... node -- ... ) -- ... )
|
||||||
over label>> t >>fixed-point drop
|
over label>> t >>fixed-point drop
|
||||||
[ with-scope ] 2keep
|
[ with-scope ] 2keep
|
||||||
over label>> fixed-point>> [ 2drop ] [ until-fixed-point ] if ;
|
over label>> fixed-point>>
|
||||||
inline recursive
|
[ 2drop ] [ until-fixed-point ] if ; inline recursive
|
||||||
|
|
|
@ -108,8 +108,8 @@ SYMBOL: changed?
|
||||||
|
|
||||||
: while-changing ( ... quot: ( ... -- ... ) -- ... )
|
: while-changing ( ... quot: ( ... -- ... ) -- ... )
|
||||||
changed? off
|
changed? off
|
||||||
[ call ] [ changed? get [ while-changing ] [ drop ] if ] bi ;
|
[ call ]
|
||||||
inline recursive
|
[ changed? get [ while-changing ] [ drop ] if ] bi ; inline recursive
|
||||||
|
|
||||||
: detect-loops ( call-graph -- )
|
: detect-loops ( call-graph -- )
|
||||||
HS{ } clone not-loops set
|
HS{ } clone not-loops set
|
||||||
|
|
|
@ -17,12 +17,12 @@ GENERIC: cancel-operation ( obj -- )
|
||||||
[ '[ _ cancel-operation ] ] dip later ;
|
[ '[ _ cancel-operation ] ] dip later ;
|
||||||
|
|
||||||
: with-timeout* ( obj timeout quot -- )
|
: with-timeout* ( obj timeout quot -- )
|
||||||
2over queue-timeout [ nip call ] dip stop-timer ;
|
2over queue-timeout
|
||||||
inline
|
[ nip call ] dip stop-timer ; inline
|
||||||
|
|
||||||
: with-timeout ( obj quot -- )
|
: with-timeout ( obj quot -- )
|
||||||
over timeout [ [ dup timeout ] dip with-timeout* ] [ call ] if ;
|
over timeout
|
||||||
inline
|
[ [ dup timeout ] dip with-timeout* ] [ call ] if ; inline
|
||||||
|
|
||||||
: timeouts ( dt -- )
|
: timeouts ( dt -- )
|
||||||
[ input-stream get set-timeout ]
|
[ input-stream get set-timeout ]
|
||||||
|
|
|
@ -346,8 +346,9 @@ FORGET: bad-recursion-3
|
||||||
{ 2 0 } [ drop f f [ 2drop "A" throw ] [ ] if 2drop ] must-infer-as
|
{ 2 0 } [ drop f f [ 2drop "A" throw ] [ ] if 2drop ] must-infer-as
|
||||||
|
|
||||||
: unbalanced-retain-usage ( a b -- )
|
: unbalanced-retain-usage ( a b -- )
|
||||||
dup 10 < [ 2drop 5 1 + unbalanced-retain-usage ] [ 2drop ] if ;
|
dup 10 <
|
||||||
inline recursive
|
[ 2drop 5 1 + unbalanced-retain-usage ]
|
||||||
|
[ 2drop ] if ; inline recursive
|
||||||
|
|
||||||
[ [ unbalanced-retain-usage ] infer ] [ inference-error? ] must-fail-with
|
[ [ unbalanced-retain-usage ] infer ] [ inference-error? ] must-fail-with
|
||||||
|
|
||||||
|
|
|
@ -270,8 +270,7 @@ TUPLE: nested-pane-stream < pane-stream style parent ;
|
||||||
: new-nested-pane-stream ( style parent class -- stream )
|
: new-nested-pane-stream ( style parent class -- stream )
|
||||||
new
|
new
|
||||||
swap >>parent
|
swap >>parent
|
||||||
swap <pane> apply-wrap-style [ >>style ] [ >>pane ] bi* ;
|
swap <pane> apply-wrap-style [ >>style ] [ >>pane ] bi* ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
: unnest-pane-stream ( stream -- child parent )
|
: unnest-pane-stream ( stream -- child parent )
|
||||||
[ [ style>> ] [ pane>> smash-pane ] bi style-pane ] [ parent>> ] bi ;
|
[ [ style>> ] [ pane>> smash-pane ] bi style-pane ] [ parent>> ] bi ;
|
||||||
|
|
|
@ -175,8 +175,7 @@ M: bignum (log2) bignum-log2 ; inline
|
||||||
zero? [
|
zero? [
|
||||||
dup 2 bitand zero? not rot or [ 1 + ] when
|
dup 2 bitand zero? not rot or [ 1 + ] when
|
||||||
] [ nip 1 + ] if
|
] [ nip 1 + ] if
|
||||||
] [ drop nip ] if ;
|
] [ drop nip ] if ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
! Fourth step: post-scaling
|
! Fourth step: post-scaling
|
||||||
! Because of rounding, our mantissa with guard bit is now in the
|
! Because of rounding, our mantissa with guard bit is now in the
|
||||||
|
|
|
@ -135,8 +135,7 @@ PRIVATE>
|
||||||
|
|
||||||
: sort ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
|
: sort ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
|
||||||
[ <merge> ] dip
|
[ <merge> ] dip
|
||||||
[ sort-pairs ] [ sort-loop ] [ drop accum>> underlying>> ] 2tri ;
|
[ sort-pairs ] [ sort-loop ] [ drop accum>> underlying>> ] 2tri ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
: natural-sort ( seq -- sortedseq ) [ <=> ] sort ;
|
: natural-sort ( seq -- sortedseq ) [ <=> ] sort ;
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,7 @@ IN: benchmark.beust2
|
||||||
] any? ; inline recursive
|
] any? ; inline recursive
|
||||||
|
|
||||||
:: count-numbers ( max listener -- )
|
:: count-numbers ( max listener -- )
|
||||||
10 iota [ 1 + 1 1 0 max listener (count-numbers) ] any? drop ;
|
10 iota [ 1 + 1 1 0 max listener (count-numbers) ] any? drop ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
:: beust2-benchmark ( -- )
|
:: beust2-benchmark ( -- )
|
||||||
0 :> i!
|
0 :> i!
|
||||||
|
|
|
@ -2,8 +2,9 @@ USING: math kernel hints prettyprint io combinators ;
|
||||||
IN: benchmark.recursive
|
IN: benchmark.recursive
|
||||||
|
|
||||||
: fib ( m -- n )
|
: fib ( m -- n )
|
||||||
dup 2 < [ drop 1 ] [ [ 1 - fib ] [ 2 - fib ] bi + ] if ;
|
dup 2 <
|
||||||
inline recursive
|
[ drop 1 ]
|
||||||
|
[ [ 1 - fib ] [ 2 - fib ] bi + ] if ; inline recursive
|
||||||
|
|
||||||
: ack ( m n -- x )
|
: ack ( m n -- x )
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,15 +56,13 @@ STRUCT: yuv-buffer
|
||||||
drop 516 * 128 + swap 298 * + -8 shift clamp ; inline
|
drop 516 * 128 + swap 298 * + -8 shift clamp ; inline
|
||||||
|
|
||||||
: compute-green ( y u v -- g )
|
: compute-green ( y u v -- g )
|
||||||
[ [ 298 * ] dip 100 * - ] dip 208 * - 128 + -8 shift clamp ;
|
[ [ 298 * ] dip 100 * - ] dip 208 * - 128 + -8 shift clamp ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
: compute-red ( y u v -- g )
|
: compute-red ( y u v -- g )
|
||||||
nip 409 * swap 298 * + 128 + -8 shift clamp ; inline
|
nip 409 * swap 298 * + 128 + -8 shift clamp ; inline
|
||||||
|
|
||||||
: compute-rgb ( y u v -- b g r )
|
: compute-rgb ( y u v -- b g r )
|
||||||
[ compute-blue ] [ compute-green ] [ compute-red ] 3tri ;
|
[ compute-blue ] [ compute-green ] [ compute-red ] 3tri ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
: store-rgb ( index rgb b g r -- index )
|
: store-rgb ( index rgb b g r -- index )
|
||||||
[ pick 0 + pick set-nth-unsafe ]
|
[ pick 0 + pick set-nth-unsafe ]
|
||||||
|
|
|
@ -242,8 +242,7 @@ DEFER: (d)
|
||||||
dup length [ graded-triple ] with map ;
|
dup length [ graded-triple ] with map ;
|
||||||
|
|
||||||
: graded-laplacian ( generators quot -- seq )
|
: graded-laplacian ( generators quot -- seq )
|
||||||
[ basis graded graded-triples [ first3 ] ] dip compose map ;
|
[ basis graded graded-triples [ first3 ] ] dip compose map ; inline
|
||||||
inline
|
|
||||||
|
|
||||||
: graded-laplacian-betti ( generators -- seq )
|
: graded-laplacian-betti ( generators -- seq )
|
||||||
[ laplacian-betti ] graded-laplacian ;
|
[ laplacian-betti ] graded-laplacian ;
|
||||||
|
|
|
@ -212,8 +212,8 @@ PRIVATE>
|
||||||
: ((each-from)) ( i seq -- n quot )
|
: ((each-from)) ( i seq -- n quot )
|
||||||
[ length over [-] swap ] keep '[ _ + _ nth-unsafe ] ; inline
|
[ length over [-] swap ] keep '[ _ + _ nth-unsafe ] ; inline
|
||||||
|
|
||||||
: (each-from) ( i seq quot -- n quot' ) [ ((each-from)) ] dip compose ;
|
: (each-from) ( i seq quot -- n quot' )
|
||||||
inline
|
[ ((each-from)) ] dip compose ; inline
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue