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

conda bug #9

Open
rajeevn1 opened this issue Nov 14, 2019 · 3 comments
Open

conda bug #9

rajeevn1 opened this issue Nov 14, 2019 · 3 comments
Labels
bug Something isn't working discussion

Comments

@rajeevn1
Copy link

rajeevn1 commented Nov 14, 2019

The following should return (a1) but it returns (_0)

(reazon-run* x
  (reazon-conde
   ((reazon-== x 'a1))
   ((reazon-== x 'a2)))
  (reazon-conda
   ((reazon-== x 'a2) #'reazon-!U)
   (#'reazon-!S)))
@rajeevn1 rajeevn1 changed the title possible conda bug conda bug Nov 15, 2019
@rajeevn1
Copy link
Author

rajeevn1 commented Nov 15, 2019

I get the correct answer, (a1), using minikanren under racket.

(run* (x) (conde ((== x 'a1)) ((== x 'a2))) (conda ((== x 'a2) (== x 'c)) ((== x x))))

@nickdrozd
Copy link
Owner

Congratualations on being the first external contributor to Reazon! I edited your comments for formatting.

Could you explain what is going on in this example? I don't really understand how conda works (or condu for that matter). Is it possible that this is undefined behavior or something like that, and that different implementations might yield different results?

If the behavior here really is wrong, do you have any idea about what might fix it on the Elisp side? The implementation here is pretty close to the one given in The Reasoned Schemer (2nd ed).

@rajeevn1
Copy link
Author

I do not know the implementation details but according to https://scholarworks.iu.edu/dspace/bitstream/handle/2022/8777/Byrd_indiana_0093A_10344.pdf?sequence=1

QUOTE
conda and condu differ from conde in that at most one clause can succeed. Furthermore, the clauses are tried in order, from top to bottom. Also, the first goal in each clause is treated specially, as a “test” goal that determines whether to commit to that clause; in this way,conda and condu are reminiscent of cond.
UNQUOTE

@nickdrozd nickdrozd added bug Something isn't working discussion labels Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion
Projects
None yet
Development

No branches or pull requests

2 participants