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

New: Build Kanren with Extra Term Predicates/Unifiers #2

Open
joshcox opened this issue Mar 31, 2019 · 1 comment
Open

New: Build Kanren with Extra Term Predicates/Unifiers #2

joshcox opened this issue Mar 31, 2019 · 1 comment
Assignees

Comments

@joshcox
Copy link
Owner

joshcox commented Mar 31, 2019

In light of #3, it's a good time to enhance the unification algorithm. Since I'd obviously like to accept more and more data objects into the unification algorithm (the goal being consumer-provided data objects), I think it makes sense to write a unification algorithm builder function that accepts new term types and term unifiers and builds a unification algorithm that encompasses all.

This should be done in a way that is easily used by the consumer. There are two ways, as I see:

  1. The consumer needs to initialize an mk library with a pre-determined set of term types and unifiers.
  2. Include term types and unifiers within the state; mk automatically extends its internals to encompass the types/unifiers provided.

I like the idea of storing the term types and unifiers within the state. The consumer passes the extra term types/unifiers via IRunOptions. This would allow consumers to take one state created by an invocation of mk and inject it into another invocation of mk. mk could read that incoming state and use the terms/unifiers to build a unification algorithm that is consistent with the one used to originally build that state. Where I think this breaks down is when there are two states that have identical term types but different unifiers - which unifier should kanren pick?

Because of that one caveat above, I'm thinking about going with #1 up above. Provide some function, buildKanren or so, that takes in extra term types/unifiers and bakes them into a custom kanren implementation.

@joshcox joshcox self-assigned this Mar 31, 2019
@joshcox joshcox changed the title New: Pluggable Unification Algorithm Builder New: Inject new Term types & unifiers into Unification Algorithm Mar 31, 2019
@joshcox joshcox changed the title New: Inject new Term types & unifiers into Unification Algorithm New: Build Kanren with Extra Term Predicates/Unifiers Apr 8, 2019
joshcox added a commit that referenced this issue Apr 10, 2019
…this forces the consumer to initialize kanren. (refs #2)
joshcox added a commit that referenced this issue Apr 10, 2019
joshcox added a commit that referenced this issue Apr 10, 2019
…rred types to remove the type annotation from the kanren functions (refs #2)
joshcox added a commit that referenced this issue Apr 10, 2019
joshcox added a commit that referenced this issue Apr 10, 2019
…ks can be exposed for unification to add custom term unification predicates/unifiers (refs #2)
joshcox added a commit that referenced this issue Apr 10, 2019
…ed as an array of tuples where the first value is a TermPredicate (a predicate that takes two terms and returns a boolean value) and a TermUnification (a unification function that takes in its encompassing unification algorithm, for recursive steps, and returns a function that takes two terms and a substitution which unifies the two terms under the substitution). Factored out array from the buildUnification algorithm, leaving the basic unification algorithm a unification over primitive types (refs #2)
@jotaf98
Copy link

jotaf98 commented May 2, 2019

Just to pitch in and say that option 2 seems to come with a lot of weird corner cases when mixing different states, so just picking one world-view for the lifetime of the structures seems like the most sensible solution.

joshcox added a commit that referenced this issue Jun 15, 2019
…option to build a specialized kanren with custom constraints and term types. (refs #2)

The IRunOptions type was modified; the goal property was removed. Instead, goals will be passed as unnamed arguments to runners to make invocations of kanren more concise. (refs #7)
joshcox added a commit that referenced this issue Jun 15, 2019
…option to build a specialized kanren with custom constraints and term types. (refs #2)

The IRunOptions type was modified; the goal property was removed. Instead, goals will be passed as unnamed arguments to runners to make invocations of kanren more concise. (refs #7)
joshcox added a commit that referenced this issue Jun 16, 2019
Hide kanren underneath a builder. This is the first step to provided option to build a specialized kanren with custom constraints and term types. (refs #2) (#8)
The IRunOptions type was modified; the goal property was removed. Instead, goals will be passed as unnamed arguments to runners to make invocations of kanren more concise. (refs #7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants