inverse: [ \ + ] fold was incorrectly evaluating to [ + ]
parent
367ec5de93
commit
24d854fb8e
|
@ -83,3 +83,9 @@ C: <nil> nil
|
|||
[ [ sqrt ] ] [ [ sq ] [undo] ] unit-test
|
||||
[ [ not ] ] [ [ not ] [undo] ] unit-test
|
||||
[ { 3 2 1 } ] [ { 1 2 3 } [ reverse ] undo ] unit-test
|
||||
|
||||
TUPLE: funny-tuple ;
|
||||
: <funny-tuple> ( -- funny-tuple ) \ funny-tuple boa ;
|
||||
: funny-tuple ( -- ) "OOPS" throw ;
|
||||
|
||||
[ ] [ [ <funny-tuple> ] [undo] drop ] unit-test
|
|
@ -74,7 +74,9 @@ UNION: explicit-inverse normal-inverse math-inverse pop-inverse ;
|
|||
|
||||
: fold-word ( stack word -- stack )
|
||||
2dup enough?
|
||||
[ 1quotation with-datastack ] [ [ % ] [ , ] bi* { } ] if ;
|
||||
[ 1quotation with-datastack ]
|
||||
[ [ [ literalize , ] each ] [ , ] bi* { } ]
|
||||
if ;
|
||||
|
||||
: fold ( quot -- folded-quot )
|
||||
[ { } [ fold-word ] reduce % ] [ ] make ;
|
||||
|
@ -217,9 +219,7 @@ DEFER: _
|
|||
"predicate" word-prop [ dupd call assure ] curry ;
|
||||
|
||||
: slot-readers ( class -- quot )
|
||||
all-slots
|
||||
[ name>> reader-word 1quotation [ keep ] curry ] map concat
|
||||
[ ] like [ drop ] compose ;
|
||||
all-slots [ name>> reader-word 1quotation ] map [ cleave ] curry ;
|
||||
|
||||
: ?wrapped ( object -- wrapped )
|
||||
dup wrapper? [ wrapped>> ] when ;
|
||||
|
|
Loading…
Reference in New Issue