add smart-if to combinators.smart
							parent
							
								
									507e2b7f3a
								
							
						
					
					
						commit
						2936f05ce0
					
				|  | @ -1,7 +1,7 @@ | ||||||
| ! Copyright (C) 2009 Doug Coleman. | ! Copyright (C) 2009 Doug Coleman. | ||||||
| ! See http://factorcode.org/license.txt for BSD license. | ! See http://factorcode.org/license.txt for BSD license. | ||||||
| USING: accessors fry generalizations kernel macros math.order | USING: accessors fry generalizations kernel macros math.order | ||||||
| stack-checker math ; | stack-checker math sequences ; | ||||||
| IN: combinators.smart | IN: combinators.smart | ||||||
| 
 | 
 | ||||||
| MACRO: drop-outputs ( quot -- quot' ) | MACRO: drop-outputs ( quot -- quot' ) | ||||||
|  | @ -39,3 +39,9 @@ MACRO: append-outputs-as ( quot exemplar -- newquot ) | ||||||
| 
 | 
 | ||||||
| MACRO: append-outputs ( quot -- seq ) | MACRO: append-outputs ( quot -- seq ) | ||||||
|     '[ _ { } append-outputs-as ] ; |     '[ _ { } append-outputs-as ] ; | ||||||
|  | 
 | ||||||
|  | MACRO: preserving ( quot -- ) | ||||||
|  |     [ infer in>> length ] keep '[ _ ndup @ ] ; | ||||||
|  | 
 | ||||||
|  | MACRO: smart-if ( pred true false -- ) | ||||||
|  |     '[ _ preserving _ _ if ] ; inline | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue