17 lines
		
	
	
		
			326 B
		
	
	
	
		
			Factor
		
	
	
		
		
			
		
	
	
			17 lines
		
	
	
		
			326 B
		
	
	
	
		
			Factor
		
	
	
| 
								 | 
							
								USING: namespaces math partial-continuations tools.test
							 | 
						||
| 
								 | 
							
								kernel sequences ;
							 | 
						||
| 
								 | 
							
								IN: temporary
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								SYMBOL: sum
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								: range ( r from to -- n )
							 | 
						||
| 
								 | 
							
								    over - 1 + rot [ 
							 | 
						||
| 
								 | 
							
								        -rot [ over + pick call drop ] each 2drop f  
							 | 
						||
| 
								 | 
							
								    ] bshift 2nip ;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								[ 55 ] [
							 | 
						||
| 
								 | 
							
								    0 sum set 
							 | 
						||
| 
								 | 
							
								    [ 1 10 range sum get + sum set f ] breset drop
							 | 
						||
| 
								 | 
							
								    sum get
							 | 
						||
| 
								 | 
							
								] unit-test
							 |