generic.single: simplify stack shuffling

db4
Slava Pestov 2009-11-06 04:15:46 -06:00
parent ba31abb301
commit 734f18624c
1 changed files with 5 additions and 6 deletions

View File

@ -63,19 +63,18 @@ TUPLE: predicate-engine class methods ;
C: <predicate-engine> predicate-engine
: push-method ( specializer method atomic assoc -- )
: push-method ( method class atomic assoc -- )
dupd [
[ ] [ H{ } clone <predicate-engine> ] ?if
[ methods>> set-at ] keep
] change-at ;
: flatten-method ( class method assoc -- )
[ [ flatten-class keys ] keep ] 2dip [
[ swap rot ] dip push-method
] 3curry each ;
: flatten-method ( method class assoc -- )
over flatten-class keys
[ swap push-method ] with with with each ;
: flatten-methods ( assoc -- assoc' )
H{ } clone [ [ flatten-method ] curry assoc-each ] keep ;
H{ } clone [ [ swapd flatten-method ] curry assoc-each ] keep ;
! 2. Convert methods
: split-methods ( assoc class -- first second )