Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HE vs ML discrepancy: ML fails to infinitely loop. (= (loop) (loop)) and !(loop) outputs [(loop)] #243

Open
zariuq opened this issue Feb 5, 2025 · 0 comments

Comments

@zariuq
Copy link

zariuq commented Feb 5, 2025

  • In HE, the following loops indefinitely (as described in the tutorial).
  • In ML, only one step of evaluation is done.
metta+>(= (loop) (loop))
metta+>!(loop)
[(loop)]

metta+>!(if False Success (loop))
[(loop)]

;; From the tutorial, this my-if function should only terminate if the type information is given because "Atom" seems to imply that the variable should't be evaluated unless needed?
;; But this bug in ML breaks it.

;;(: my-if (-> Bool Atom Atom Atom))
metta+>(= (my-if True $then $else) $then)
metta+>(= (my-if False $then $else) $else)
metta+>(= (loop) (loop))
metta+>(= (OK) OK!)
metta+>! (my-if (> 0 1) (loop) (OK))
[OK!]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant