]> gitweb.factorcode.org Git - factor.git/commitdiff
models.combinators: move weird reduce* word here
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 1 Sep 2023 22:52:16 +0000 (15:52 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 1 Sep 2023 22:52:16 +0000 (15:52 -0700)
extra/models/combinators/combinators.factor
extra/sequences/extras/extras.factor

index 11e94ed3c68f416c5d989608bc733f1d1908d602..3ff4d98fee7d279195c7989981acd01ac73f9d64 100644 (file)
@@ -30,6 +30,15 @@ M: filter-model (model-changed) [ value>> ] dip 2dup quot>> call( a -- ? )
    [ set-model ] [ 2drop ] if ;
 : filter-model ( model quot -- filter-model ) [ 1array \ filter-model <multi-model> ] dip >>quot ;
 
+<PRIVATE
+! Quot must have static stack effect, unlike "reduce"
+:: reduce* ( seq identity quot: ( prev elt -- next ) -- result )
+    seq [ identity ] [
+        unclip identity swap quot call( prev elt -- next )
+        quot reduce*
+    ] if-empty ; inline recursive
+PRIVATE>
+
 TUPLE: fold-model < multi-model quot base values ;
 M: fold-model (model-changed) 2dup base>> =
     [ [ [ value>> ] [ [ values>> ] [ quot>> ] bi ] bi* swapd reduce* ] keep set-model ]
index e2e6250c792d2a2b563ee0459830c50205e8240f..e6f24f60427846fce81e69bae380ceb059e0888f 100644 (file)
@@ -4,13 +4,6 @@ math.order ranges sequences sequences.private sets shuffle
 sorting splitting vectors ;
 IN: sequences.extras
 
-! Quot must have static stack effect, unlike "reduce"
-:: reduce* ( seq identity quot: ( prev elt -- next ) -- result )
-    seq [ identity ] [
-        unclip identity swap quot call( prev elt -- next )
-        quot reduce*
-    ] if-empty ; inline recursive
-
 : find-all ( ... seq quot: ( ... elt -- ... ? ) -- ... elts )
     [ <enumerated> ] dip '[ nip @ ] assoc-filter ; inline