generic.single: simplify stack shuffling
parent
ba31abb301
commit
734f18624c
|
@ -63,19 +63,18 @@ TUPLE: predicate-engine class methods ;
|
||||||
|
|
||||||
C: <predicate-engine> predicate-engine
|
C: <predicate-engine> predicate-engine
|
||||||
|
|
||||||
: push-method ( specializer method atomic assoc -- )
|
: push-method ( method class atomic assoc -- )
|
||||||
dupd [
|
dupd [
|
||||||
[ ] [ H{ } clone <predicate-engine> ] ?if
|
[ ] [ H{ } clone <predicate-engine> ] ?if
|
||||||
[ methods>> set-at ] keep
|
[ methods>> set-at ] keep
|
||||||
] change-at ;
|
] change-at ;
|
||||||
|
|
||||||
: flatten-method ( class method assoc -- )
|
: flatten-method ( method class assoc -- )
|
||||||
[ [ flatten-class keys ] keep ] 2dip [
|
over flatten-class keys
|
||||||
[ swap rot ] dip push-method
|
[ swap push-method ] with with with each ;
|
||||||
] 3curry each ;
|
|
||||||
|
|
||||||
: flatten-methods ( assoc -- assoc' )
|
: flatten-methods ( assoc -- assoc' )
|
||||||
H{ } clone [ [ flatten-method ] curry assoc-each ] keep ;
|
H{ } clone [ [ swapd flatten-method ] curry assoc-each ] keep ;
|
||||||
|
|
||||||
! 2. Convert methods
|
! 2. Convert methods
|
||||||
: split-methods ( assoc class -- first second )
|
: split-methods ( assoc class -- first second )
|
||||||
|
|
Loading…
Reference in New Issue