2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								USING:  help.syntax  help.markup  kernel  sequences  ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-10 22:06:37 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								IN:  sequences.deep 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-24 13:20:52 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  deep-each 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "quot"  { $quotation "( elt -- )"  } } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Execute a quotation on each nested element of an object and its children, in preorder."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $see-also each  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-24 13:20:52 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  deep-map 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "quot"  { $quotation "( elt -- newelt )"  } } { "newobj"  "the mapped object"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Execute a quotation on each nested element of an object and its children, in preorder. That is, the result of the execution of the quotation on the outer is used to map the inner elements."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $see-also map  }  ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-24 13:20:52 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-26 00:17:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  deep-filter 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "quot"  { $quotation "( elt -- ? )"  } } { "seq"  "a sequence"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Creates a sequence of sub-nodes in the object which satisfy the given quotation, in preorder. This includes the object itself, if it passes the quotation."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $see-also filter  }  ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-24 13:20:52 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  deep-find 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "quot"  { $quotation "( elt -- ? )"  } } { "elt"  "an element"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Gets the first sub-node of the object, in preorder, which satisfies the quotation. If nothing satisifies it, it returns "  { $link f  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $see-also find  }  ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-24 13:20:52 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 23:19:07 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								HELP:  deep-any? 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "quot"  { $quotation "( elt -- ? )"  } } { "?"  "a boolean"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Tests whether the given object or any subnode satisfies the given quotation."  }
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 23:19:07 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $see-also any?  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-24 13:20:52 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  flatten 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "seq"  "a sequence"  } }
							 
						 
					
						
							
								
									
										
										
										
											2007-12-24 13:20:52 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Creates a sequence of all of the leaf nodes (non-sequence nodes, but including strings and numbers) in the object."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 23:32:56 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								HELP:  deep-map! 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "obj"  object  } { "quot"  { $quotation "( elt -- newelt )"  } } { "obj"  object  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Modifies each sub-node of an object in place, in preorder, and returns that object."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $see-also map!  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ARTICLE: "sequences.deep"  "Deep sequence combinators" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"The combinators in the "  { $vocab-link "sequences.deep"  } " vocabulary are variants of standard sequence combinators which traverse nested subsequences." 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deep-each
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deep-map
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deep-filter
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deep-find
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deep-any?
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 23:32:56 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    deep-map!
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								"A utility word to collapse nested subsequences:" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections flatten } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-23 18:41:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ABOUT: "sequences.deep"