factor: Rename [curry] -> currier, remove some [foo] words.
The [foo] convention is not descriptive and looks like special syntax.modern-harvey2
parent
fad9e9d002
commit
2920d2ee71
|
@ -124,11 +124,11 @@ MACRO: if-literals-match ( quots -- quot )
|
|||
] [ 2drop bad-simd-intrinsic ] if
|
||||
] ;
|
||||
|
||||
CONSTANT: [unary] [ ds-drop ds-pop ]
|
||||
CONSTANT: [unary/param] [ [ -2 <ds-loc> inc-stack ds-pop ] dip ]
|
||||
CONSTANT: [binary] [ ds-drop 2inputs ]
|
||||
CONSTANT: [binary/param] [ [ -2 <ds-loc> inc-stack 2inputs ] dip ]
|
||||
CONSTANT: [quaternary]
|
||||
CONSTANT: unary [ ds-drop ds-pop ]
|
||||
CONSTANT: unary/param [ [ -2 <ds-loc> inc-stack ds-pop ] dip ]
|
||||
CONSTANT: binary [ ds-drop 2inputs ]
|
||||
CONSTANT: binary/param [ [ -2 <ds-loc> inc-stack 2inputs ] dip ]
|
||||
CONSTANT: quaternary
|
||||
[
|
||||
ds-drop
|
||||
D: 3 peek-loc
|
||||
|
@ -138,20 +138,20 @@ CONSTANT: [quaternary]
|
|||
-4 <ds-loc> inc-stack
|
||||
]
|
||||
|
||||
:: [emit-vector-op] ( trials params-quot op-quot literal-preds -- quot )
|
||||
:: emit-vector-op ( trials params-quot op-quot literal-preds -- quot )
|
||||
params-quot trials op-quot literal-preds
|
||||
'[ [ _ dip _ @ ds-push ] _ if-literals-match ] ;
|
||||
|
||||
MACRO: emit-v-vector-op ( trials -- quot )
|
||||
[unary] [ v-vector-op ] { [ representation? ] } [emit-vector-op] ;
|
||||
unary [ v-vector-op ] { [ representation? ] } emit-vector-op ;
|
||||
MACRO: emit-vl-vector-op ( trials literal-pred -- quot )
|
||||
[ [unary/param] [ vl-vector-op ] { [ representation? ] } ] dip prefix [emit-vector-op] ;
|
||||
[ unary/param [ vl-vector-op ] { [ representation? ] } ] dip prefix emit-vector-op ;
|
||||
MACRO: emit-vv-vector-op ( trials -- quot )
|
||||
[binary] [ vv-vector-op ] { [ representation? ] } [emit-vector-op] ;
|
||||
binary [ vv-vector-op ] { [ representation? ] } emit-vector-op ;
|
||||
MACRO: emit-vvl-vector-op ( trials literal-pred -- quot )
|
||||
[ [binary/param] [ vvl-vector-op ] { [ representation? ] } ] dip prefix [emit-vector-op] ;
|
||||
[ binary/param [ vvl-vector-op ] { [ representation? ] } ] dip prefix emit-vector-op ;
|
||||
MACRO: emit-vvvv-vector-op ( trials -- quot )
|
||||
[quaternary] [ vvvv-vector-op ] { [ representation? ] } [emit-vector-op] ;
|
||||
quaternary [ vvvv-vector-op ] { [ representation? ] } emit-vector-op ;
|
||||
|
||||
MACRO:: emit-vv-or-vl-vector-op ( var-trials imm-trials literal-pred -- quot )
|
||||
literal-pred imm-trials literal-pred var-trials
|
||||
|
|
|
@ -110,13 +110,13 @@ MACRO: cleave* ( n -- quot )
|
|||
[ nip dupn ] [ nspread* ] 2bi ; inline
|
||||
|
||||
: apply-curry ( a... quot n -- )
|
||||
[ [curry] ] dip napply ; inline
|
||||
[ currier ] dip napply ; inline
|
||||
|
||||
: cleave-curry ( a quot... n -- )
|
||||
[ [curry] ] swap [ napply ] [ cleave* ] bi ; inline
|
||||
[ currier ] swap [ napply ] [ cleave* ] bi ; inline
|
||||
|
||||
: spread-curry ( a... quot... n -- )
|
||||
[ [curry] ] swap [ napply ] [ spread* ] bi ; inline
|
||||
[ currier ] swap [ napply ] [ spread* ] bi ; inline
|
||||
|
||||
MACRO: mnswap ( m n -- quot )
|
||||
1 + '[ _ -nrot ] swap '[ _ _ napply ] ;
|
||||
|
|
|
@ -196,21 +196,21 @@ DEFER: if
|
|||
! Curried cleavers
|
||||
<PRIVATE
|
||||
|
||||
: [curry] ( quot -- quot' ) [ curry ] curry ; inline
|
||||
: currier ( quot -- quot' ) [ curry ] curry ; inline
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: bi-curry ( x p q -- p' q' ) [ [curry] ] bi@ bi ; inline
|
||||
: bi-curry ( x p q -- p' q' ) [ currier ] bi@ bi ; inline
|
||||
|
||||
: tri-curry ( x p q r -- p' q' r' ) [ [curry] ] tri@ tri ; inline
|
||||
: tri-curry ( x p q r -- p' q' r' ) [ currier ] tri@ tri ; inline
|
||||
|
||||
: bi-curry* ( x y p q -- p' q' ) [ [curry] ] bi@ bi* ; inline
|
||||
: bi-curry* ( x y p q -- p' q' ) [ currier ] bi@ bi* ; inline
|
||||
|
||||
: tri-curry* ( x y z p q r -- p' q' r' ) [ [curry] ] tri@ tri* ; inline
|
||||
: tri-curry* ( x y z p q r -- p' q' r' ) [ currier ] tri@ tri* ; inline
|
||||
|
||||
: bi-curry@ ( x y q -- p' q' ) [curry] bi@ ; inline
|
||||
: bi-curry@ ( x y q -- p' q' ) currier bi@ ; inline
|
||||
|
||||
: tri-curry@ ( x y z q -- p' q' r' ) [curry] tri@ ; inline
|
||||
: tri-curry@ ( x y z q -- p' q' r' ) currier tri@ ; inline
|
||||
|
||||
! Booleans
|
||||
UNION: boolean POSTPONE: t POSTPONE: f ;
|
||||
|
|
Loading…
Reference in New Issue