core: rename some double paren words.

locals-and-roots
Doug Coleman 2016-03-25 03:00:54 -07:00
parent 9db94d33d6
commit 20aadd5688
3 changed files with 21 additions and 21 deletions

View File

@ -242,7 +242,7 @@ M: anonymous-complement (classes-intersect?)
: anonymous-union-or ( first second -- class ) : anonymous-union-or ( first second -- class )
members>> swap suffix <anonymous-union> ; members>> swap suffix <anonymous-union> ;
: ((class-or)) ( first second -- class ) : classes>anonymous-union ( first second -- class )
[ normalize-class ] bi@ { [ normalize-class ] bi@ {
{ [ dup anonymous-union? ] [ anonymous-union-or ] } { [ dup anonymous-union? ] [ anonymous-union-or ] }
{ [ over anonymous-union? ] [ swap anonymous-union-or ] } { [ over anonymous-union? ] [ swap anonymous-union-or ] }
@ -250,7 +250,7 @@ M: anonymous-complement (classes-intersect?)
} cond ; } cond ;
: anonymous-complement-or ( first second -- class ) : 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 ) : (class-or) ( first second -- class )
2dup compare-classes { 2dup compare-classes {
@ -261,7 +261,7 @@ M: anonymous-complement (classes-intersect?)
{ {
{ [ dup anonymous-complement? ] [ anonymous-complement-or ] } { [ dup anonymous-complement? ] [ anonymous-complement-or ] }
{ [ over anonymous-complement? ] [ swap anonymous-complement-or ] } { [ over anonymous-complement? ] [ swap anonymous-complement-or ] }
[ ((class-or)) ] [ classes>anonymous-union ]
} cond } cond
] } ] }
} case ; } case ;

View File

@ -86,7 +86,7 @@ TUPLE: float-parse
: ?store-exponent ( float-parse n expt/f -- float-parse' n/f ) : ?store-exponent ( float-parse n expt/f -- float-parse' n/f )
[ store-exponent ] [ drop f ] if* ; inline [ store-exponent ] [ drop f ] if* ; inline
: ((pow)) ( base x -- base^x ) : pow-until ( base x -- base^x )
[ 1 ] 2dip [ 1 ] 2dip
[ dup zero? ] [ [ dup zero? ] [
dup odd? [ [ [ * ] keep ] [ 1 - ] bi* ] when dup odd? [ [ [ * ] keep ] [ 1 - ] bi* ] when
@ -95,7 +95,7 @@ TUPLE: float-parse
: (pow) ( base x -- base^x ) : (pow) ( base x -- base^x )
integer>fixnum-strict 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-mantissa-digit ( float-parse i number-parse n digit quot -- float-parse' n/f )
[ (add-digit) [ (add-digit)

View File

@ -290,13 +290,13 @@ TUPLE: copy-state
C: <copy> copy-state C: <copy> copy-state
: ((copy)) ( n copy -- ) : copy-nth-unsafe ( n copy -- )
[ [ src-i>> + ] [ src>> ] bi nth-unsafe ] [ [ src-i>> + ] [ src>> ] bi nth-unsafe ]
[ [ dst-i>> + ] [ dst>> ] bi set-nth-unsafe ] 2bi ; inline [ [ dst-i>> + ] [ dst>> ] bi set-nth-unsafe ] 2bi ; inline
: (copy) ( n copy -- dst ) : (copy) ( n copy -- dst )
over 0 <= [ nip dst>> ] [ over 0 <= [ nip dst>> ] [
[ 1 - ] dip [ ((copy)) ] [ (copy) ] 2bi [ 1 - ] dip [ copy-nth-unsafe ] [ (copy) ] 2bi
] if ; inline recursive ] if ; inline recursive
: subseq>copy ( from to seq -- n copy ) : subseq>copy ( from to seq -- n copy )
@ -382,14 +382,14 @@ PRIVATE>
<PRIVATE <PRIVATE
: ((each)) ( seq -- n quot ) : (setup-each) ( seq -- n quot )
[ length check-length ] keep [ nth-unsafe ] curry ; inline [ length check-length ] keep [ nth-unsafe ] curry ; inline
: (each) ( seq quot -- n quot' ) : setup-each ( seq quot -- n quot' )
[ ((each)) ] dip compose ; inline [ (setup-each) ] dip compose ; inline
: (each-index) ( seq quot -- n quot' ) : (each-index) ( seq quot -- n quot' )
[ ((each)) [ keep ] curry ] dip compose ; inline [ (setup-each) [ keep ] curry ] dip compose ; inline
: (collect) ( quot into -- quot' ) : (collect) ( quot into -- quot' )
[ [ keep ] dip set-nth-unsafe ] 2curry ; inline [ [ keep ] dip set-nth-unsafe ] 2curry ; inline
@ -398,16 +398,16 @@ PRIVATE>
(collect) each-integer ; inline (collect) each-integer ; inline
: map-into ( seq quot into -- ) : map-into ( seq quot into -- )
[ (each) ] dip collect ; inline [ setup-each ] dip collect ; inline
: 2nth-unsafe ( n seq1 seq2 -- elt1 elt2 ) : 2nth-unsafe ( n seq1 seq2 -- elt1 elt2 )
[ nth-unsafe ] bi-curry@ bi ; inline [ 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 [ min-length check-length ] 2keep [ 2nth-unsafe ] 2curry ; inline
: (2each) ( seq1 seq2 quot -- n quot' ) : (2each) ( seq1 seq2 quot -- n quot' )
[ ((2each)) ] dip compose ; inline [ setup-2each ] dip compose ; inline
: 3nth-unsafe ( n seq1 seq2 seq3 -- elt1 elt2 elt3 ) : 3nth-unsafe ( n seq1 seq2 seq3 -- elt1 elt2 elt3 )
[ nth-unsafe ] tri-curry@ tri ; inline [ nth-unsafe ] tri-curry@ tri ; inline
@ -422,7 +422,7 @@ PRIVATE>
over [ dupd nth-unsafe ] [ drop f ] if ; inline over [ dupd nth-unsafe ] [ drop f ] if ; inline
: (find) ( seq quot quot' -- i elt ) : (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 ) : (find-from) ( n seq quot quot' -- i elt )
[ 2dup bounds-check? ] 2dip [ 2dup bounds-check? ] 2dip
@ -448,10 +448,10 @@ PRIVATE>
PRIVATE> PRIVATE>
: each ( ... seq quot: ( ... x -- ... ) -- ... ) : each ( ... seq quot: ( ... x -- ... ) -- ... )
(each) each-integer ; inline setup-each each-integer ; inline
: each-from ( ... seq quot: ( ... x -- ... ) i -- ... ) : 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 ) : reduce ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... result )
swapd each ; inline swapd each ; inline
@ -460,7 +460,7 @@ PRIVATE>
[ over ] dip [ [ collect ] keep ] new-like ; inline [ over ] dip [ [ collect ] keep ] new-like ; inline
: map-as ( ... seq quot: ( ... elt -- ... newelt ) exemplar -- ... newseq ) : 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 ) : map ( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )
over map-as ; inline over map-as ; inline
@ -538,7 +538,7 @@ PRIVATE>
[ find-integer ] (find-index) ; inline [ find-integer ] (find-index) ; inline
: all? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? ) : all? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
(each) all-integers? ; inline setup-each all-integers? ; inline
: push-if ( ..a elt quot: ( ..a elt -- ..b ? ) accum -- ..b ) : push-if ( ..a elt quot: ( ..a elt -- ..b ? ) accum -- ..b )
[ keep ] dip rot [ push ] [ 2drop ] if ; inline [ keep ] dip rot [ push ] [ 2drop ] if ; inline
@ -1106,7 +1106,7 @@ PRIVATE>
: generic-flip ( matrix -- newmatrix ) : generic-flip ( matrix -- newmatrix )
[ [
[ first-unsafe length 1 ] keep [ first-unsafe length 1 ] keep
[ length min ] (each) (each-integer) iota [ length min ] setup-each (each-integer) iota
] keep ] keep
[ [ nth-unsafe ] with { } map-as ] curry { } map-as ; inline [ [ nth-unsafe ] with { } map-as ] curry { } map-as ; inline
@ -1119,7 +1119,7 @@ USE: arrays
{ array } declare { array } declare
[ [
[ first-unsafe array-length 1 ] keep [ first-unsafe array-length 1 ] keep
[ array-length min ] (each) (each-integer) iota [ array-length min ] setup-each (each-integer) iota
] keep ] keep
[ [ { array } declare array-nth ] with { } map-as ] curry { } map-as ; [ [ { array } declare array-nth ] with { } map-as ] curry { } map-as ;