Added hashing, hashqing hashving och in-hash.
This commit is contained in:
		
							parent
							
								
									5f96ef4fb0
								
							
						
					
					
						commit
						f492a5278b
					
				
					 3 changed files with 82 additions and 26 deletions
				
			
		|  | @ -197,10 +197,10 @@ | |||
| 
 | ||||
|     <subsection title=":for-clauses"> | ||||
|       <dl> | ||||
|         <dt type="syntax">(:for identifier (in start [update [stop]]))</dt> | ||||
|         <dt type="syntax">(:for binding (in start [update [stop]]))</dt> | ||||
|         <dd> | ||||
|           <p> | ||||
|             Binds a loop variable to <code>identifier</code>. It's first value is <code>start</code>. It is updated by the <code>update</code> expression, or is left unchanged if no such expression is present. If a <code>stop</code> expression is provided, it will be evaluated before each loop body. If the <code>stop</code> expression returns true, the iteration will be considered exhausted. | ||||
|             Binds a loop variable to <code>binding</code>. It's first value is <code>start</code>. It is updated by the <code>update</code> expression, or is left unchanged if no such expression is present. If a <code>stop</code> expression is provided, it will be evaluated before each loop body. If the <code>stop</code> expression returns true, the iteration will be considered exhausted. | ||||
| 
 | ||||
