guard if in accumulators is now :if.
All auxiliary syntax is now prefixed by :.
This commit is contained in:
		
							parent
							
								
									88f138849e
								
							
						
					
					
						commit
						2775e70fd0
					
				
					 4 changed files with 33 additions and 33 deletions
				
			
		|  | @ -140,7 +140,7 @@ | |||
|         (loop ((:for a (in-list '(1 2 3 4))) | ||||
|                ;; this works because :acc bindings are promoted "outwards". | ||||
|                (:break final) | ||||
|                (:acc final (in-value (initial #f) #t (if (= 3 a)))) | ||||
|                (:acc final (in-value (:initial #f) #t (:if (= 3 a)))) | ||||
|                (:acc acc (listing (cons a b))))) | ||||
|       </example> | ||||
| 
 | ||||
|  | @ -388,23 +388,23 @@ | |||
| 
 | ||||
|       Another small thing is that for some :acc-clauses, the `binding` may sometimes only be visible to the user in the `final-expr`, but like :for-clauses they sometimes offer the programmer to name the loop variables. | ||||
| 
 | ||||
|       Many accumulating clauses support an `if` form. If such a clause is given, accumulation will only happen if the guard clause returns true. | ||||
|       Many accumulating clauses support an `:if` form. If such a clause is given, accumulation will only happen if the guard clause returns true. | ||||
| 
 | ||||
|       <spec> | ||||
|       <syntax name="listing"> | ||||
|         <form>(:acc binding (listing [(:initial init)] expr [if guard]))</form> | ||||
|         <form>(:acc binding (listing [(:initial init)] expr [(:if guard)]))</form> | ||||
| 
 | ||||
|         Accumulates `expr` into a list. ´binding` is only accesible in the final-expression. The list is in the same order as the loop bodies were evaluated. If `initial` is given that will be used as the tail of the accumulated results. It defaults to `'()`. | ||||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="listing-reverse"> | ||||
|         <form>(:acc binding (listing-reverse [(:initial init)] expr [if guard]))</form> | ||||
|         <form>(:acc binding (listing-reverse [(:initial init)] expr [(:if guard)]))</form> | ||||
| 
 | ||||
|         The same as `listing` but the resulting list in in reverse order. If the order of the resulting list does not matter, this will be faster than the regular listing as it will not preform any reverse at the end. | ||||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="appending"> | ||||
|         <form>(:acc binding (appending [(:initial init)] expr [if guard]))</form> | ||||
|         <form>(:acc binding (appending [(:initial init)] expr [(:if guard)]))</form> | ||||
| 
 | ||||
|         `expr` evaluates to a list that is then appended to the accumulated result. | ||||
| 
 | ||||
|  | @ -417,7 +417,7 @@ | |||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="appending-reverse"> | ||||
|         <form>(:acc binding (appending-reverse [(:initial init)] expr [if guard]))</form> | ||||
|         <form>(:acc binding (appending-reverse [(:initial init)] expr [(:if guard)]))</form> | ||||
| 
 | ||||
|         `expr` evaluates to a list that is then consed element by element onto the already accumulated results. The default initial value is `'()`. | ||||
| 
 | ||||
|  | @ -430,31 +430,31 @@ | |||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="summing"> | ||||
|         <form>(:acc binding (summing [(:initial init)] expr [(if guard)]))</form> | ||||
|         <form>(:acc binding (summing [(:initial init)] expr [(:if guard)]))</form> | ||||
| 
 | ||||
|         Adds the result of `expr` together using `+`. The default initial value is 0. | ||||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="multiplying"> | ||||
|         <form>(:acc binding (multiplying [(:initial init)] expr [(if guard)]))</form> | ||||
|         <form>(:acc binding (multiplying [(:initial init)] expr [(:if guard)]))</form> | ||||
| 
 | ||||
|         Multiplies the result of `expr` using `*`. The default initial value is 1. | ||||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="hashing"> | ||||
|         <form>(:acc binding (hashing [(:initial init)] key value [(if guard)]))</form> | ||||
|         <form>(:acc binding (hashing [(:initial init)] key value [(:if guard)]))</form> | ||||
| 
 | ||||
|         Adds the mapping `(key => value)` to the hashtable `binding` using equal?-hashing. The initial hash table is an empty hash-table. `binding` is bound to the hash table throughout the loop, and its content can be mutated in the loop body. | ||||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="hashving"> | ||||
|         <form>(:acc binding (hashving [(:initial init)] key value [(if guard)]))</form> | ||||
|         <form>(:acc binding (hashving [(:initial init)] key value [(:if guard)]))</form> | ||||
| 
 | ||||
|         Adds the mapping `(key => value)` to the hashtable `binding` using eqv?-hashing. The initial hash table is an empty hash-table. `binding` is bound to the hash table throughout the loop, and its content can be mutated in the loop body. | ||||
|       </syntax> | ||||
| 
 | ||||
|       <syntax name="hashqing"> | ||||
|         <form>(:acc binding (hashqing [(:initial init)] key value [(if guard)]))</form> | ||||
|         <form>(:acc binding (hashqing [(:initial init)] key value [(:if guard)]))</form> | ||||
| 
 | ||||
|         Adds the mapping `(key => value)` to a hashtable using eq?-hashing. The initial hash table is an empty hash-table.`binding` is bound to the hash table throughout the loop, and its can be mutated in the loop body. | ||||
|       </syntax> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus
						Linus