Skip to content

Commit

Permalink
core/basis/extra: update some stack effects
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jan 31, 2024
1 parent 745f921 commit 7a97442
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion basis/math/primes/erato/fast/fast.factor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CONSTANT: wheel-2-3-5-7 $[
] B{ } filter-as differences
]

:: each-prime ( upto sieve quot -- )
:: each-prime ( ... upto sieve quot: ( ... n -- ... ) -- ... )
11 upto integer>fixnum-strict '[ dup _ <= ] [
wheel-2-3-5-7 [
over dup 2/ sieve nth-unsafe [ drop ] quot if
Expand Down
6 changes: 3 additions & 3 deletions basis/ui/gadgets/gadgets-docs.factor
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ HELP: max-dims
{ pref-dims max-dims sum-dims } related-words

HELP: each-child
{ $values { "gadget" gadget } { "quot" { $quotation ( child -- ) } } }
{ $values { "gadget" gadget } { "quot" { $quotation ( ... child -- ... ) } } }
{ $description "Applies the quotation to each child of the gadget." } ;

HELP: gadget-selection?
Expand Down Expand Up @@ -163,11 +163,11 @@ HELP: child?
{ $description "Tests if " { $snippet "child" } " is contained inside " { $snippet "parent" } "." } ;

HELP: each-parent
{ $values { "gadget" gadget } { "quot" { $quotation ( gadget -- ? ) } } { "?" boolean } }
{ $values { "gadget" gadget } { "quot" { $quotation ( ... gadget -- ... ? ) } } { "?" boolean } }
{ $description "Applies the quotation to every parent of the gadget, starting from the gadget itself, stopping if the quotation yields " { $link f } ". Outputs " { $link t } " if the iteration completed, and outputs " { $link f } " if it was stopped prematurely." } ;

HELP: find-parent
{ $values { "gadget" gadget } { "quot" { $quotation ( gadget -- ? ) } } { "parent" gadget } }
{ $values { "gadget" gadget } { "quot" { $quotation ( ... gadget -- ... ? ) } } { "parent" gadget } }
{ $description "Outputs the first parent of the gadget, starting from the gadget itself, for which the quotation outputs a true value, or " { $link f } " if the quotation outputs " { $link f } " for every parent." } ;

HELP: focusable-child*
Expand Down
6 changes: 3 additions & 3 deletions basis/ui/gadgets/gadgets.factor
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ M: gadget contains-point?
: sum-dims ( seq -- dim )
[ 0 0 ] dip [ first2 swapd [ + ] 2bi@ ] each 2array ;

: each-child ( gadget quot -- )
: each-child ( ... gadget quot: ( ... child -- ... ) -- ... )
[ children>> ] dip each ; inline

! Selection protocol
Expand Down Expand Up @@ -348,10 +348,10 @@ PRIVATE>
: parents ( gadget -- seq )
[ parent>> ] follow ;

: each-parent ( gadget quot -- ? )
: each-parent ( ... gadget quot: ( ... gadget -- ... ? ) -- ... ? )
[ parents ] dip all? ; inline

: find-parent ( gadget quot -- parent )
: find-parent ( ... gadget quot: ( ... gadget -- ... ? ) -- ... parent )
[ parents ] dip find nip ; inline

: screen-loc ( gadget -- loc )
Expand Down
2 changes: 1 addition & 1 deletion core/classes/tuple/tuple.factor
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ M: tuple-class update-class
: subclasses ( class -- classes )
class-usages [ tuple-class? ] filter ;

: each-subclass ( class quot -- )
: each-subclass ( ... class quot: ( ... subclass -- ... ) -- ... )
[ subclasses ] dip each ; inline

: redefine-tuple-class ( class superclass slots -- )
Expand Down
4 changes: 2 additions & 2 deletions extra/logic/logic.factor
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ C: <cut> cut-info inline
: set-info-if-f ( ? cut-info -- )
dup cut?>> [ 2drop ] [ cut?<< ] if ; inline

: 2each-until ( seq1 seq2 quot -- all-failed? ) 2 nfind 2drop f = ; inline
: 2each-until ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ? ) -- ... all-failed? ) 2 nfind 2drop f = ; inline

DEFER: unify*

Expand Down Expand Up @@ -585,7 +585,7 @@ PRIVATE>

<PRIVATE

: each-until ( seq quot -- ) find 2drop ; inline
: each-until ( ... seq quot: ( ... elt -- ... ? ) -- ... ) find 2drop ; inline

:: resolve-body ( body env cut quot: ( -- ) -- )
body empty? [
Expand Down
2 changes: 1 addition & 1 deletion extra/trails/trails.factor
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ M: trails-gadget ungraft*

M: trails-gadget pref-dim* drop { 500 500 } ;

: each-percent ( seq quot -- )
: each-percent ( ... seq quot: ( ... elt percent -- ... ) -- ... )
[ dup length ] dip '[ 1 + _ / @ ] each-index ; inline

M:: trails-gadget draw-gadget* ( GADGET -- )
Expand Down

0 comments on commit 7a97442

Please sign in to comment.