combinators.smart: Fix infer-known; should be 100% now.

It's stack-checker bugs all the way down.
db4
Doug Coleman 2011-11-28 20:54:17 -08:00
parent c1a49e69c8
commit cde3c043bf
2 changed files with 12 additions and 5 deletions

View File

@ -82,3 +82,7 @@ IN: combinators.smart.tests
:: map-reduce-test ( a b c -- d ) [ a b c ] [ a - ] [ b * + ] map-reduce-outputs ;
[ ] [ 1 2 3 map-reduce-test ] unit-test
[ ( x x -- x ) ] [ [ curry inputs ] infer ] unit-test
[ ( x -- x ) ] [ [ [ curry ] curry inputs ] infer ] unit-test

View File

@ -30,19 +30,22 @@ GENERIC: infer-known* ( known -- effect )
] if*
] "special" set-word-prop
! TODO: Handle the case where a nested call to infer-known returns f
M: curried infer-known*
quot>> infer-known curry-effect ;
quot>> infer-known dup [
curry-effect
] [
drop f
] if ;
M: composed infer-known*
[ quot1>> ] [ quot2>> ] bi
[ infer-known ] bi@ compose-effects ;
[ infer-known ] bi@
2dup and [ compose-effects ] [ 2drop f ] if ;
M: declared-effect infer-known*
known>> infer-known* ;
M: input-parameter infer-known* \ inputs/outputs unknown-macro-input ;
M: input-parameter infer-known* drop f ;
M: object infer-known* drop f ;