trueagi-io / hyperon-experimental

MeTTa programming language implementation
https://metta-lang.dev
MIT License
147 stars 49 forks source link

The presence of a function prevents another function from running #317

Closed ngeiswei closed 8 months ago

ngeiswei commented 1 year ago

What is the problem?

The presence of a function, foo, prevents another function, bar, from running properly, apparently because one of the arguments of bar unifies with the definition of foo.

How to reproduce it?

Run the following metta file (via metta.py)

;; Define foo
(= (foo $x) $x)             ; prevents bar from running properly

;; Define bar
(: bar (-> Atom Atom Atom))
(= (bar $query $rule)
   (let* (((: $ructor (-> $premise $conclusion)) $rule)
          ((: ($ructor $proof) $conclusion) $query)
          ((: $proof $premise) (: a A)))
          $query))

;; Test bar
!(bar (: ($f a) B) (: f (-> A B)))

What should normally be expected?

[(: (f a) B)]

What is output instead?

[]

Remark

If the definition of foo is removed then the output is the expected one.

vsbogd commented 8 months ago

Looks like it is a duplicate of #242 , closing as now it works as expected.