;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; MeTTa allows to use a separate knowledge base (Space) &kb ; to accumulate inferred knowledge ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Bind &kb to a new empty Space !(bind! &kb (new-space)) ; Some knowledge (= (frog $x) (and (croaks $x) (eat_flies $x))) (= (croaks Fritz) True) (= (eat_flies Fritz) True) (= (croaks Sam) True) (= (eat_flies Sam) True) (= (green $x) (frog $x)) ; Define conditional (: ift (-> Bool Atom Atom)) (= (ift True $then) $then) ; For anything that is green, assert it is Green in &kb ; There should be two green things !(assertEqualToResult (ift (green $x) (add-atom &kb (Green $x))) (() ())) ; Retrieve the inferred Green things: Fritz and Sam. !(assertEqualToResult (match &kb (Green $x) $x) (Fritz Sam))