math.statistics: declare polymorphic effects on sequence>* combinators now that #88 is fixed
							parent
							
								
									e293966618
								
							
						
					
					
						commit
						003271f2b8
					
				| 
						 | 
					@ -128,7 +128,7 @@ HELP: sorted-histogram
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HELP: sequence>assoc
 | 
					HELP: sequence>assoc
 | 
				
			||||||
{ $values
 | 
					{ $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 }
 | 
					    { "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." }
 | 
					{ $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." }
 | 
				
			||||||
| 
						 | 
					@ -143,7 +143,7 @@ HELP: sequence>assoc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HELP: sequence>assoc!
 | 
					HELP: sequence>assoc!
 | 
				
			||||||
{ $values
 | 
					{ $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." }
 | 
					{ $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
 | 
					{ $examples
 | 
				
			||||||
| 
						 | 
					@ -156,7 +156,7 @@ HELP: sequence>assoc!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HELP: sequence>hashtable
 | 
					HELP: sequence>hashtable
 | 
				
			||||||
{ $values
 | 
					{ $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 }
 | 
					    { "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." }
 | 
					{ $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." }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,18 +58,18 @@ IN: math.statistics
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<PRIVATE
 | 
					<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
 | 
					    [ swap curry compose each ] keep ; inline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PRIVATE>
 | 
					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
 | 
					    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
 | 
					    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
 | 
					    H{ } sequence>assoc ; inline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: histogram! ( hashtable seq -- hashtable )
 | 
					: histogram! ( hashtable seq -- hashtable )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue