| 
									
										
										
										
											2008-02-05 00:30:59 -05:00
										 |  |  | ! Copyright (C) 2004, 2008 Slava Pestov. | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2008-01-01 14:54:14 -05:00
										 |  |  | USING: inference.backend inference.state inference.dataflow | 
					
						
							| 
									
										
										
										
											2007-09-29 19:43:03 -04:00
										 |  |  | inference.known-words inference.transforms inference.errors | 
					
						
							| 
									
										
										
										
											2008-02-05 00:30:59 -05:00
										 |  |  | kernel io effects namespaces sequences quotations vocabs | 
					
						
							|  |  |  | generic words ;
 | 
					
						
							| 
									
										
										
										
											2008-01-01 14:54:14 -05:00
										 |  |  | IN: inference | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | GENERIC: infer ( quot -- effect )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: callable infer ( quot -- effect )
 | 
					
						
							| 
									
										
										
										
											2008-06-11 03:58:38 -04:00
										 |  |  |     [ recursive-state get infer-quot ] with-infer drop ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : infer. ( quot -- )
 | 
					
						
							| 
									
										
										
										
											2008-06-11 03:58:38 -04:00
										 |  |  |     #! Safe to call from inference transforms. | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     infer effect>string print ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-27 04:00:54 -04:00
										 |  |  | GENERIC: dataflow ( quot -- dataflow )
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-27 04:00:54 -04:00
										 |  |  | M: callable dataflow | 
					
						
							| 
									
										
										
										
											2008-06-11 03:58:38 -04:00
										 |  |  |     #! Not safe to call from inference transforms. | 
					
						
							| 
									
										
										
										
											2007-09-27 04:00:54 -04:00
										 |  |  |     [ f infer-quot ] with-infer nip ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-27 04:00:54 -04:00
										 |  |  | GENERIC# dataflow-with 1 ( quot stack -- dataflow )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: callable dataflow-with | 
					
						
							| 
									
										
										
										
											2008-06-11 03:58:38 -04:00
										 |  |  |     #! Not safe to call from inference transforms. | 
					
						
							| 
									
										
										
										
											2007-09-27 04:00:54 -04:00
										 |  |  |     [ | 
					
						
							|  |  |  |         V{ } like meta-d set
 | 
					
						
							|  |  |  |         f infer-quot | 
					
						
							|  |  |  |     ] with-infer nip ;
 | 
					
						
							| 
									
										
										
										
											2007-12-21 21:18:24 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-24 19:40:09 -05:00
										 |  |  | : forget-errors ( -- )
 | 
					
						
							| 
									
										
										
										
											2008-02-05 00:30:59 -05:00
										 |  |  |     all-words [ | 
					
						
							| 
									
										
										
										
											2008-06-08 16:32:55 -04:00
										 |  |  |         dup subwords [ f "cannot-infer" set-word-prop ] each
 | 
					
						
							|  |  |  |         f "cannot-infer" set-word-prop | 
					
						
							| 
									
										
										
										
											2008-02-05 00:30:59 -05:00
										 |  |  |     ] each ;
 |