core: rename some double paren words.
parent
9db94d33d6
commit
20aadd5688
|
@ -242,7 +242,7 @@ M: anonymous-complement (classes-intersect?)
|
|||
: anonymous-union-or ( first second -- class )
|
||||
members>> swap suffix <anonymous-union> ;
|
||||
|
||||
: ((class-or)) ( first second -- class )
|
||||
: classes>anonymous-union ( first second -- class )
|
||||
[ normalize-class ] bi@ {
|
||||
{ [ dup anonymous-union? ] [ anonymous-union-or ] }
|
||||
{ [ over anonymous-union? ] [ swap anonymous-union-or ] }
|
||||
|
@ -250,7 +250,7 @@ M: anonymous-complement (classes-intersect?)
|
|||
} cond ;
|
||||
|
||||
: anonymous-complement-or ( first second -- class )
|
||||
2dup class>> swap class<= [ 2drop object ] [ ((class-or)) ] if ;
|
||||
2dup class>> swap class<= [ 2drop object ] [ classes>anonymous-union ] if ;
|
||||
|
||||
: (class-or) ( first second -- class )
|
||||
2dup compare-classes {
|
||||
|
@ -261,7 +261,7 @@ M: anonymous-complement (classes-intersect?)
|
|||
{
|
||||
{ [ dup anonymous-complement? ] [ anonymous-complement-or ] }
|
||||
{ [ over anonymous-complement? ] [ swap anonymous-complement-or ] }
|
||||
[ ((class-or)) ]
|
||||
[ classes>anonymous-union ]
|
||||
} cond
|
||||
] }
|
||||
} case ;
|
||||
|
|
|
@ -86,7 +86,7 @@ TUPLE: float-parse
|
|||
: ?store-exponent ( float-parse n expt/f -- float-parse' n/f )
|
||||
[ store-exponent ] [ drop f ] if* ; inline
|
||||
|
||||
: ((pow)) ( base x -- base^x )
|
||||
: pow-until ( base x -- base^x )
|
||||
[ 1 ] 2dip
|
||||
[ dup zero? ] [
|
||||
dup odd? [ [ [ * ] keep ] [ 1 - ] bi* ] when
|
||||
|
@ -95,7 +95,7 @@ TUPLE: float-parse
|
|||
|
||||
: (pow) ( base x -- base^x )
|
||||
integer>fixnum-strict
|
||||
dup 0 >= [ ((pow)) ] [ [ recip ] [ neg ] bi* ((pow)) ] if ; inline
|
||||
dup 0 >= [ pow-until ] [ [ recip ] [ neg ] bi* pow-until ] if ; inline
|
||||
|
||||
: add-mantissa-digit ( float-parse i number-parse n digit quot -- float-parse' n/f )
|
||||
[ (add-digit)
|
||||
|
|
|
@ -290,13 +290,13 @@ TUPLE: copy-state
|
|||
|
||||
C: <copy> copy-state
|
||||
|
||||
: ((copy)) ( n copy -- )
|
||||
: copy-nth-unsafe ( n copy -- )
|
||||
[ [ src-i>> + ] [ src>> ] bi nth-unsafe ]
|
||||
[ [ dst-i>> + ] [ dst>> ] bi set-nth-unsafe ] 2bi ; inline
|
||||
|
||||
: (copy) ( n copy -- dst )
|
||||
over 0 <= [ nip dst>> ] [
|
||||
[ 1 - ] dip [ ((copy)) ] [ (copy) ] 2bi
|
||||
[ 1 - ] dip [ copy-nth-unsafe ] [ (copy) ] 2bi
|
||||
] if ; inline recursive
|
||||
|
||||
: subseq>copy ( from to seq -- n copy )
|
||||
|
@ -382,14 +382,14 @@ PRIVATE>
|
|||
|
||||
<PRIVATE
|
||||
|
||||
: ((each)) ( seq -- n quot )
|
||||
: (setup-each) ( seq -- n quot )
|
||||
[ length check-length ] keep [ nth-unsafe ] curry ; inline
|
||||
|
||||
: (each) ( seq quot -- n quot' )
|
||||
[ ((each)) ] dip compose ; inline
|
||||
: setup-each ( seq quot -- n quot' )
|
||||
[ (setup-each) ] dip compose ; inline
|
||||
|
||||
: (each-index) ( seq quot -- n quot' )
|
||||
[ ((each)) [ keep ] curry ] dip compose ; inline
|
||||
[ (setup-each) [ keep ] curry ] dip compose ; inline
|
||||
|
||||
: (collect) ( quot into -- quot' )
|
||||
[ [ keep ] dip set-nth-unsafe ] 2curry ; inline
|
||||
|
@ -398,16 +398,16 @@ PRIVATE>
|
|||
(collect) each-integer ; inline
|
||||
|
||||
: map-into ( seq quot into -- )
|
||||
[ (each) ] dip collect ; inline
|
||||
[ setup-each ] dip collect ; inline
|
||||
|
||||
: 2nth-unsafe ( n seq1 seq2 -- elt1 elt2 )
|
||||
[ nth-unsafe ] bi-curry@ bi ; inline
|
||||
|
||||
: ((2each)) ( seq1 seq2 -- n quot )
|
||||
: setup-2each ( seq1 seq2 -- n quot )
|
||||
[ min-length check-length ] 2keep [ 2nth-unsafe ] 2curry ; inline
|
||||
|
||||
: (2each) ( seq1 seq2 quot -- n quot' )
|
||||
[ ((2each)) ] dip compose ; inline
|
||||
[ setup-2each ] dip compose ; inline
|
||||
|
||||
: 3nth-unsafe ( n seq1 seq2 seq3 -- elt1 elt2 elt3 )
|
||||
[ nth-unsafe ] tri-curry@ tri ; inline
|
||||
|
@ -422,7 +422,7 @@ PRIVATE>
|
|||
over [ dupd nth-unsafe ] [ drop f ] if ; inline
|
||||
|
||||
: (find) ( seq quot quot' -- i elt )
|
||||
pick [ [ (each) ] dip call ] dip finish-find ; inline
|
||||
pick [ [ setup-each ] dip call ] dip finish-find ; inline
|
||||
|
||||
: (find-from) ( n seq quot quot' -- i elt )
|
||||
[ 2dup bounds-check? ] 2dip
|
||||
|
@ -448,10 +448,10 @@ PRIVATE>
|
|||
PRIVATE>
|
||||
|
||||
: each ( ... seq quot: ( ... x -- ... ) -- ... )
|
||||
(each) each-integer ; inline
|
||||
setup-each each-integer ; inline
|
||||
|
||||
: each-from ( ... seq quot: ( ... x -- ... ) i -- ... )
|
||||
-rot (each) (each-integer) ; inline
|
||||
-rot setup-each (each-integer) ; inline
|
||||
|
||||
: reduce ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... result )
|
||||
swapd each ; inline
|
||||
|
@ -460,7 +460,7 @@ PRIVATE>
|
|||
[ over ] dip [ [ collect ] keep ] new-like ; inline
|
||||
|
||||
: map-as ( ... seq quot: ( ... elt -- ... newelt ) exemplar -- ... newseq )
|
||||
[ (each) ] dip map-integers ; inline
|
||||
[ setup-each ] dip map-integers ; inline
|
||||
|
||||
: map ( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )
|
||||
over map-as ; inline
|
||||
|
@ -538,7 +538,7 @@ PRIVATE>
|
|||
[ find-integer ] (find-index) ; inline
|
||||
|
||||
: all? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
|
||||
(each) all-integers? ; inline
|
||||
setup-each all-integers? ; inline
|
||||
|
||||
: push-if ( ..a elt quot: ( ..a elt -- ..b ? ) accum -- ..b )
|
||||
[ keep ] dip rot [ push ] [ 2drop ] if ; inline
|
||||
|
@ -1106,7 +1106,7 @@ PRIVATE>
|
|||
: generic-flip ( matrix -- newmatrix )
|
||||
[
|
||||
[ first-unsafe length 1 ] keep
|
||||
[ length min ] (each) (each-integer) iota
|
||||
[ length min ] setup-each (each-integer) iota
|
||||
] keep
|
||||
[ [ nth-unsafe ] with { } map-as ] curry { } map-as ; inline
|
||||
|
||||
|
@ -1119,7 +1119,7 @@ USE: arrays
|
|||
{ array } declare
|
||||
[
|
||||
[ first-unsafe array-length 1 ] keep
|
||||
[ array-length min ] (each) (each-integer) iota
|
||||
[ array-length min ] setup-each (each-integer) iota
|
||||
] keep
|
||||
[ [ { array } declare array-nth ] with { } map-as ] curry { } map-as ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue