Documentation fixes
parent
304cd3c969
commit
2d19b38683
|
@ -45,7 +45,7 @@ HELP: cleave
|
||||||
{ bi tri cleave } related-words
|
{ bi tri cleave } related-words
|
||||||
|
|
||||||
HELP: spread
|
HELP: spread
|
||||||
{ $values { "obj..." "objects" } { "seq" "a sequence of quotations with stack effect " { $snippet "( x -- ... )" } } }
|
{ $values { "objs..." "objects" } { "seq" "a sequence of quotations with stack effect " { $snippet "( x -- ... )" } } }
|
||||||
{ $description "Applies each quotation to the object in turn." }
|
{ $description "Applies each quotation to the object in turn." }
|
||||||
{ $examples
|
{ $examples
|
||||||
"The " { $link bi* } " combinator takes two values and two quotations; the " { $link tri* } " combinator takes three values and three quotations. The " { $link spread } " combinator takes " { $snippet "n" } " values and " { $snippet "n" } " quotations, where " { $snippet "n" } " is the length of the input sequence, and is essentially equivalent to series of retain stack manipulations:"
|
"The " { $link bi* } " combinator takes two values and two quotations; the " { $link tri* } " combinator takes three values and three quotations. The " { $link spread } " combinator takes " { $snippet "n" } " values and " { $snippet "n" } " quotations, where " { $snippet "n" } " is the length of the input sequence, and is essentially equivalent to series of retain stack manipulations:"
|
||||||
|
|
|
@ -5,13 +5,13 @@ USING: arrays sequences sequences.private math.private
|
||||||
kernel kernel.private math assocs quotations vectors
|
kernel kernel.private math assocs quotations vectors
|
||||||
hashtables sorting ;
|
hashtables sorting ;
|
||||||
|
|
||||||
: cleave ( obj seq -- )
|
: cleave ( x seq -- )
|
||||||
[ call ] with each ;
|
[ call ] with each ;
|
||||||
|
|
||||||
: cleave>quot ( seq -- quot )
|
: cleave>quot ( seq -- quot )
|
||||||
[ [ keep ] curry ] map concat [ drop ] append ;
|
[ [ keep ] curry ] map concat [ drop ] append ;
|
||||||
|
|
||||||
: 2cleave ( obj seq -- )
|
: 2cleave ( x seq -- )
|
||||||
[ [ call ] 3keep drop ] each 2drop ;
|
[ [ call ] 3keep drop ] each 2drop ;
|
||||||
|
|
||||||
: 2cleave>quot ( seq -- quot )
|
: 2cleave>quot ( seq -- quot )
|
||||||
|
@ -22,7 +22,7 @@ hashtables sorting ;
|
||||||
[ [ [ r> ] prepend ] map concat ] bi
|
[ [ [ r> ] prepend ] map concat ] bi
|
||||||
append ;
|
append ;
|
||||||
|
|
||||||
: spread ( seq -- )
|
: spread ( objs... seq -- )
|
||||||
spread>quot call ;
|
spread>quot call ;
|
||||||
|
|
||||||
ERROR: no-cond ;
|
ERROR: no-cond ;
|
||||||
|
|
|
@ -98,14 +98,14 @@ DEFER: if
|
||||||
>r -rot 2slip r> call ; inline
|
>r -rot 2slip r> call ; inline
|
||||||
|
|
||||||
! Appliers
|
! Appliers
|
||||||
: bi@ ( x y p -- )
|
: bi@ ( x y quot -- )
|
||||||
tuck 2slip call ; inline
|
tuck 2slip call ; inline
|
||||||
|
|
||||||
: tri@ ( x y z p -- )
|
: tri@ ( x y z quot -- )
|
||||||
tuck >r bi@ r> call ; inline
|
tuck >r bi@ r> call ; inline
|
||||||
|
|
||||||
! Double appliers
|
! Double appliers
|
||||||
: 2bi@ ( w x y z p -- )
|
: 2bi@ ( w x y z quot -- )
|
||||||
dup -roll 3slip call ; inline
|
dup -roll 3slip call ; inline
|
||||||
|
|
||||||
: while ( pred body tail -- )
|
: while ( pred body tail -- )
|
||||||
|
|
Loading…
Reference in New Issue