]> gitweb.factorcode.org Git - factor.git/commitdiff
stack-checker: add inputs and outputs words, since 'infer (in>>|out>>) length' was...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 14 Jan 2010 19:04:14 +0000 (08:04 +1300)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 14 Jan 2010 19:04:14 +0000 (08:04 +1300)
basis/combinators/smart/smart.factor
basis/compiler/cfg/intrinsics/simd/backend/backend.factor
basis/inverse/inverse.factor
basis/models/arrow/smart/smart.factor
basis/roman/roman.factor
basis/stack-checker/stack-checker.factor
basis/tuple-arrays/tuple-arrays.factor
basis/unix/unix.factor
basis/xml/tests/xmltest.factor

index e423bf84f8682291f3ae2fc883333fdfdfbb81e7..cb1b309c86ebccc34cbc9bb0ef0ab9b6e75a9b52 100644 (file)
@@ -4,14 +4,6 @@ USING: accessors fry generalizations kernel macros math.order
 stack-checker math sequences ;
 IN: combinators.smart
 
-<PRIVATE
-
-: inputs ( quot -- n ) infer in>> length ;
-
-: outputs ( quot -- n ) infer out>> length ;
-
-PRIVATE>
-
 MACRO: drop-outputs ( quot -- quot' )
     dup outputs '[ @ _ ndrop ] ;
 
index cf61a560d240089c85760b33c0d38f4ea1a6e18c..e8b9e3c5de3bc2abfc31138d76c16991815faf1d 100644 (file)
@@ -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 -- )
index 383a4aca9bc3a95d52cda9fb88eb840b08ce4f37..d112e4e6ebd6e3b31374b0233c4ddfd3a4fa0fcd 100644 (file)
@@ -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 ;
 
index c4ad01e52e09d60d64eeed12bc0a1b3a6a2d1bf4..7c29310a97716c9764422170e19e8f58cd37aac2 100644 (file)
@@ -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: <smart-arrow> ( quot -- quot' )
index b3c0181ad2399532ec710490898605b1afd1e97e..a783e7973c3193f1eb120a7381a967baaa125ff6 100644 (file)
@@ -48,7 +48,7 @@ PRIVATE>
 <PRIVATE
 
 MACRO: binary-roman-op ( quot -- quot' )
-    [ infer in>> length ] [ ] [ infer out>> length ] tri
+    [ inputs ] [ ] [ outputs ] tri
     '[ [ roman> ] _ napply @ [ >roman ] _ napply ] ;
 
 PRIVATE>
index fe52357f9ef95d7e9654bd7c796daeb50a61bbc7..12e86609004c992de19e056ff95352967b4d18df 100644 (file)
@@ -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 ;
index ce69388ca2f5f1ebcf2ba163ee9531654ab1843f..1bc62705247606841eb01af36b34cc9593d375fe 100644 (file)
@@ -10,7 +10,7 @@ IN: tuple-arrays
 
 MACRO: boa-unsafe ( class -- quot ) tuple-layout '[ _ <tuple-boa> ] ;
 
-MACRO: infer-in ( class -- quot ) infer in>> length '[ _ ] ;
+MACRO: infer-in ( class -- quot ) inputs '[ _ ] ;
 
 : tuple-arity ( class -- quot ) '[ _ boa ] infer-in ; inline
 
index 5217cb48984f705d9a9d30c0578a07ff93ff79b1..e9cb9d59188aca5fc0ab8a95a883df54fffe770f 100644 (file)
@@ -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
index b25eca8d68cb6582d4601fdc8d289b8d3244296f..2cbc5890b16da57b5239cb54b7918889532f6da1 100644 (file)
@@ -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