diff --git a/extend/example6.metta b/extend/example6.metta new file mode 100644 index 0000000..7568248 --- /dev/null +++ b/extend/example6.metta @@ -0,0 +1,9 @@ +!(extend-py! mettamorph) +!(compile! ( +(= (test1) 42) +(: test2 (-> Number Number)) +(= (test2 $x) 42) +)) + +!(test1) +!(test2 33) diff --git a/extend/mettamorph.py b/extend/mettamorph.py index 7ecf380..5681f87 100644 --- a/extend/mettamorph.py +++ b/extend/mettamorph.py @@ -68,9 +68,14 @@ def inject_calltypewrapper(content): wrappers += line + "\n" globalmetta.run(wrappers) +compiled = False def call_compilefile(*a): - global mettamorphlib, globalmetta - loadfile = a[0][1:-1] if a[0].startswith('"') else a[0] + global mettamorphlib, globalmetta, compiled + if compiled: + return E(S("Compilation:"), S("unsupported")) + compiled = True + loadfiletoken = str(a[0]).replace(") (=", ")\n(=").replace(") (:", ")\n(:") + loadfile = loadfiletoken[1:-1] if loadfiletoken.startswith('"') or loadfiletoken.startswith('(') else loadfiletoken if not loadfile.endswith(".metta"): content = loadfile loadfile = "TEMP.metta"