2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								USING:  help.syntax  help.markup  kernel  sequences  quotations  
						 
					
						
							
								
									
										
										
										
											2008-12-09 05:20:20 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								math arrays combinators ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								IN:  generalizations  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-08 00:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  nsum  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Adds the top "  { $snippet "n"  } " stack values."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								HELP:  npick  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link dup  } ", " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $link over  } " and "  { $link pick  } " that can work " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"for any stack depth. The nth item down the stack will be copied and "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"placed on the top of the stack."  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2010-05-18 22:59:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "USING: kernel generalizations prettyprint" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "sequences.generalizations ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "1 2 3 4 4 npick 5 narray ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "{ 1 2 3 4 1 }" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link npick } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link dup  } { $snippet "1 npick"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link over  } { $snippet "2 npick"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link pick  } { $snippet "3 npick"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  ndup  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link dup  } ", " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $link 2dup  } " and "  { $link 3dup  } " that can work " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"for any number of items. The n topmost items on the stack will be copied and "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"placed on the top of the stack."  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2010-05-18 22:59:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "USING: prettyprint generalizations kernel" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "sequences.generalizations ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "1 2 3 4 4 ndup 8 narray ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "{ 1 2 3 4 1 2 3 4 }" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link ndup } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link dup  } { $snippet "1 ndup"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 2dup  } { $snippet "2 ndup"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 3dup  } { $snippet "3 ndup"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  dupn  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Calls "  { $link dup  } " enough times that "  { $snippet "n"  } " references to the element at the top of the stack before "  { $snippet "dupn"  } " is called are on the top of the stack."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes { $snippet "2 dupn"  } " is equivalent to "  { $link dup  } ". "  { $snippet "1 dupn"  } " is a no-op. "  { $snippet "0 dupn"  } " is equivalent to "  { $link drop  } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								HELP:  nnip  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link nip  } " and "  { $link 2nip  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" that can work "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"for any number of items."  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2009-03-18 18:01:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example "USING: prettyprint generalizations kernel ;"  "1 2 3 4 3 nnip ."  "4"  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link nnip } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link nip  } { $snippet "1 nnip"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 2nip  } { $snippet "2 nnip"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  ndrop  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link drop  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" that can work "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"for any number of items."  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2009-03-18 18:01:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example "USING: prettyprint generalizations kernel ;"  "1 2 3 4 3 ndrop ."  "1"  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link ndrop } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link drop  } { $snippet "1 ndrop"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 2drop  } { $snippet "2 ndrop"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 3drop  } { $snippet "3 ndrop"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  nrot  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link rot  } " that works for any " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"number of items on the stack. "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2009-03-18 18:01:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example "USING: arrays generalizations kernel prettyprint ;"  "1 2 3 4 4 nrot 4array ."  "{ 2 3 4 1 }"  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link nrot } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
									
										
										
										
											2014-02-10 23:40:01 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { { $link swap  } { $snippet "2 nrot"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link rot  } { $snippet "3 nrot"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  -nrot  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link -rot  } " that works for any " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"number of items on the stack. "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2009-03-18 18:01:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example "USING: arrays generalizations kernel prettyprint ;"  "1 2 3 4 4 -nrot 4array ."  "{ 4 1 2 3 }"  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link -nrot } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
									
										
										
										
											2014-02-10 23:40:01 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { { $link swap  } { $snippet "2 -nrot"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link -rot  } { $snippet "3 -nrot"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  ndip  
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link dip  } " that can work "  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"for any stack depth. The quotation will be called with a stack that "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"has 'n' items removed first. The 'n' items are then put back on the "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"stack. The quotation can consume and produce any number of items."  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2009-03-18 18:01:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example "USING: arrays generalizations kernel prettyprint ;"  "1 2 [ dup ] 1 ndip 3array ."  "{ 1 1 2 }"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { $example "USING: arrays generalizations kernel prettyprint ;"  "1 2 3 [ drop ] 2 ndip 2array ."  "{ 2 3 }"  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link ndip } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link dip  } { $snippet "1 ndip"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 2dip  } { $snippet "2 ndip"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 3dip  } { $snippet "3 ndip"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  nkeep  
						 
					
						
							
								
									
										
										
										
											2009-10-15 16:44:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link keep  } " that can work "  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"for any stack depth. The first "  { $snippet "n"  } " items after the quotation will be "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"saved, the quotation called, and the items restored."  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2010-05-18 22:59:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "USING: generalizations kernel prettyprint" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "sequences.generalizations ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "1 2 3 4 5 [ drop drop drop drop drop 99 ] 5 nkeep 6 narray ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      "{ 99 1 2 3 4 5 }" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link nkeep } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link keep  } { $snippet "1 nkeep"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 2keep  } { $snippet "2 nkeep"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 3keep  } { $snippet "3 nkeep"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  ncurry  
						 
					
						
							
								
									
										
										
										
											2011-12-07 15:26:35 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link curry  } " that can work for any stack depth." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link ncurry } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link curry  } { $snippet "1 ncurry"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 2curry  } { $snippet "2 ncurry"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 3curry  } { $snippet "3 ncurry"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  nwith  
						 
					
						
							
								
									
										
										
										
											2011-12-07 15:26:35 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link with  } " that can work for any stack depth." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link nwith } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link with  } { $snippet "1 nwith"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  napply  
						 
					
						
							
								
									
										
										
										
											2009-11-06 05:20:25 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "quot"  quotation } { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link bi@  } " and "  { $link tri@  } " that can work for any stack depth." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link napply } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
									
										
										
										
											2009-01-13 20:41:12 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { { $link call  } { $snippet "1 napply"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link bi@  } { $snippet "2 napply"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link tri@  } { $snippet "3 napply"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-09 05:20:20 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  ncleave  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "quots"  "a sequence of quotations"  } { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link cleave  } " and "  { $link 2cleave  } " that can work for any quotation arity." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link ncleave } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link cleave  } { $snippet "1 ncleave"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link 2cleave  } { $snippet "2 ncleave"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-08 00:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  nspread  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "quots"  "a sequence of quotations"  } { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "A generalization of "  { $link spread  } " that can work for any quotation arity." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  cleave*  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Like "  { $link cleave  } ", but instead of taking a single array of quotations, cleaves using quotations taken from the top "  { $snippet "n"  } " elements of the datastack."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word can be used with "  { $link apply-curry } " to generalize the "  { $snippet "bi-curry@ bi"  } " or "  { $snippet "tri-curry@ tri"  } " dataflow patterns."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  spread*  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Like "  { $link spread  } ", but instead of taking a single array of quotations, spreads using quotations taken from the top "  { $snippet "n"  } " elements of the datastack."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word can be used with "  { $link apply-curry } " to generalize the "  { $snippet "bi-curry@ bi*"  } " or "  { $snippet "tri-curry@ tri*"  } " dataflow patterns."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  apply-curry  
						 
					
						
							
								
									
										
										
										
											2010-03-05 16:58:00 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "a..."  { $snippet "n"  } " values on the datastack"  } { "quot"  quotation } { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Curries each of the top "  { $snippet "n"  } " items of the datastack onto "  { $snippet "quot"  } ", leaving "  { $snippet "n"  } " quotations on the datastack. A generalization of "  { $link bi-curry@  } " and "  { $link tri-curry@  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word can be used with "  { $link cleave* } " and "  { $link spread* } " to generalize dataflow patterns such as "  { $snippet "bi-curry@ bi"  } ", "  { $snippet "tri-curry@ tri"  } ", "  { $snippet "bi-curry@ bi*"  } ", and "  { $snippet "tri-curry@ tri*"  } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  cleave-curry  
						 
					
						
							
								
									
										
										
										
											2010-03-05 16:58:00 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "a"  object  } { "quot..."  { $snippet "n"  } " quotations on the datastack"  } { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Curries "  { $snippet "a"  } " onto the "  { $snippet "n"  } " quotations on the top of the datastack. A generalization of "  { $link bi-curry  } " and "  { $link tri-curry  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word can be used with "  { $link cleave* } " and "  { $link spread* } " to generalize dataflow patterns such as "  { $snippet "bi-curry bi"  } ", "  { $snippet "tri-curry tri"  } ", "  { $snippet "bi-curry bi*"  } ", and "  { $snippet "tri-curry tri*"  } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  spread-curry  
						 
					
						
							
								
									
										
										
										
											2010-03-05 16:58:00 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "a..."  { $snippet "n"  } " objects on the datastack"  } { "quot..."  { $snippet "n"  } " quotations on the datastack"  } { "n"  integer  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Curries the "  { $snippet "n"  } " quotations on the top of the datastack with the "  { $snippet "n"  } " values just below them. A generalization of "  { $link bi-curry*  } " and "  { $link tri-curry*  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word can be used with "  { $link cleave* } " and "  { $link spread* } " to generalize dataflow patterns such as "  { $snippet "bi-curry* bi"  } ", "  { $snippet "tri-curry* tri"  } ", "  { $snippet "bi-curry* bi*"  } ", and "  { $snippet "tri-curry* tri*"  } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-11-27 22:53:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  mnswap  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "m"  integer  } { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Swaps the top "  { $snippet "m"  } " stack elements with the "  { $snippet "n"  } " elements directly underneath."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  "Some core words expressed in terms of "  { $link mnswap } ":" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link swap  } { $snippet "1 1 mnswap"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link rot  } { $snippet "2 1 mnswap"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { { $link -rot  } { $snippet "1 2 mnswap"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-08 00:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  nweave  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Copies the top "  { $snippet "n"  } " stack elements underneath each one of the "  { $snippet "n"  } " elements below."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { $example
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "USING: arrays kernel generalizations prettyprint ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "\"e1\" \"e2\" \"o1\" \"o2\" 2 nweave [ 3array ] 3dip 3array 2array ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "{ { \"e1\" \"o1\" \"o2\" } { \"e2\" \"o1\" \"o2\" } }" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-18 21:26:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  n*quot  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
									
										
										
										
											2009-04-17 19:04:41 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     { "n"  integer  } { "quot"  quotation }
							 
						 
					
						
							
								
									
										
										
										
											2009-10-08 15:42:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     { "quotquot"  quotation }
							 
						 
					
						
							
								
									
										
										
										
											2009-01-18 21:26:58 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $example "USING: generalizations prettyprint math ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "3 [ + ] n*quot ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "[ + + + ]" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Construct a quotation containing the contents of "  { $snippet "seq"  } " repeated "  { $snippet "n" } " times."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-08 00:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ARTICLE: "shuffle-generalizations"  "Generalized shuffle words" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ndup
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    dupn
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    npick
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    nrot
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    -nrot
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    nnip
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ndrop
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mnswap
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    nweave
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-08 00:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "combinator-generalizations"  "Generalized combinators" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ndip
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    nkeep
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    napply
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ncleave
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    nspread
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 17:50:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    cleave*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    spread*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    apply-curry
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    cleave-curry
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    spread-curry
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-08 00:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "other-generalizations"  "Additional generalizations" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ncurry
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    nwith
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    nsum
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-08 00:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "generalizations"  "Generalized shuffle words and combinators" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"The "  { $vocab-link "generalizations"  } " vocabulary defines a number of stack shuffling words and combinators for use in "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"macros where the arity of the input quotations depends on an "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"input parameter."  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "shuffle-generalizations" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "combinator-generalizations" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "other-generalizations" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 14:31:03 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2010-05-18 18:36:47 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Also see the "  { $vocab-link "sequences.generalizations"  } " vocabulary for generalized sequence operations."  ;
  
						 
					
						
							
								
									
										
										
										
											2008-07-07 20:36:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ABOUT: "generalizations"