HELP: sequence>assoc
{ $values
- { "seq" sequence } { "map-quot" { $quotation "( x -- x' )" } } { "insert-quot" { $quotation "( x' assoc -- )" } } { "exemplar" "an exemplar assoc" }
+ { "seq" sequence } { "map-quot" { $quotation "( x -- ..y )" } } { "insert-quot" { $quotation "( ..y assoc -- )" } } { "exemplar" "an exemplar assoc" }
{ "assoc" assoc }
}
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to a newly created " { $snippet "assoc" } ". The " { $snippet "map-quot" } " gets passed each element from the sequence. Its outputs are passed along with the assoc being constructed to the " { $snippet "insert-quot" } ", which can modify the assoc in response." }
HELP: sequence>assoc!
{ $values
- { "assoc" assoc } { "seq" sequence } { "map-quot" { $quotation "( x -- x' )" } } { "insert-quot" { $quotation "( x' assoc -- )" } }
+ { "assoc" assoc } { "seq" sequence } { "map-quot" { $quotation "( x -- ..y )" } } { "insert-quot" { $quotation "( ..y assoc -- )" } }
}
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to an existing " { $snippet "assoc" } ". The " { $snippet "map-quot" } " gets passed each element from the sequence. Its outputs are passed along with the assoc being constructed to the " { $snippet "insert-quot" } ", which can modify the assoc in response." }
{ $examples
HELP: sequence>hashtable
{ $values
- { "seq" sequence } { "map-quot" { $quotation "( x -- x' )" } } { "insert-quot" { $quotation "( x' assoc -- )" } }
+ { "seq" sequence } { "map-quot" { $quotation "( x -- ..y )" } } { "insert-quot" { $quotation "( ..y assoc -- )" } }
{ "hashtable" hashtable }
}
{ $description "Iterates over a sequence, allowing elements of the sequence to be added to a newly created hashtable. The " { $snippet "map-quot" } " gets passed each element from the sequence. Its outputs are passed along with the assoc being constructed to the " { $snippet "insert-quot" } ", which can modify the assoc in response." }
<PRIVATE
-: (sequence>assoc) ( seq map-quot: ( x -- x' ) insert-quot: ( x' assoc -- ) assoc -- assoc )
+: (sequence>assoc) ( seq map-quot: ( x -- ..y ) insert-quot: ( ..y assoc -- ) assoc -- assoc )
[ swap curry compose each ] keep ; inline
PRIVATE>
-: sequence>assoc! ( assoc seq map-quot: ( x -- x' ) insert-quot: ( x' assoc -- ) -- assoc )
+: sequence>assoc! ( assoc seq map-quot: ( x -- ..y ) insert-quot: ( ..y assoc -- ) -- assoc )
4 nrot (sequence>assoc) ; inline
-: sequence>assoc ( seq map-quot: ( x -- x' ) insert-quot: ( x' assoc -- ) exemplar -- assoc )
+: sequence>assoc ( seq map-quot: ( x -- ..y ) insert-quot: ( ..y assoc -- ) exemplar -- assoc )
clone (sequence>assoc) ; inline
-: sequence>hashtable ( seq map-quot: ( x -- x' ) insert-quot: ( x' assoc -- ) -- hashtable )
+: sequence>hashtable ( seq map-quot: ( x -- ..y ) insert-quot: ( ..y assoc -- ) -- hashtable )
H{ } sequence>assoc ; inline
: histogram! ( hashtable seq -- hashtable )