inverse: minor cleanup.
parent
a07b411834
commit
465e6478ab
|
@ -35,13 +35,10 @@ M: fail summary drop "Matching failed" ;
|
||||||
ERROR: bad-math-inverse ;
|
ERROR: bad-math-inverse ;
|
||||||
|
|
||||||
: next ( revquot -- revquot* first )
|
: next ( revquot -- revquot* first )
|
||||||
[ bad-math-inverse ]
|
[ bad-math-inverse ] [ unclip-slice ] if-empty ;
|
||||||
[ unclip-slice ] if-empty ;
|
|
||||||
|
|
||||||
: constant-word? ( word -- ? )
|
: constant-word? ( word -- ? )
|
||||||
stack-effect
|
stack-effect [ out>> length 1 = ] [ in>> empty? ] bi and ;
|
||||||
[ out>> length 1 = ]
|
|
||||||
[ in>> empty? ] bi and ;
|
|
||||||
|
|
||||||
: assure-constant ( constant -- quot )
|
: assure-constant ( constant -- quot )
|
||||||
dup word? [ bad-math-inverse ] when 1quotation ;
|
dup word? [ bad-math-inverse ] when 1quotation ;
|
||||||
|
@ -158,6 +155,7 @@ ERROR: missing-literal ;
|
||||||
dup
|
dup
|
||||||
[ word? ] [ symbol? not ] bi and
|
[ word? ] [ symbol? not ] bi and
|
||||||
[ missing-literal ] when ;
|
[ missing-literal ] when ;
|
||||||
|
|
||||||
\ + [ - ] [ - ] define-math-inverse
|
\ + [ - ] [ - ] define-math-inverse
|
||||||
\ - [ + ] [ - ] define-math-inverse
|
\ - [ + ] [ - ] define-math-inverse
|
||||||
\ * [ / ] [ / ] define-math-inverse
|
\ * [ / ] [ / ] define-math-inverse
|
||||||
|
@ -175,6 +173,7 @@ DEFER: __
|
||||||
|
|
||||||
: both ( object object -- object )
|
: both ( object object -- object )
|
||||||
dupd assert= ;
|
dupd assert= ;
|
||||||
|
|
||||||
\ both [ dup ] define-inverse
|
\ both [ dup ] define-inverse
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -277,6 +276,7 @@ DEFER: __
|
||||||
MACRO: matches? ( quot -- quot' ) [matches?] ;
|
MACRO: matches? ( quot -- quot' ) [matches?] ;
|
||||||
|
|
||||||
ERROR: no-match ;
|
ERROR: no-match ;
|
||||||
|
|
||||||
M: no-match summary drop "Fall through in switch" ;
|
M: no-match summary drop "Fall through in switch" ;
|
||||||
|
|
||||||
: recover-chain ( seq -- quot )
|
: recover-chain ( seq -- quot )
|
||||||
|
|
Loading…
Reference in New Issue