Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added Append #626

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

Closed
wants to merge 3 commits into from
Closed

Added Append #626

wants to merge 3 commits into from

Conversation

Chipe1
Copy link
Contributor

@Chipe1 Chipe1 commented Aug 18, 2017

Also added the APPEND_container class to implement variable binding and stack/trail.
I have not included stack points and as a result unify only returns one possible solution at a time.

@norvig
Copy link
Collaborator

norvig commented Aug 20, 2017

I don't understand the purpose of this? We already have variable binding lists; what is this mechanism for? Can you give a description and some examples of use?

@Chipe1
Copy link
Contributor Author

Chipe1 commented Aug 21, 2017

The binding dictionary is similar to substitution dictionary for Expr variables. We could use a single dictionary but it would need to be global (or pass it around as an additional argument) for functions like reset-trail to work. We also need a separate unify function which can handle list of variables. I made the dictionary an attribute, and unify a method of the class instead.
Usage example:
env = APPEND_container()
env.add_var(x, True)
This would make env[x] return True.
Most of the other methods like new_variable() and reset_trail() would only be used internally. Their usage can be found in the tests.

@norvig norvig closed this Mar 15, 2018
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

Successfully merging this pull request may close these issues.

2 participants