PRIVATE>
: search ( seq quot: ( elt -- <=> ) -- i elt )
- over empty? [ 2drop f f ] [ [ 0 over length ] dip (search) ] if ;
- inline
+ over empty? [ 2drop f f ] [ [ 0 over length ] dip (search) ] if ; inline
GENERIC: natural-search ( obj seq -- i elt )
M: object natural-search [ <=> ] with search ;
: emit-object ( class quot -- addr )
[ type-number ] dip over here-as
- [ swap emit-header call align-here ] dip ;
- inline
+ [ swap emit-header call align-here ] dip ; inline
! Write an object to the image.
GENERIC: ' ( obj -- ptr )
: until-fixed-point ( ... #recursive quot: ( ... node -- ... ) -- ... )
over label>> t >>fixed-point drop
[ with-scope ] 2keep
- over label>> fixed-point>> [ 2drop ] [ until-fixed-point ] if ;
- inline recursive
+ over label>> fixed-point>>
+ [ 2drop ] [ until-fixed-point ] if ; inline recursive
: while-changing ( ... quot: ( ... -- ... ) -- ... )
changed? off
- [ call ] [ changed? get [ while-changing ] [ drop ] if ] bi ;
- inline recursive
+ [ call ]
+ [ changed? get [ while-changing ] [ drop ] if ] bi ; inline recursive
: detect-loops ( call-graph -- )
HS{ } clone not-loops set
[ '[ _ cancel-operation ] ] dip later ;
: with-timeout* ( obj timeout quot -- )
- 2over queue-timeout [ nip call ] dip stop-timer ;
- inline
+ 2over queue-timeout
+ [ nip call ] dip stop-timer ; inline
: with-timeout ( obj quot -- )
- over timeout [ [ dup timeout ] dip with-timeout* ] [ call ] if ;
- inline
+ over timeout
+ [ [ dup timeout ] dip with-timeout* ] [ call ] if ; inline
: timeouts ( dt -- )
[ input-stream get set-timeout ]
{ 2 0 } [ drop f f [ 2drop "A" throw ] [ ] if 2drop ] must-infer-as
: unbalanced-retain-usage ( a b -- )
- dup 10 < [ 2drop 5 1 + unbalanced-retain-usage ] [ 2drop ] if ;
- inline recursive
+ dup 10 <
+ [ 2drop 5 1 + unbalanced-retain-usage ]
+ [ 2drop ] if ; inline recursive
[ [ unbalanced-retain-usage ] infer ] [ inference-error? ] must-fail-with
: new-nested-pane-stream ( style parent class -- stream )
new
swap >>parent
- swap <pane> apply-wrap-style [ >>style ] [ >>pane ] bi* ;
- inline
+ swap <pane> apply-wrap-style [ >>style ] [ >>pane ] bi* ; inline
: unnest-pane-stream ( stream -- child parent )
[ [ style>> ] [ pane>> smash-pane ] bi style-pane ] [ parent>> ] bi ;
zero? [
dup 2 bitand zero? not rot or [ 1 + ] when
] [ nip 1 + ] if
- ] [ drop nip ] if ;
- inline
+ ] [ drop nip ] if ; inline
! Fourth step: post-scaling
! Because of rounding, our mantissa with guard bit is now in the
: sort ( seq quot: ( obj1 obj2 -- <=> ) -- sortedseq )
[ <merge> ] dip
- [ sort-pairs ] [ sort-loop ] [ drop accum>> underlying>> ] 2tri ;
- inline
+ [ sort-pairs ] [ sort-loop ] [ drop accum>> underlying>> ] 2tri ; inline
: natural-sort ( seq -- sortedseq ) [ <=> ] sort ;
] any? ; inline recursive
:: count-numbers ( max listener -- )
- 10 iota [ 1 + 1 1 0 max listener (count-numbers) ] any? drop ;
- inline
+ 10 iota [ 1 + 1 1 0 max listener (count-numbers) ] any? drop ; inline
:: beust2-benchmark ( -- )
0 :> i!
IN: benchmark.recursive
: fib ( m -- n )
- dup 2 < [ drop 1 ] [ [ 1 - fib ] [ 2 - fib ] bi + ] if ;
- inline recursive
+ dup 2 <
+ [ drop 1 ]
+ [ [ 1 - fib ] [ 2 - fib ] bi + ] if ; inline recursive
: ack ( m n -- x )
{
drop 516 * 128 + swap 298 * + -8 shift clamp ; inline
: compute-green ( y u v -- g )
- [ [ 298 * ] dip 100 * - ] dip 208 * - 128 + -8 shift clamp ;
- inline
+ [ [ 298 * ] dip 100 * - ] dip 208 * - 128 + -8 shift clamp ; inline
: compute-red ( y u v -- g )
nip 409 * swap 298 * + 128 + -8 shift clamp ; inline
: compute-rgb ( y u v -- b g r )
- [ compute-blue ] [ compute-green ] [ compute-red ] 3tri ;
- inline
+ [ compute-blue ] [ compute-green ] [ compute-red ] 3tri ; inline
: store-rgb ( index rgb b g r -- index )
[ pick 0 + pick set-nth-unsafe ]
dup length [ graded-triple ] with map ;
: graded-laplacian ( generators quot -- seq )
- [ basis graded graded-triples [ first3 ] ] dip compose map ;
- inline
+ [ basis graded graded-triples [ first3 ] ] dip compose map ; inline
: graded-laplacian-betti ( generators -- seq )
[ laplacian-betti ] graded-laplacian ;
: ((each-from)) ( i seq -- n quot )
[ length over [-] swap ] keep '[ _ + _ nth-unsafe ] ; inline
-: (each-from) ( i seq quot -- n quot' ) [ ((each-from)) ] dip compose ;
- inline
+: (each-from) ( i seq quot -- n quot' )
+ [ ((each-from)) ] dip compose ; inline
PRIVATE>