2014-05-26 10:51:19 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								USING:  assocs  help.markup  help.syntax  kernel  math  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								namespaces.private quotations words words.symbol ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								IN:  namespaces  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "namespaces-combinators"  "Namespace combinators" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    with-scope
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    with-variable
 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-19 03:02:47 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    with-variables
 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "namespaces-change"  "Changing variable values" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    on
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    off
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    inc
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    dec
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    change
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    change-global
 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 04:01:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    toggle
 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "namespaces-global"  "Global variables" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    namespace
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    global
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    get-global
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set-global
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    initialize
 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 04:01:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    with-global
 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "namespaces.private"  "Namespace implementation details" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"The namestack holds namespaces."  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 13:11:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    get-namestack
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set-namestack
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    namespace
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"A pair of words push and pop namespaces on the namestack."  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    >n
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ndrop
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 15:08:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ARTICLE: "namespaces"  "Dynamic variables" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"The "  { $vocab-link "namespaces"  } " vocabulary implements dynamically-scoped variables."  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$nl
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 15:08:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"A dynamic variable is an entry in an assoc of bindings, where the assoc is implicit rather than passed on the stack. These assocs are termed "  { $emphasis "namespaces"  } ". Nesting of scopes is implemented with a search order on namespaces, defined by a "  { $emphasis "namestack"  } ". Since namespaces are just assocs, any object can be used as a variable. By convention, variables are keyed by "  { $link "words.symbol"  } "."  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$nl
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 15:08:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"The "  { $link get  } " and "  { $link set  } " words read and write variable values. The "  { $link get  } " word searches the chain of nested namespaces, while "  { $link set  } " always sets variable values in the current namespace only. Namespaces are dynamically scoped; when a quotation is called from a nested scope, any words called by the quotation also execute in that scope."  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    get
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 15:08:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Various utility words provide common variable access patterns:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "namespaces-change" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "namespaces-combinators" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"Implementation details your code probably does not care about:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections "namespaces.private"  }
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 15:08:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Dynamic variables complement "  { $link "locals"  } "."  ;
  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ABOUT: "namespaces" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  get  
						 
					
						
							
								
									
										
										
										
											2015-05-13 19:09:14 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } { "value"  { $maybe "the value"  } } }
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Searches the namestack for a namespace containing the variable, and outputs the associated value. If no such namespace is found, outputs "  { $link f  } "."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  set  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "value"  "the new value"  } { "variable"  "a variable, by convention a symbol"  } }
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Assigns a value to the variable in the namespace at the top of the namestack."  }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  off  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Assigns a value of "  { $link f  } " to the variable."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  on  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Assigns a value of "  { $link t  } " to the variable."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  change  
						 
					
						
							
								
									
										
										
										
											2014-05-18 23:09:10 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } { "quot"  { $quotation (  old  --  new  )  } } }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Applies the quotation to the old value of the variable, and assigns the resulting value to the variable."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-04-30 22:38:14 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  change-global  
						 
					
						
							
								
									
										
										
										
											2014-05-18 23:09:10 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } { "quot"  { $quotation (  old  --  new  )  } } }
							 
						 
					
						
							
								
									
										
										
										
											2009-04-30 22:38:14 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Applies the quotation to the old value of the global variable, and assigns the resulting value to the global variable."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 04:01:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  toggle  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
									
										
										
										
											2015-07-02 13:31:22 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { "variable"  "a variable, by convention a symbol"  }
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 04:01:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Changes the boolean value of a variable to its opposite."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  with-global  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
									
										
										
										
											2015-07-02 13:31:22 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { "quot"  quotation }
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 04:01:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Runs the quotation in the global namespace."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								HELP:  +@  
						 
					
						
							
								
									
										
										
										
											2014-05-26 10:51:19 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "n"  number  } { "variable"  "a variable, by convention a symbol"  } }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Adds "  { $snippet "n"  } " to the value of the variable. A variable value of "  { $link f  } " is interpreted as being zero."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2008-04-26 03:01:06 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { $example "USING: namespaces prettyprint ;"  "IN: scratchpad"  "SYMBOL: foo\n1 foo +@\n10 foo +@\nfoo get ."  "11"  }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  inc  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Increments the value of the variable by 1. A variable value of "  { $link f  } " is interpreted as being zero."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  dec  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Decrements the value of the variable by 1. A variable value of "  { $link f  } " is interpreted as being zero."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  counter  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } { "n"  integer  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Increments the value of the variable by 1, and returns its new value."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word is useful for generating (somewhat) unique identifiers. For example, the "  { $link gensym } " word uses it."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  with-scope  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "quot"  quotation } }
							 
						 
					
						
							
								
									
										
										
										
											2008-11-11 11:51:15 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Calls the quotation in a new namespace. Any variables set by the quotation are discarded when it returns."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $example "USING: math namespaces prettyprint ;"  "IN: scratchpad"  "SYMBOL: x"  "0 x set"  "[ x [ 5 + ] change x get . ] with-scope x get ."  "5\n0"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  with-variable  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "value"  object  } { "key"  "a variable, by convention a symbol"  } { "quot"  quotation } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Calls the quotation in a new namespace where "  { $snippet "key"  } " is set to "  { $snippet "value"  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples "The following two phrases are equivalent:" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $code "[ 3 x set foo ] with-scope"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $code "3 x [ foo ] with-variable"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-19 03:02:47 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  with-variables  
						 
					
						
							
								
									
										
										
										
											2009-05-01 03:03:22 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "ns"  assoc  } { "quot"  quotation } }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Calls the quotation in the dynamic scope of "  { $snippet "ns"  } ". When variables are looked up by the quotation, "  { $snippet "ns"  } " is checked first, and setting variables in the quotation stores them in "  { $snippet "ns"  } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  namespace  
						 
					
						
							
								
									
										
										
										
											2009-05-01 03:03:22 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "namespace"  assoc  } }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs the current namespace. Calls to "  { $link set  } " modify this namespace."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  global  
						 
					
						
							
								
									
										
										
										
											2009-05-01 03:03:22 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "g"  assoc  } }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs the global namespace. The global namespace is always checked last when looking up variable values."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  get-global  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "variable"  "a variable, by convention a symbol"  } { "value"  "the value"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs the value of a variable in the global namespace."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  set-global  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "value"  "the new value"  } { "variable"  "a variable, by convention a symbol"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Assigns a value to the variable in the global namespace."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $side-effects "variable"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  (get-namestack)  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $values { "namestack"  "a vector of assocs"  } }
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Outputs the current namestack."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 13:11:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  get-namestack  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $values { "namestack"  "a vector of assocs"  } }
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Outputs a copy of the current namestack."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  set-namestack  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "namestack"  "a vector of assocs"  } }
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Replaces the namestack with a copy of the given vector."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  >n  
						 
					
						
							
								
									
										
										
										
											2009-05-01 03:03:22 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "namespace"  assoc  } }
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Pushes a namespace on the namestack."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  ndrop  
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Pops a namespace from the namestack."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  init-namespaces  
						 
					
						
							
								
									
										
										
										
											2015-08-13 20:53:07 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Resets the namestack to its initial state, holding a single copy of the global namespace."  }
							 
						 
					
						
							
								
									
										
										
										
											2008-02-18 06:07:40 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$low-level-note ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 14:02:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  initialize  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "variable"  symbol } { "quot"  quotation } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "If "  { $snippet "variable"  } " does not have a value in the global namespace, calls "  { $snippet "quot"  } " and assigns the result to "  { $snippet "variable"  } " in the global namespace."  } ;