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

Wrong formula behavior #8

Open
wweic opened this issue Sep 24, 2014 · 5 comments
Open

Wrong formula behavior #8

wweic opened this issue Sep 24, 2014 · 5 comments
Assignees

Comments

@wweic
Copy link
Member

wweic commented Sep 24, 2014

drio # formula x
drio # x := 1 > 1
drio # x

I think it should return false.

@wweic wweic self-assigned this Sep 24, 2014
@JichaoS
Copy link
Member

JichaoS commented Sep 24, 2014

Do you mean that writing x should return false? Or does x.eval() return false?

@wweic
Copy link
Member Author

wweic commented Sep 24, 2014

Oh. x.eval() do return false. But x will return an error says can not find variable.

In my experience, REPL will always evaluate the expression that we enter, so I suppose x should be equal to x.eval().

In current code, we only have two scope env, one for real vars, one for int vars. I think we also need to have an env for formula?

@scungao
Copy link
Member

scungao commented Sep 24, 2014

Glad you are working on this Wei.

Right now I think it's okay to separate x and x.eval(). A logic formula has a syntactic form and a semantic value. 1>1 and 2>2 have the same truth value but are still different logic formulas. Since we'll handle pretty complicated formulas, it's reasonable to delay the eval() even though it's easy to do on simple formulas.

Yes an env for formula can be useful.

@wweic
Copy link
Member Author

wweic commented Sep 24, 2014

I see. I suggest add an env for formula too. While this env only keep the raw format of formula. Only we explicitly call eval then it's evaluated.

Seems like Jichao has an env already, I'll call look up that code.

@JichaoS
Copy link
Member

JichaoS commented Sep 25, 2014

There is already an env for formula, it just stores the expr-tree that is generated when REPL reads the formula. I can also make it store the actual formula string if that could be useful later.

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

3 participants