Skip to content

Runtime playground

This small runner evaluates one program with MeTTa TS. Open the browser IDE when you want live language-server analysis or a multi-file workspace. Atoms without a leading ! are added to the space; atoms with ! are evaluated and their results shown.

metta
; rules are equalities; this one is recursive
(= (fact $n) (if (> $n 0) (* $n (fact (- $n 1))) 1))
!(fact 5)

; nondeterminism: two rules, two results
(= (bin) 0)
(= (bin) 1)
!(bin)

; pattern matching over stored facts
(parent Tom Bob)
(parent Tom Liz)
!(match &self (parent Tom $c) $c)

Try changing 5 to 10, or add another (parent ...) fact and re-run the query. Everything you can write in a .metta file works here.

Released under the Apache-2.0 License.