|             <example> | ||||
|               (loop ((:for a (in 0 b)) (:for b (in 1 (+ a b) (> b 20)))) | ||||
|  | @ -210,40 +210,50 @@ | |||
|           </p> | ||||
|         </dd> | ||||
| 
 | ||||
|         <dt type="syntax">(:for identifier (up-from start [(to bound)] [(by step)])</dt> | ||||
|         <dt type="syntax">(:for identifier (up-from start [bound [by]]))</dt> | ||||
|         <dd>Binds <code>identifier</code> to the number <code>start</code> up to <code>bound</code> (exclusive!) by <code>step</code>. If no <code>bound</code> is given, it will yield values indefinitely. The second shorter form will not allow unbounded iteratiom.</dd> | ||||
|         <dt type="syntax">(:for binding (up-from start [(to bound)] [(by step)])</dt> | ||||
|         <dt type="syntax">(:for binding (up-from start [bound [by]]))</dt> | ||||
|         <dd>Binds <code>binding</code> to the number <code>start</code> up to <code>bound</code> (exclusive!) by <code>step</code>. If no <code>bound</code> is given, it will yield values indefinitely. The second shorter form will not allow unbounded iteratiom.</dd> | ||||
| 
 | ||||
|         <dt type="syntax">(:for identifier (down-from start [(to bound)] [(by step)])</dt> | ||||
|         <dt type="syntax">(:for identifier (down-from start [bound [by]]))</dt> | ||||
|         <dd>Binds <code>identifier</code> to the number <code>start</code> down to <code>bound</code> (inclusive!) by <code>step</code>. If no <code>bound</code> is given, it will yield values indefinitely. The second shorter form will not allow unbounded iteratiom.</dd> | ||||
|         <dt type="syntax">(:for binding (down-from start [(to bound)] [(by step)])</dt> | ||||
|         <dt type="syntax">(:for binding (down-from start [bound [by]]))</dt> | ||||
|         <dd>Binds <code>binding</code> to the number <code>(- start 1)</code> down to <code>bound</code> (inclusive!) by <code>step</code>. If no <code>bound</code> is given, it will yield values indefinitely. The second shorter form will not allow unbounded iteratiom.</dd> | ||||
| 
 | ||||
|         <dt type="syntax">(:for identifier [pair] (in-list expr [by])</dt> | ||||
|         <dd>Binds <code>identifier</code> to the car of the loop variable <code>pair</code>. <code>pair</code> is advanced by applying the procedure <code>by</code> to it (defaulting to <code>cdr</code>). The iteration stops when <code>pair</code> is the empty list.</dd> | ||||
|         <dt type="syntax">(:for binding [pair] (in-list expr [by])</dt> | ||||
|         <dd>Binds <code>binding</code> to the car of the loop variable <code>pair</code>. <code>pair</code> is advanced by applying the procedure <code>by</code> to it (defaulting to <code>cdr</code>). The iteration stops when <code>pair</code> is the empty list.</dd> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier [pairs] (in-lists expr [by])</dd> | ||||
|         <dt>Works the same as <code>in-list</code>, but <code>expr</code> must evaluate to a list of lists. <code>identifier</code> is bound to the car of those lists, and they are advanced by <code>by</code>, defaulting to <code>cdr</code>.</dt> | ||||
|         <dd type="syntax">(:for binding [pairs] (in-lists expr [by])</dd> | ||||
|         <dt>Works the same as <code>in-list</code>, but <code>expr</code> must evaluate to a list of lists. <code>binding</code> is bound to the car of those lists, and they are advanced by <code>by</code>, defaulting to <code>cdr</code>.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier [index] (in-vector expr [low [high]]))</dd> | ||||
|         <dt>Binds <code>identifier</code> to all elements in the vector produced by <code>expr</code> in order from <code>low</code> to <code>high</code>. <code>low</code> defaults to 0 and <code>high</code> defaults to the last index of the vector.</dt> | ||||
|         <dd type="syntax">(:for binding [index] (in-vector expr [low [high]]))</dd> | ||||
|         <dt>Binds <code>binding</code> to all elements in the vector produced by <code>expr</code> in order from <code>low</code> to <code>high</code>. <code>low</code> defaults to 0 and <code>high</code> defaults to the last index of the vector.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier [index] (in-reverse-vector expr [high [low]]))</dd> | ||||
|         <dt>Binds <code>identifier</code> to all elements in the vector produced by <code>expr</code> in reverse order from <code>high</code> to <code>low</code>. <code>high</code> defaults to the last element of the vector and <code>low</code> defaults to 0.</dt> | ||||
|         <dd type="syntax">(:for binding [index] (in-reverse-vector expr [high [low]]))</dd> | ||||
|         <dt>Binds <code>binding</code> to all elements in the vector produced by <code>expr</code> in reverse order from <code>high</code> to <code>low</code>. <code>high</code> defaults to the last element of the vector and <code>low</code> defaults to 0.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier [index] (in-string expr [low [high]]))</dd> | ||||
|         <dt>Binds <code>identifier</code> to all elements in the string produced by <code>expr</code> in order from <code>low</code> to <code>high</code>. <code>low</code> defaults to 0 and <code>high</code> defaults to the last index of the string.</dt> | ||||
|         <dd type="syntax">(:for binding [index] (in-string expr [low [high]]))</dd> | ||||
|         <dt>Binds <code>binding</code> to all elements in the string produced by <code>expr</code> in order from <code>low</code> to <code>high</code>. <code>low</code> defaults to 0 and <code>high</code> defaults to the last index of the string.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier [index] (in-reverse-string expr [high [low]]))</dd> | ||||
|         <dt>Binds <code>identifier</code> to all elements in the vector produced by <code>expr</code> in reverse order from <code>high</code> to <code>low</code>. <code>high</code> defaults to the last element of the vector and <code>low</code> defaults to 0.</dt> | ||||
|         <dd type="syntax">(:for binding [index] (in-reverse-string expr [high [low]]))</dd> | ||||
|         <dt>Binds <code>binding</code> to all elements in the vector produced by <code>expr</code> in reverse order from <code>high</code> to <code>low</code>. <code>high</code> defaults to the last element of the vector and <code>low</code> defaults to 0.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier (in-port port [reader [eof?]]))</dd> | ||||
|         <dt>Binds <code>identifier</code> to the result of calling <code>reader</code> on <code>port</code>. Iteration stops when <code>(eof? identifier)</code> returns true.</dt> | ||||
|         <dd type="syntax">(:for binding (in-port port [reader [eof?]]))</dd> | ||||
|         <dt>Binds <code>binding</code> to the result of calling <code>reader</code> on <code>port</code>. Iteration stops when <code>(eof? binding)</code> returns true.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier (in-file path [reader [eof?]]))</dd> | ||||
|         <dt>Opens the file located at <code>path</code> (which is a string) and binds <code>identifier</code> to the result of calling <code>reader</code> on the opened port. Iteration stops when <code>(eof? identifier)</code> returns true.</dt> | ||||
|         <dd type="syntax">(:for binding (in-file path [reader [eof?]]))</dd> | ||||
|         <dt>Opens the file located at <code>path</code> (which is a string) and binds <code>binding</code> to the result of calling <code>reader</code> on the opened port. Iteration stops when <code>(eof? binding)</code> returns true.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for binding (in-generator gen))</dd> | ||||
|         <dt>Binds binding to the result of calling the SRFI-158-compatible generator <code>gen</code>. Iteration stops when <code>gen</code> returns the end-of-file object.</dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for binding (in-hash hash))</dd> | ||||
|         <dt>Binds <code>binding</code> to the <code>(key . value)</code> pairs of the hash-table <code>hash</code>. May, as all body-binding variables, be pattern-matched: | ||||
| 
 | ||||
|         <example> | ||||
|           (loop/list (((_ . val) (in-hash hash-table))) | ||||
|             val) | ||||
|         </example> | ||||
|         </dt> | ||||
| 
 | ||||
|         <dd type="syntax">(:for identifier (in-generator gen))</dd> | ||||
|         <dt>Binds identifier to the result of calling the SRFI-158-compatible generator <code>gen</code>. Iteration stops when <code>gen</code> returns the end-of-file object.</dt> | ||||
|          | ||||
|       </dl> | ||||
|              | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus
						Linus