diff --git a/basis/combinators/smart/smart.factor b/basis/combinators/smart/smart.factor index e423bf84f8..cb1b309c86 100644 --- a/basis/combinators/smart/smart.factor +++ b/basis/combinators/smart/smart.factor @@ -4,14 +4,6 @@ USING: accessors fry generalizations kernel macros math.order stack-checker math sequences ; IN: combinators.smart -> length ; - -: outputs ( quot -- n ) infer out>> length ; - -PRIVATE> - MACRO: drop-outputs ( quot -- quot' ) dup outputs '[ @ _ ndrop ] ; diff --git a/basis/compiler/cfg/intrinsics/simd/backend/backend.factor b/basis/compiler/cfg/intrinsics/simd/backend/backend.factor index cf61a560d2..e8b9e3c5de 100644 --- a/basis/compiler/cfg/intrinsics/simd/backend/backend.factor +++ b/basis/compiler/cfg/intrinsics/simd/backend/backend.factor @@ -110,7 +110,7 @@ MACRO: vvvv-vector-op ( trials -- ) blub ; MACRO: can-has-case ( cases -- ) - dup first second infer in>> length 1 + + dup first second inputs 1 + '[ _ ndrop f ] suffix '[ _ case ] ; GENERIC# >can-has-trial 1 ( obj #pick -- quot ) @@ -118,7 +118,7 @@ GENERIC# >can-has-trial 1 ( obj #pick -- quot ) M: callable >can-has-trial drop '[ _ can-has? ] ; M: pair >can-has-trial - swap first2 dup infer in>> length + swap first2 dup inputs '[ _ npick _ instance? [ _ can-has? ] [ _ ndrop blub ] if ] ; MACRO: can-has-vector-op ( trials #pick #dup -- ) diff --git a/basis/inverse/inverse.factor b/basis/inverse/inverse.factor index 383a4aca9b..d112e4e6eb 100644 --- a/basis/inverse/inverse.factor +++ b/basis/inverse/inverse.factor @@ -68,7 +68,7 @@ UNION: explicit-inverse normal-inverse math-inverse pop-inverse ; : enough? ( stack word -- ? ) dup deferred? [ 2drop f ] [ - [ [ length ] [ 1quotation infer in>> length ] bi* >= ] + [ [ length ] [ 1quotation inputs ] bi* >= ] [ 3drop f ] recover ] if ; diff --git a/basis/models/arrow/smart/smart.factor b/basis/models/arrow/smart/smart.factor index c4ad01e52e..7c29310a97 100644 --- a/basis/models/arrow/smart/smart.factor +++ b/basis/models/arrow/smart/smart.factor @@ -1,8 +1,7 @@ ! Copyright (C) 2009, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: models.arrow models.product stack-checker accessors fry -generalizations combinators.smart combinators.smart.private -macros kernel ; +generalizations combinators.smart macros kernel ; IN: models.arrow.smart MACRO: ( quot -- quot' ) diff --git a/basis/roman/roman.factor b/basis/roman/roman.factor index b3c0181ad2..a783e7973c 100644 --- a/basis/roman/roman.factor +++ b/basis/roman/roman.factor @@ -48,7 +48,7 @@ PRIVATE> > length ] [ ] [ infer out>> length ] tri + [ inputs ] [ ] [ outputs ] tri '[ [ roman> ] _ napply @ [ >roman ] _ napply ] ; PRIVATE> diff --git a/basis/stack-checker/stack-checker.factor b/basis/stack-checker/stack-checker.factor index fe52357f9e..12e8660900 100644 --- a/basis/stack-checker/stack-checker.factor +++ b/basis/stack-checker/stack-checker.factor @@ -1,7 +1,8 @@ -! Copyright (C) 2004, 2009 Slava Pestov. +! Copyright (C) 2004, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel io effects namespaces sequences quotations vocabs -vocabs.loader generic words stack-checker.backend stack-checker.state +USING: accessors kernel io effects namespaces sequences +quotations vocabs vocabs.loader generic words +stack-checker.backend stack-checker.state stack-checker.known-words stack-checker.transforms stack-checker.errors stack-checker.inlining stack-checker.visitor.dummy ; @@ -15,3 +16,7 @@ M: callable infer ( quot -- effect ) : infer. ( quot -- ) #! Safe to call from inference transforms. infer effect>string print ; + +: inputs ( quot -- n ) infer in>> length ; + +: outputs ( quot -- n ) infer out>> length ; diff --git a/basis/tuple-arrays/tuple-arrays.factor b/basis/tuple-arrays/tuple-arrays.factor index ce69388ca2..1bc6270524 100644 --- a/basis/tuple-arrays/tuple-arrays.factor +++ b/basis/tuple-arrays/tuple-arrays.factor @@ -10,7 +10,7 @@ IN: tuple-arrays MACRO: boa-unsafe ( class -- quot ) tuple-layout '[ _ ] ; -MACRO: infer-in ( class -- quot ) infer in>> length '[ _ ] ; +MACRO: infer-in ( class -- quot ) inputs '[ _ ] ; : tuple-arity ( class -- quot ) '[ _ boa ] infer-in ; inline diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor index 5217cb4898..e9cb9d5918 100644 --- a/basis/unix/unix.factor +++ b/basis/unix/unix.factor @@ -3,10 +3,9 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.syntax kernel libc sequences continuations byte-arrays strings math namespaces system -combinators combinators.smart combinators.smart.private -vocabs.loader accessors stack-checker macros locals -generalizations unix.types io vocabs classes.struct unix.time -alien.libraries ; +combinators combinators.smart vocabs.loader accessors +stack-checker macros locals generalizations unix.types io vocabs +classes.struct unix.time alien.libraries ; IN: unix CONSTANT: PROT_NONE 0 diff --git a/basis/xml/tests/xmltest.factor b/basis/xml/tests/xmltest.factor index b25eca8d68..2cbc5890b1 100644 --- a/basis/xml/tests/xmltest.factor +++ b/basis/xml/tests/xmltest.factor @@ -21,7 +21,7 @@ TUPLE: xml-test id uri sections description type ; CONSTANT: base "vocab:xml/tests/xmltest/" MACRO: drop-inputs ( quot -- newquot ) - infer in>> length '[ _ ndrop ] ; + inputs '[ _ ndrop ] ; : fails? ( quot -- ? ) [ drop-outputs f ] [ nip drop-inputs t ] bi-curry recover ; inline