Skip to content

How to write facts based on other facts #67

Answered by brandonwillard
vitrun asked this question in Q&A
Discussion options

You must be logged in to vote

Line(*args) should return a goal object, which is generally a callable that takes miniKanren state objects (i.e. "substitution"/unification mappings) and returns a stream of new states. Those goal objects are chained together using the ldisj and lconj operators (e.g. via the helper functions/aliases conde, lall, land, etc.) and evaluated by run.

Altogether, this means that the expression LengthOf(Line(*args), ...) will create a goal that relates a goal to something else; in other words, the result is some sort of "higher-order" relation on the machinery of miniKanren itself (i.e. goals). That's an interesting path to go down, but it might not be what you want.

More specifically, the goal …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vitrun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #66 on October 10, 2022 01:06.