Time 1727698126.357399
hyperon_source_dir ../../../hyperon-experimental/lib/src/
prolog_source_dir ../canary/
metta_std_lib_dir ../canary/
search_metta_files_dir ../../tests/
search_metta_files_else_where_dir ../../tests/extended_compat/metta-examples/
examples_source_dir ../../../metta-examples-main/
python_source_dir ../../../hyperon-experimental/python/
metta_python_source_dir ../../../hyperon-experimental/python/
| function | Rust | Prolog | Occurs in metta-files | Has metta-files | Has @doc | @doc TYPE decl | Num of metta-test | Has metta-testf |
---|
1 ../../../hyperon-experimental/python/tests/test_run_metta.py :22 self.assertEqualMettaRunnerResults(metta.run(program),
[metta.parse_all('red green blue'), metta.parse_all('5')])
2 ../../../hyperon-experimental/python/tests/test_run_metta.py :34 self.assertEqual('[[B]]', repr(result))
3 ../../../hyperon-experimental/python/tests/test_run_metta.py :50 self.assertEqual('[[(Cons a1 (Cons a2 (Cons b1 (Cons b2 Nil))))]]', repr(result))
4 ../../../hyperon-experimental/python/tests/test_run_metta.py :60 self.assertEqual('[[5]]', repr(result))
5 ../../../hyperon-experimental/python/tests/test_run_metta.py :69 self.assertEqual('[[1]]', repr(result))
6 ../../../hyperon-experimental/python/tests/test_pln_tv.py :12 metta.run('''
(= (min $a $b) (if (< $a $b) $a $b))
(= (s-tv (stv $s $c)) $s)
(= (c-tv (stv $s $c)) $c)
(= (stv (And $a $b))
(stv (min (s-tv (stv $a)) (s-tv (stv $b)))
(min (c-tv (stv $a)) (c-tv (stv $b)))))
(= (stv (P A)) (stv 0.5 0.8))
(= (stv (P B)) (stv 0.3 0.9))
''')
7 ../../../hyperon-experimental/python/tests/test_pln_tv.py :23 metta.run('''
(: A Concept)
(: B Concept)
(: P Predicate)
''')
8 ../../../hyperon-experimental/python/tests/test_pln_tv.py :28 self.assertEqualMettaRunnerResults(
metta.run('!(stv (And (P A) (P B)))'),
[metta.parse_all('(stv 0.3 0.8)')])
9 ../../../hyperon-experimental/python/tests/test_pln_tv.py :31 metta.run('''
(= (pln $expr) ($expr (stv $expr)))
''')
10 ../../../hyperon-experimental/python/tests/test_pln_tv.py :38 self.assertEqualMettaRunnerResults(
metta.run('!(pln (And (P A) (P $x)))'),
[metta.parse_all('''
((And (P A) (P A)) (stv 0.5 0.8))
((And (P A) (P B)) (stv 0.3 0.8))
''')])
11 ../../../hyperon-experimental/python/tests/test_environment.py :12 self.assertEqual(Environment.config_dir(), "/tmp/hyperon-test")
12 ../../../hyperon-experimental/python/tests/test_custom_space.py :76 self.assertEqual(kb.atom_count(), 2)
13 ../../../hyperon-experimental/python/tests/test_custom_space.py :77 self.assertEqual(kb.get_payload().test_attrib, "Test Space Payload Attrib")
14 ../../../hyperon-experimental/python/tests/test_custom_space.py :121 self.assertEqual(result_atom, space_atom)
15 ../../../hyperon-experimental/python/tests/test_custom_space.py :138 self.assertEqual([[S("B")]], result)
16 ../../../hyperon-experimental/python/tests/test_custom_space.py :150 self.assertEqual(metta.space().get_payload().test_attrib, "Test Space Payload Attrib")
17 ../../../hyperon-experimental/python/tests/test_custom_space.py :151 self.assertEqualMettaRunnerResults(metta.run("!(match &self (= key $val) $val)"),
[[S("val")]]
)
18 ../../../hyperon-experimental/python/tests/test_grounded_type.py :10 self.assertEqual(
metta.parse_single("+").get_grounded_type(),
metta.parse_single("*").get_grounded_type())
19 ../../../hyperon-experimental/python/tests/test_grounded_type.py :13 self.assertEqual(
metta.run("!(+ (* 1 4) 2)")[0][0].get_grounded_type(),
metta.parse_single("0").get_grounded_type())
20 ../../../hyperon-experimental/python/tests/test_grounded_type.py :16 self.assertEqual(
metta.run("!(or True False)")[0][0].get_grounded_type(),
metta.parse_single("False").get_grounded_type())
21 ../../../hyperon-experimental/python/tests/test_grounded_type.py :19 self.assertEqual(
metta.run("!(> (* 2 2) 1)")[0][0].get_grounded_type(),
metta.run("!(or True True)")[0][0].get_grounded_type())
22 ../../../hyperon-experimental/python/tests/test_grounded_type.py :24 self.assertEqual(
metta.run("!(untop)")[0][0],
metta.parse_single("()"))
23 ../../../hyperon-experimental/python/tests/test_grounded_type.py :28 metta.run("!(> 1 1)")[0][0].get_grounded_type(),
24 ../../../hyperon-experimental/python/tests/test_grounded_type.py :29 metta.run("!(+ 1 1)")[0][0].get_grounded_type())
def test_higher_func(self):
metta = MeTTa(env_builder=Environment.test_env())
metta.register_atom(
25 ../../../hyperon-experimental/python/tests/test_grounded_type.py :44 self.assertEqual(metta.run("!((curry_num + 1) 2)"),
metta.run("! 3"))
26 ../../../hyperon-experimental/python/tests/test_grounded_type.py :52 v1 = metta.run("!(id_num (+ 2 2))")[0]
27 ../../../hyperon-experimental/python/tests/test_grounded_type.py :53 v2 = metta.run("! 4")[0]
28 ../../../hyperon-experimental/python/tests/test_grounded_type.py :54 v3 = metta.run("!(as_int (+ 2 2))")[0]
29 ../../../hyperon-experimental/python/tests/test_grounded_type.py :55 self.assertEqual(v1, v2)
30 ../../../hyperon-experimental/python/tests/test_grounded_type.py :56 self.assertEqual(v1[0].get_grounded_type(), v2[0].get_grounded_type())
31 ../../../hyperon-experimental/python/tests/test_grounded_type.py :59 self.assertEqual(metta.run("!(id_num untyp)"), [metta.parse_all("(id_num untyp)")])
32 ../../../hyperon-experimental/python/tests/test_grounded_type.py :61 metta.run("(: myAtom myType)")
33 ../../../hyperon-experimental/python/tests/test_grounded_type.py :62 self.assertEqual(metta.run('''
!(id_num myAtom)
!(id_num False)
'''),
[[E(S('Error'), S('myAtom'), S('BadType'))]])
34 ../../../hyperon-experimental/python/tests/test_grounded_type.py :72 self.assertEqual(metta.run('''
!(id_atom 1)
!(id_atom myAtom)
!(id_atom untyp)
''', flat=True),
metta.parse_all('''
1
myAtom
untyp
'''))
35 ../../../hyperon-experimental/python/tests/test_grounded_type.py :83 # self.assertEqual(metta.run("!(id_atom (+ 1 1))"), [metta.parse_all("(+ 1 1)")])
36 ../../../hyperon-experimental/python/tests/test_grounded_type.py :89 self.assertEqual(metta.run('''
!(id_poly_w 1)
!(id_poly_w myAtom)
!(id_poly_w untyp)
!(id_poly_w (+ 1 1))
!(+ 1 (id_poly_w 2))
''', flat=True),
metta.parse_all('''
1
myAtom
untyp
2
3
''')
)
37 ../../../hyperon-experimental/python/tests/test_grounded_type.py :111 self.assertEqual(metta.run('''
!(id_undef 1)
!(id_undef False)
!(id_undef (+ 1 1))
''', flat=True),
metta.parse_all("1 False 2"))
38 ../../../hyperon-experimental/python/tests/test_grounded_type.py :118 self.assertEqual(metta.run('''
!(id_undef myAtom)
!(id_undef untyp)
''', flat=True),
metta.parse_all('''
(id_undef myAtom)
(id_undef untyp)
''')
)
39 ../../../hyperon-experimental/python/tests/test_metta.py :11 self.assertEqual(atom, E(S('A'), S('B')))
40 ../../../hyperon-experimental/python/tests/test_metta.py :15 self.assertEqual(atom, E(S('C'), S('B')))
41 ../../../hyperon-experimental/python/tests/test_metta.py :19 self.assertEqual(atom, E(S('F'), S('B')))
42 ../../../hyperon-experimental/python/tests/test_metta.py :35 self.assertEqual([[S('T')]], result)
43 ../../../hyperon-experimental/python/tests/test_metta.py :51 self.assertEqual([S('T')], result)
44 ../../../hyperon-experimental/python/tests/test_metta.py :66 self.assertEqual(repr(results), "[[10]]")
45 ../../../hyperon-experimental/python/tests/test_metta.py :75 self.assertEqual([[E(S('Error'), ValueAtom('String'), S('BadType'))]], result)
46 ../../../hyperon-experimental/python/tests/test_metta.py :86 self.assertEqual(e.args[0], 'Unexpected end of expression')
47 ../../../hyperon-experimental/python/tests/test_metta.py :99 self.assertEqual([[]], result)
48 ../../../hyperon-experimental/python/tests/test_stdlib.py :11 self.assertEqualMettaRunnerResults(metta.run("!(repr (my atom))"),
[[ValueAtom("(my atom)")]])
49 ../../../hyperon-experimental/python/tests/test_stdlib.py :15 self.assertEqualMettaRunnerResults(metta.run("!(parse \"(my atom)\")"),
[[E(S("my"), S("atom"))]])
50 ../../../hyperon-experimental/python/tests/test_stdlib.py :19 #self.assertEqualMettaRunnerResults(metta.run('!(parse "$X")'),
# [[(V("X"))]])
51 ../../../hyperon-experimental/python/tests/test_stdlib.py :22 self.assertEqualMettaRunnerResults(metta.run('!(parse "\\"A\\"")'),
[[(ValueAtom("A"))]])
52 ../../../hyperon-experimental/python/tests/test_stdlib.py :25 #self.assertEqualMettaRunnerResults(metta.run('!(parse "(func (Cons $x (Cons $xs $xss))) ")'),
# [[E(S("func"), E(S("Cons"), V("x"), E(S("Cons"), V("xs"), V("xss"))))]])
53 ../../../hyperon-experimental/python/tests/test_stdlib.py :28 self.assertEqualMettaRunnerResults(metta.run('!(parse "(A 2 \'S\')")'),
[[E(S("A"), ValueAtom(2), ValueAtom(Char("S")))]])
54 ../../../hyperon-experimental/python/tests/test_stdlib.py :32 self.assertEqualMettaRunnerResults(metta.run('!(stringToChars "ABC")'),
[[E(ValueAtom(Char("A")), ValueAtom(Char("B")), ValueAtom(Char("C")))]])
55 ../../../hyperon-experimental/python/tests/test_stdlib.py :36 self.assertEqualMettaRunnerResults(metta.run("!(charsToString ('A' 'B' 'C'))"),
[[ValueAtom("ABC")]])
56 ../../../hyperon-experimental/python/tests/test_stdlib.py :44 metta.run('''
! (bind! &pow (py-atom math.pow (-> Number Number Number)))
! (bind! &math (py-atom math))
''')
57 ../../../hyperon-experimental/python/tests/test_stdlib.py :48 self.assertEqual(metta.run('! (&pow 2 3)'),
metta.run('! ((py-dot &math pow) 2 3)'))
58 ../../../hyperon-experimental/python/tests/test_stdlib.py :50 self.assertEqual([[ValueAtom(3)]],
metta.run('! ((py-dot &math floor) (py-dot &math pi))'))
59 ../../../hyperon-experimental/python/tests/test_stdlib.py :55 self.assertEqual([[ValueAtom('f')]],
metta.run('! ((py-dot (py-atom "{5: \'f\'}") get) 5)'))
60 ../../../hyperon-experimental/python/tests/test_stdlib.py :58 self.assertEqual([[ValueAtom('5')]],
metta.run('! ((py-atom str) 5)'))
61 ../../../hyperon-experimental/python/tests/test_stdlib.py :61 self.assertEqual([[ValueAtom("/usr")]],
metta.run('''
! ((py-dot (py-atom os) path.commonpath)
(py-atom "['/usr/lib', '/usr/local/lib']"))
'''))
62 ../../../hyperon-experimental/python/tests/test_stdlib.py :70 self.assertEqualMettaRunnerResults(metta.run("!(+ 1 2)"), [[ValueAtom(3)]])
63 ../../../hyperon-experimental/python/tests/test_stdlib.py :71 self.assertEqualMettaRunnerResults(metta.run("!(+ 5.0 -2.0)"), [[ValueAtom(3.0)]])
64 ../../../hyperon-experimental/python/tests/test_stdlib.py :72 self.assertEqualMettaRunnerResults(metta.run("!(+ 1.0e3 2.0e3)"), [[ValueAtom(3e3)]])
65 ../../../hyperon-experimental/python/tests/test_stdlib.py :73 self.assertEqualMettaRunnerResults(metta.run("!(+ 5e-3 -2e-3)"), [[ValueAtom(3e-3)]])
66 ../../../hyperon-experimental/python/tests/test_stdlib.py :77 metta.run('''(= (intent regex:"^Hello[[\.|!]]?$") (Intent Hello))
(= (intent regex:"Good~morning.*[[\\.|!]]?") (Intent Hello))
(= (intent $x) (empty))''')
67 ../../../hyperon-experimental/python/tests/test_stdlib.py :80 self.assertEqual(metta.run('!(intent "hello")', True), [E(S("Intent"), S("Hello"))])
68 ../../../hyperon-experimental/python/tests/test_stdlib.py :82 self.assertEqual(metta.run('!(intent "Good morning my friend!")', True),
[E(S("Intent"), S("Hello"))])
69 ../../../hyperon-experimental/python/tests/test_stdlib.py :85 self.assertEqual(metta.run('!(intent "Hi")', True), [])
70 ../../../hyperon-experimental/python/tests/test_stdlib.py :89 self.assertEqual(metta.run('!(py-list ())'), [[ValueAtom( [] )]])
71 ../../../hyperon-experimental/python/tests/test_stdlib.py :90 self.assertEqual(metta.run('!(py-tuple ())'), [[ValueAtom( () )]])
72 ../../../hyperon-experimental/python/tests/test_stdlib.py :91 self.assertEqual(metta.run('!(py-dict ())'), [[ValueAtom( {} )]])
73 ../../../hyperon-experimental/python/tests/test_stdlib.py :92 self.assertEqual(metta.run('!(py-tuple (1 (2 (3 "3")) (py-atom list)))'), [[ValueAtom((1,(2,(3, "3")), list))]])
74 ../../../hyperon-experimental/python/tests/test_stdlib.py :93 self.assertEqual(metta.run('!(py-list (1 2 (4.5 3)))'), [[ValueAtom( [1,2,[4.5,3]] )]])
75 ../../../hyperon-experimental/python/tests/test_stdlib.py :94 self.assertEqual(metta.run('!(py-list (1 2 (py-tuple (3 4))))'), [[ValueAtom( [1,2, (3,4)] )]])
76 ../../../hyperon-experimental/python/tests/test_stdlib.py :96 self.assertEqual(metta.run('!(py-dict ((a "b") ("b" "c")))'), [[ValueAtom( {"a":"b", "b":"c"} )]])
77 ../../../hyperon-experimental/python/tests/test_stdlib.py :98 self.assertEqual(str(metta.run('!(py-list (a b c))')[0][0].get_object().content[2]), "c")
78 ../../../hyperon-experimental/python/tests/test_stdlib.py :101 self.assertEqual(metta.run('!(py-chain (1 2 3 4))'), [[ValueAtom( 7 )]])
79 ../../../hyperon-experimental/python/tests/test_stdlib.py :104 self.assertRaises(Exception, metta.run('!(py-dict (("a" "b" "c") ("b" "c")))'))
80 ../../../hyperon-experimental/python/tests/test_stdlib.py :107 self.assertRaises(Exception, metta.run('!(py-dict (("a") ("b" "c")))'))
81 ../../../hyperon-experimental/python/tests/test_stdlib.py :110 self.assertRaises(Exception, metta.run('!(py-dict ("a" "b") ("b" "c"))'))
82 ../../../hyperon-experimental/python/tests/test_stdlib.py :113 self.assertRaises(Exception, metta.run('!(py-list 1 2)'))
83 ../../../hyperon-experimental/python/tests/test_stdlib.py :116 self.assertRaises(Exception, metta.run('!(py-list 1)'))
84 ../../../hyperon-experimental/python/tests/test_minecraft.py :42 metta.run('''
(= (wood) (spruce-wood))
(= (spruce-wood) (mine spruce-tree hand))
(= (four-planks) (craft four-planks inventory (wood)))
(= (pack $n planks) (if (> $n 0) (allof (four-planks) (pack (- $n 4) planks)) nop))
(= (crafting-table) (craft crafting-table inventory (pack 4 planks)))
(= (stick) (craft stick inventory (pack 2 planks)))
(= (pack $n sticks) (if (> $n 0) (allof (stick) (pack (- $n 1) sticks)) nop))
(= (wooden-pickaxe) (craft wooden-pickaxe
(crafting-table) (allof (pack 3 planks) (pack 2 sticks))))
(= (cobblestone) (mine cobble-ore (wooden-pickaxe)))
(= (pack $n cobblestones) (if (> $n 0) (allof (cobblestone) (pack (- $n 1) cobblestones)) nop))
(= (stone-pickaxe) (craft stone-pickaxe (crafting-table)
(allof (pack 3 cobblestones) (pack 2 sticks))))
''')
85 ../../../hyperon-experimental/python/tests/test_minecraft.py :65 metta.run('!(wooden-pickaxe)')
86 ../../../hyperon-experimental/python/tests/test_minecraft.py :77 metta.run('''
(= (can-be-mined diamond) True)
(= (can-be-made diamond) False)
(= (diamond mined-using iron-pickaxe) True)
(= (diamond mined-from diamond-ore) True)
(= (can-be-made iron-pickaxe) True)
(= (can-be-mined iron-pickaxe) False)
(= (iron-pickaxe made-from
(, stick stick iron-ingot iron-ingot iron-ingot)) True)
(= (iron-pickaxe made-at crafting-table) True)
(= (can-be-made crafting-table) True)
(= (can-be-mined crafting-table) False)
(= (crafting-table made-from (pack 4 plank)) True)
(= (crafting-table made-at inventory) True)
(= (can-be-made inventory) False)
(= (can-be-mined inventory) False)
(= (make $x) (if (and ($x made-from $comp) ($x made-at $tool))
(, (get $tool) (get $comp) (do-make $x $tool $comp)) (empty)))
(= (mine $x) (if (and ($x mined-using $tool) ($x mined-from $source))
(, (get $tool) (find $source) (do-mine $x $source $tool)) (empty)))
87 ../../../hyperon-experimental/python/tests/test_minecraft.py :107 metta.run('!(get diamond)')
88 ../../../hyperon-experimental/python/tests/test_examples.py :21 self.assertEqual(result, [Atoms.UNIT])
89 ../../../hyperon-experimental/python/tests/test_examples.py :24 self.assertEqual(repr(result), '[((py-dot &obj foo))]')
90 ../../../hyperon-experimental/python/tests/test_examples.py :31 self.assertEqualMettaRunnerResults(
metta.run('''
! (&f 2 4 6)
! (&f 0)
! (&f (Kwargs (y 4)))
! (&f 2 (Kwargs (z 1)))
! (&f 0 (Kwargs (z 1) (y 1)))
'''),
[[ValueAtom(12)],
[ValueAtom(6)],
[ValueAtom(9)],
[ValueAtom(5)],
[ValueAtom(2)]]
)
91 ../../../hyperon-experimental/python/tests/test_examples.py :49 metta.run(
'''
(= (remove-st $var)
(match &self (state $var $y)
(remove-atom &self (state $var $y))))
(= (change-st $var $value)
(superpose ((remove-st $var)
(add-atom &self (state $var $value)))))
(= (get-st $var)
(match &self (state $var $value) $value))
''')
92 ../../../hyperon-experimental/python/tests/test_examples.py :60 metta.run('!(change-st (name id-001) Fritz)')
93 ../../../hyperon-experimental/python/tests/test_examples.py :61 self.assertEqualMettaRunnerResults(metta.run('!(get-st (name id-001))'),
[[S('Fritz')]])
94 ../../../hyperon-experimental/python/tests/test_examples.py :63 metta.run('!(change-st (name id-001) Sam)')
95 ../../../hyperon-experimental/python/tests/test_examples.py :64 self.assertEqualMettaRunnerResults(metta.run('!(get-st (name id-001))'),
[[S('Sam')]])
96 ../../../hyperon-experimental/python/tests/test_examples.py :77 self.assertEqual(metta.run('! pglob')[0][0].get_object().value.get(), 10)
97 ../../../hyperon-experimental/python/tests/test_examples.py :82 metta.run('!((py-dot (Setter pglob 5) act))')
98 ../../../hyperon-experimental/python/tests/test_examples.py :83 self.assertEqual(pglob.get(), 5)
99 ../../../hyperon-experimental/python/tests/test_examples.py :84 self.assertEqual(metta.run('! pglob')[0][0].get_object().value.get(), 5)
100 ../../../hyperon-experimental/python/tests/test_examples.py :87 metta.run('!((py-dot (Setter ploc 5) let))')
101 ../../../hyperon-experimental/python/tests/test_examples.py :88 self.assertEqual(ploc, 10)
102 ../../../hyperon-experimental/python/tests/test_examples.py :89 self.assertEqual(metta.run('! ploc')[0][0].get_object().value, 10)
103 ../../../hyperon-experimental/python/tests/test_examples.py :97 self.assertEqual(t.get_children()[1].get_children()[1].get_object().value, 5)
104 ../../../hyperon-experimental/python/tests/test_examples.py :100 self.assertEqual(metta.run('! ploc')[0][0].get_object().value, 10)
105 ../../../hyperon-experimental/python/tests/test_examples.py :106 metta.run('!((py-dot (Setter ploca 5) let))')
106 ../../../hyperon-experimental/python/tests/test_examples.py :107 self.assertEqual(metta.run('! ploca')[0][0].get_object().value, 10)
107 ../../../hyperon-experimental/python/tests/test_examples.py :108 self.assertEqual(ploca.get_object().value, 10)
108 ../../../hyperon-experimental/python/tests/test_examples.py :110 metta.run('!((py-dot (SetAtom ploca 5) latom))')
109 ../../../hyperon-experimental/python/tests/test_examples.py :111 self.assertEqual(metta.run('! ploca')[0][0].get_object().value, 5)
110 ../../../hyperon-experimental/python/tests/test_examples.py :112 self.assertEqual(ploca.get_object().value, 5)
111 ../../../hyperon-experimental/python/tests/test_examples.py :117 metta.run('''
(= (croaks Fritz) True)
(= (chirps Tweety) True)
(= (yellow Tweety) True)
(= (eats_flies Tweety) True)
(= (eats_flies Fritz) True)
''')
112 ../../../hyperon-experimental/python/tests/test_examples.py :125 fritz_frog = metta.run('!(if (and (croaks $x) (eats_flies $x)) (= (frog $x) True) nop)')[0]
113 ../../../hyperon-experimental/python/tests/test_examples.py :126 self.assertEqual(metta.parse_all('(= (frog Fritz) True)'), fritz_frog)
114 ../../../hyperon-experimental/python/tests/test_examples.py :129 self.assertEqualMettaRunnerResults([metta.parse_all('(= (green Fritz) True)')],
metta.run('!(if (frog $x) (= (green $x) True) nop)'))
115 ../../../hyperon-experimental/python/tests/test_examples.py :135 metta.run('''
(= (: (apply\' $f $x) $r) (and (: $f (=> $a $r)) (: $x $a)))
(= (: reverse (=> String String)) True)
(= (: "Hello" String) True)
''')
116 ../../../hyperon-experimental/python/tests/test_examples.py :142 output = metta.run('!(if (: (apply\' reverse "Hello") $t) $t Wrong)')
117 ../../../hyperon-experimental/python/tests/test_examples.py :143 self.assertEqualMettaRunnerResults(output, [[S('String')]])
118 ../../../hyperon-experimental/python/tests/test_examples.py :148 metta.run('''
(= (eq $x $x) True)
(= (plus Z $y) $y)
(= (plus (S $k) $y) (S (plus $k $y)))
''')
119 ../../../hyperon-experimental/python/tests/test_examples.py :154 self.assertEqualMettaRunnerResults(metta.run('''
!(eq (+ 2 2) 4)
!(eq (+ 2 3) 4)
!(eq (plus Z $n) $n)
'''),
[[ValueAtom(True)],
metta.parse_all('(eq 5 4)'),
[ValueAtom(True)]
]
)
120 ../../../hyperon-experimental/python/tests/test_examples.py :164 output = metta.run('!(eq (plus (S Z) $n) $n)')
121 ../../../hyperon-experimental/python/tests/test_examples.py :189 self.assertEqualMettaRunnerResults(metta1.run('!(inverse B)'), [[S('A')]])
122 ../../../hyperon-experimental/python/tests/test_examples.py :190 self.assertEqualMettaRunnerResults(metta2.run('!(find-in &space1 B)'), [[S('A')]])
123 ../../../hyperon-experimental/python/tests/test_examples.py :191 self.assertEqualMettaRunnerResults(metta2.run('!(find-in &self B)'), [[S('C')]])
124 ../../../hyperon-experimental/python/tests/test_examples.py :194 self.assertEqualMettaRunnerResults(metta2.run('!(borrow &space1 (inverse B))'), [[S('A')]])
125 ../../../hyperon-experimental/python/tests/test_examples.py :198 self.assertEqualMettaRunnerResults(metta2.run('!(borrow &space1 (how-it-works?))'), [[S('success')]])
126 ../../../hyperon-experimental/python/tests/test_examples.py :199 self.assertEqualMettaRunnerResults(metta1.run('!(how-it-works?)'), [[S('failure')]])
127 ../../../hyperon-experimental/python/tests/test_examples.py :203 metta.run('''
(= (:? $c)
(match &self (:= $c $t) $t))
(= (:? ($c $a))
(let $at (:? $a)
(match &self (:= ($c $at) $t) $t)))
(= (:? ($c $a $b))
(let* (($at (:? $a))
($bt (:? $b)))
(match &self (:= ($c $at $bt) $t) $t)))
(= (:check $c $t)
(match &self (:= $c $t) T))
(= (:check ($c $a) $t)
(let $at (:? $a)
(match &self (:= ($c $at) $t) T)))
(= (:check ($c $a $b) $t)
(let* (($at (:? $a))
($bt (:? $b)))
(match &self (:= ($c $at $bt) $t) T)))
(:= (= $t $t) Prop)
(:= Entity Prop)
(:= (Human Entity) Prop)
(:= Socrates Entity)
128 ../../../hyperon-experimental/python/tests/test_examples.py :244 self.assertEqualMettaRunnerResults(metta.run('''
!(:? (HumansAreMortal SocratesIsHuman))
!(:check (HumansAreMortal SocratesIsHuman) (Mortal Socrates))
!(:? (= SocratesIsMortal (HumansAreMortal SocratesIsHuman)))
!(:check (= (Mortal Plato) (Mortal Socrates)) Prop)
!(:check (= (Human Socrates) (Mortal Socrates)) Prop)
!(:? (GreenAndCroaksIsFrog SamIsGreen SamCroaks))
'''),
[[E(S('Mortal'), S('Socrates'))],
[S('T')],
[S('Prop')],
[S('T')],
[S('T')], # they are both of Prop type and can be equated
[E(S('Frog'), S('Sam'))]
]
)
129 ../../../hyperon-experimental/python/tests/test_examples.py :261 self.assertEqualMettaRunnerResults(metta.run('''
!(:check (= SocratesIsHuman SocratesIsMortal) Prop)
!(:? (SocratesIsHuman (Human Socrates)))
!(:? (Human Time))
'''),
[[], [], []]
)
130 ../../../hyperon-experimental/python/tests/test_examples.py :272 # self.assertEqualMettaRunnerResults(metta.run("!(:? (HumansAreMortal (Human Time)))"),
# [[]])
131 ../../../hyperon-experimental/python/tests/test_examples.py :279 metta.run('''
(= (:? $c)
(match &self (:: $c $t) $t))
(= (:? ($c $a))
(let $at (:? $a)
(match &self (:: $c (-> $at $t)) $t)))
(= (:? ($c $a $b))
(let* (($at (:? $a))
($bt (:? $b)))
(match &self (:: $c (-> $at $bt $t)) $t)))
(:: = (-> $t $t Type))
(:: Entity Type)
(:: Human (-> Entity Type))
(:: Socrates Entity)
(:: Plato Entity)
(:: Mortal (-> Entity Type))
(:: HumansAreMortal (-> (Human $t) (Mortal $t)))
(:: SocratesIsHuman (Human Socrates))
(:: SocratesIsMortal (Mortal Socrates))
''')
132 ../../../hyperon-experimental/python/tests/test_examples.py :304 self.assertEqualMettaRunnerResults(metta.run('''
!(:? (Human Plato))
!(:? (Human Time))
!(:? (HumansAreMortal SocratesIsHuman))
!(:? (= SocratesIsMortal (HumansAreMortal SocratesIsHuman)))
!(:? (= Human Entity))
!(:? (= (Human Socrates) Plato))
!(:? (= SocratesIsHuman SocratesIsMortal))
!(:? (= (Human Socrates) (Human Plato)))
!(:? (= Human Mortal))
!(:? (= HumansAreMortal Mortal))
'''),
[[S('Type')],
[],
[E(S('Mortal'), S('Socrates'))],
[S('Type')],
[],
[],
[],
[S('Type')],
[S('Type')],
[]
]
)
133 ../../../hyperon-experimental/python/tests/test_examples.py :330 self.assertEqualMettaRunnerResults(metta.run("!(:? (HumansAreMortal (Human Socrates)))"), [[]])
134 ../../../hyperon-experimental/python/tests/test_examples.py :336 metta.run('''
(= (perform (visit $x)) (perform (lunch-order $x)))
(= (perform (visit $x)) (perform (health-check $x)))
(impl (is-achieved (visit $x))
(And (is-achieved (lunch-order $x)) (is-achieved (health-check $x))))
(= (achieve $goal)
(match &self (impl (is-achieved $goal)
(And (is-achieved $subgoal1) (is-achieved $subgoal2)))
(do $subgoal1 $subgoal2)))
(= (achieve (health-check Kim)) True)
(= (achieve (lunch-order Kim)) False)
''')
135 ../../../hyperon-experimental/python/tests/test_examples.py :351 self.assertEqualMettaRunnerResults(metta.run('''
!(perform (visit Kim))
!(achieve (visit Kim))
'''),
[metta.parse_all('(perform (lunch-order Kim)) (perform (health-check Kim))'),
metta.parse_all('(do (lunch-order Kim) (health-check Kim))')]
)
136 ../../../hyperon-experimental/python/tests/test_examples.py :358 metta.run('''
(= (do $goal1 $goal2) (achieve $goal1))
(= (do $goal1 $goal2) (achieve $goal2))
''')
137 ../../../hyperon-experimental/python/tests/test_examples.py :362 self.assertEqualMettaRunnerResults(metta.run('!(achieve (visit Kim))'),
[metta.parse_all('False True')])
138 ../../../hyperon-experimental/python/tests/test_examples.py :367 self.assertEqual(repr(metta.run("!('A')")), "[[('A')]]")
139 ../../../hyperon-experimental/python/tests/test_examples.py :368 self.assertEqual(repr(metta.run('!("A")')), '[[("A")]]')
140 ../../../hyperon-experimental/python/tests/test_examples.py :369 self.assertEqualMettaRunnerResults(metta.run("!(get-type 'A')"), [[S('Char')]])
141 ../../../hyperon-experimental/python/tests/test_examples.py :370 self.assertEqualMettaRunnerResults(metta.run('!(get-type "A")'), [[S('String')]])
142 ../../../hyperon-experimental/python/tests/test_common.py :53 def assertEqualMettaRunnerResults(self, left, right):
143 ../../../hyperon-experimental/python/tests/test_common.py :58 self.assertEqual(len(actual), len(expected),
"Actual and expected contains different number of atoms:" +
f"\n{actual}\n{expected}")
144 ../../../hyperon-experimental/python/tests/test_minelogy.py :113 self.assertEqual(repr(output),
'[(do-mine ((: stone type) (: stone variant)))]')
145 ../../../hyperon-experimental/python/tests/test_atom.py :8 self.assertEqual(S("a"), S("a"))
146 ../../../hyperon-experimental/python/tests/test_atom.py :12 self.assertEqual(str(S("a")), "a")
147 ../../../hyperon-experimental/python/tests/test_atom.py :15 self.assertEqual(S("a").get_metatype(), AtomKind.SYMBOL)
148 ../../../hyperon-experimental/python/tests/test_atom.py :18 self.assertEqual(S("a").get_name(), "a")
149 ../../../hyperon-experimental/python/tests/test_atom.py :21 self.assertEqual(S("здÑавÑÑвÑйÑе").get_name(), "здÑавÑÑвÑйÑе")
150 ../../../hyperon-experimental/python/tests/test_atom.py :24 self.assertEqual(V("x"), V("x"))
151 ../../../hyperon-experimental/python/tests/test_atom.py :28 self.assertEqual(str(V("x")), "$x")
152 ../../../hyperon-experimental/python/tests/test_atom.py :31 self.assertEqual(V("x").get_metatype(), AtomKind.VARIABLE)
153 ../../../hyperon-experimental/python/tests/test_atom.py :34 self.assertEqual(V("x").get_name(), "x")
154 ../../../hyperon-experimental/python/tests/test_atom.py :37 self.assertEqual(ValueAtom(1.0), ValueAtom(1.0))
155 ../../../hyperon-experimental/python/tests/test_atom.py :41 self.assertEqual(str(ValueAtom(1.0)), "1.0")
156 ../../../hyperon-experimental/python/tests/test_atom.py :42 self.assertEqual(str(ValueAtom("1.0")), '"1.0"')
157 ../../../hyperon-experimental/python/tests/test_atom.py :45 self.assertEqual(ValueAtom(1.0).get_metatype(), AtomKind.GROUNDED)
158 ../../../hyperon-experimental/python/tests/test_atom.py :49 self.assertEqual(atom.get_grounded_type(), S("Float"))
159 ../../../hyperon-experimental/python/tests/test_atom.py :54 self.assertEqual("Method copy should be implemented by grounded object",
str(context.exception))
160 ../../../hyperon-experimental/python/tests/test_atom.py :58 # self.assertEqual(ValueAtom(1.0).get_object().execute(VecAtom(),
# VecAtom()), "1.0 is not executable")
161 ../../../hyperon-experimental/python/tests/test_atom.py :63 self.assertEqual(res, [ValueAtom(2.0)])
162 ../../../hyperon-experimental/python/tests/test_atom.py :66 self.assertEqual(E(S("+"), S("1"), S("2")),
E(S("+"), S("1"), S("2")))
163 ../../../hyperon-experimental/python/tests/test_atom.py :70 self.assertEqual(E(x2Atom, ValueAtom(1.0)),
E(x2Atom, ValueAtom(1.0)))
164 ../../../hyperon-experimental/python/tests/test_atom.py :74 self.assertEqual(str(E(x2Atom, ValueAtom(1.0))), "(*2 1.0)")
165 ../../../hyperon-experimental/python/tests/test_atom.py :77 self.assertEqual(E(x2Atom, ValueAtom(1.0)).get_metatype(), AtomKind.EXPR)
166 ../../../hyperon-experimental/python/tests/test_atom.py :80 self.assertEqual(E(x2Atom, ValueAtom(1.0)).get_children(),
[x2Atom, ValueAtom(1.0)])
167 ../../../hyperon-experimental/python/tests/test_atom.py :89 self.assertEqual(kb_a.get_atoms(), kb_b.get_atoms())
168 ../../../hyperon-experimental/python/tests/test_atom.py :90 self.assertEqual(kb_a, kb_c)
169 ../../../hyperon-experimental/python/tests/test_atom.py :96 self.assertEqual(interpret(space, x2), [ValueAtom(2)])
170 ../../../hyperon-experimental/python/tests/test_atom.py :105 self.assertEqual(interpret(space, E(Atoms.METTA, expr, AtomType.UNDEFINED, G(space))),
[E(S('Error'), expr, S('Grounded operation which is defined using unwrap=False should return atom instead of Python type'))])
171 ../../../hyperon-experimental/python/tests/test_atom.py :118 self.assertEqual(interpret(space, printExpr), [E()])
172 ../../../hyperon-experimental/python/tests/test_atom.py :124 self.assertEqual(interpret(space, expr),
[E(noReduceAtom, ValueAtom(1))])
173 ../../../hyperon-experimental/python/tests/test_atom.py :132 self.assertEqual(AtomKind.SYMBOL.name, str(result[0]['atom_type']))
174 ../../../hyperon-experimental/python/tests/test_atom.py :134 self.assertEqual(AtomKind.EXPR.name, str(result[0]['atom_type']))
175 ../../../hyperon-experimental/python/tests/test_atom.py :137 self.assertEqual(AtomKind.GROUNDED.name, str(result[0]['atom_type']))
176 ../../../hyperon-experimental/python/tests/test_atom.py :139 self.assertEqual(S("MatchableAtom").get_name(), str(result[0]['Z']))
177 ../../../hyperon-experimental/python/tests/test_extend.py :16 self.assertEqual(
metta.run('''
!(import! &self extension)
!(get-by-key &my-dict "A")
!(get-by-key &my-dict 6)
'''),
[[E()],
[ValueAtom(5)],
[ValueAtom('B')]])
178 ../../../hyperon-experimental/python/tests/test_extend.py :25 self.assertEqual(
metta.run('! &runner')[0][0].get_object().value, metta)
179 ../../../hyperon-experimental/python/tests/test_extend.py :35 self.assertEqual(
metta.run('''
!(import! &self ext_dir)
!(get-by-key &my-dict "A")
!(get-by-key &my-dict 6)
'''),
[[E()],
[ValueAtom(5)],
[ValueAtom('B')]])
180 ../../../hyperon-experimental/python/tests/test_extend.py :44 self.assertEqual(
metta.run('! &runner')[0][0].get_object().value, metta)
181 ../../../hyperon-experimental/python/tests/test_extend.py :55 # self.assertEqual(
# metta.run('''
# !(import! &self ext_sub)
# !(get-by-key &my-dict "A")
# !(get-by-key &my-dict 6)
# '''),
# [[E()],
# [ValueAtom(5)],
# [ValueAtom('B')]])
182 ../../../hyperon-experimental/python/tests/test_extend.py :64 # self.assertEqual(
# metta.run('! &runner')[0][0].get_object().value, metta)
183 ../../../hyperon-experimental/python/tests/test_extend.py :72 self.assertEqual(
metta.run('''
!(import! &self ext_recursive:level-2:ext_nested)
!(get-by-key &my-dict "A")
!(get-by-key &my-dict 6)
'''),
[[E()],
[ValueAtom(5)],
[ValueAtom('B')]])
184 ../../../hyperon-experimental/python/tests/test_extend.py :81 self.assertEqual(
metta.run('! &runner')[0][0].get_object().value, metta)
185 ../../../hyperon-experimental/python/tests/test_extend.py :93 self.assertEqual(g_object, None)
186 ../../../hyperon-experimental/python/tests/test_extend.py :95 metta.run('''
!(import! &self extension)
!(set-global! 42)
''')
187 ../../../hyperon-experimental/python/tests/test_extend.py :100 self.assertEqual(
metta.run('!(get-global)'),
metta.run('! 42'))
188 ../../../hyperon-experimental/python/tests/test_extend.py :106 self.assertEqual(g_object, 42)
189 ../../../hyperon-experimental/python/tests/test_extend.py :115 result = metta.run("!(import! &self error_pyext)")
190 ../../../hyperon-experimental/python/tests/test_extend.py :116 self.assertEqual(S('Error'), result[0][0].get_children()[0])
191 ../../../hyperon-experimental/python/tests/test_modules.py :24 self.assertEqual(result[0].get_object().content, 3.14159)
192 ../../../hyperon-experimental/python/tests/test_modules.py :28 result = metta.run("""
(three isprime)
!(match &self ($x isprime) $x)
!(include test_include)
!(match &self ($x isprime) $x)
""")
193 ../../../hyperon-experimental/python/tests/test_modules.py :37 result = metta.run("!(match &self ($x notprime) $x)")
194 ../../../hyperon-experimental/python/tests/test_modules.py :38 self.assertEqual(result[0], [S("six")])
195 ../../../hyperon-experimental/python/tests/test_grounding_space.py :54 self.assertEqual([[S("B")]], result)
196 ../../../hyperon-experimental/python/tests/test_load.py :15 metta.run(f'''
!(bind! &space (new-space))
!(load-ascii &space {test_file})
''')
197 ../../../hyperon-experimental/python/tests/test_load.py :19 content = metta.run("!(match &space $x $x)")[0]
198 ../../../hyperon-experimental/python/tests/test_atom_type.py :29 self.assertEqual(get_atom_types(space, E(S("foo"), S("a"))), [S("B")])
199 ../../../hyperon-experimental/python/tests/test_atom_type.py :30 self.assertEqual(get_atom_types(space, E(S("foo"), S("b"))),
[])
200 ../../../hyperon-experimental/python/tests/test_atom_type.py :32 self.assertEqual(get_atom_types(space, S("foo")), [E(S("->"), S("A"), S("B"))])
201 ../../../hyperon-experimental/python/tests/test_bindings.py :26 #self.assertEqual(hp.bindings_to_str(bindings), "{ }")
202 ../../../hyperon-experimental/python/tests/test_bindings.py :33 self.assertEqual(bindings_as_str, "{ $x = y, $a = b }")
203 ../../../hyperon-experimental/python/tests/test_bindings.py :41 self.assertEqual(self.emptyBindings, cloned_empty)
204 ../../../hyperon-experimental/python/tests/test_bindings.py :45 self.assertEqual(self.bindings, cloned)
205 ../../../hyperon-experimental/python/tests/test_bindings.py :46 self.assertEqual(cloned, cloned_explicitly)
206 ../../../hyperon-experimental/python/tests/test_bindings.py :49 self.assertEqual(self.bindings, self.bindings)
207 ../../../hyperon-experimental/python/tests/test_bindings.py :50 self.assertEqual(self.emptyBindings, self.emptyBindings)
208 ../../../hyperon-experimental/python/tests/test_bindings.py :55 self.assertEqual(BindingsSet(self.emptyBindings), merged_empty)
209 ../../../hyperon-experimental/python/tests/test_bindings.py :59 self.assertEqual(merged_with_empty_rl, merged_with_empty_lr)
210 ../../../hyperon-experimental/python/tests/test_bindings.py :60 self.assertEqual(merged_with_empty_rl, BindingsSet(self.bindings))
211 ../../../hyperon-experimental/python/tests/test_bindings.py :63 self.assertEqual(merged_self, BindingsSet(self.bindings))
212 ../../../hyperon-experimental/python/tests/test_bindings.py :76 self.assertEqual(atom_expected, atom_resolved)
213 ../../../hyperon-experimental/python/tests/test_bindings.py :88 self.assertEqual(expected_name, x[0])
214 ../../../hyperon-experimental/python/tests/test_bindings.py :89 self.assertEqual(expected_atom, x[1])
215 ../../../hyperon-experimental/python/tests/test_bindings.py :110 self.assertEqual(set, no_longer_empty_set);
216 ../../../hyperon-experimental/python/tests/test_bindings.py :115 self.assertEqual(set, set_2)
217 ../../../hyperon-experimental/python/tests/test_bindings.py :118 self.assertEqual(set, cloned_set)
218 ../../../hyperon-experimental/python/tests/test_bindings.py :128 self.assertEqual(1, bindings_counter)
219 ../../../hyperon-experimental/python/tests/test_bindings.py :142 self.assertEqual(len(set_bindings_list), 1)
220 ../../../hyperon-experimental/python/tests/test_bindings.py :152 self.assertEqual(new_set, expected_bindings_set)
221 ../../../hyperon-experimental/python/tests/test_sexparser.py :26 self.assertEqual(leaf_node_types, expected_node_types)
222 ../../../hyperon-experimental/python/tests/test_sexparser.py :35 self.assertEqual(e.args[0], 'Unclosed String Literal')
223 ../../../hyperon-experimental/python/tests/test_sexparser.py :42 self.assertEqual(e.args[0], 'Unexpected end of expression')
224 ../../../hyperon-experimental/python/hyperon/metta.py :35 for result in metta.run(program):
225 ../../../hyperon-experimental/python/integration/test_torch.py :54 losses += [metta.run('''
! (do-step-loss (loss-fn (classify &inputs) (get-labels &inputs)))
''')[0][0].get_object().value]
226 ../../../hyperon-experimental/python/sandbox/resolve/resolve.py :26 runner = metta.run('! ' + runner_name)[0][0].get_object()
227 ../../../hyperon-experimental/python/sandbox/repl/metta_repl.py :81 runner = metta.run('! ' + runner_name)[0][0].get_object()