Skip to content

Commit

Permalink
Merge pull request #20 from brandonwillard/improve-basic-goals
Browse files Browse the repository at this point in the history
Improve and add basic miniKanren goals
  • Loading branch information
brandonwillard committed Jan 31, 2020
2 parents 5a96fcb + 0ea3200 commit cd96923
Show file tree
Hide file tree
Showing 14 changed files with 1,540 additions and 656 deletions.
6 changes: 3 additions & 3 deletions examples/prime.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from unification import isvar

from kanren import membero
from kanren.core import (success, fail, var, run,
condeseq, eq)
from kanren.core import succeed, fail, var, run, condeseq, eq

try:
import sympy.ntheory.generate as sg
except ImportError:
Expand All @@ -19,7 +19,7 @@ def primo(x):
if isvar(x):
return condeseq([(eq, x, p)] for p in map(sg.prime, it.count(1)))
else:
return success if sg.isprime(x) else fail
return succeed if sg.isprime(x) else fail


def test_primo():
Expand Down
16 changes: 13 additions & 3 deletions kanren/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# flake8: noqa
"""kanren is a Python library for logic and relational programming."""
from __future__ import absolute_import

from unification import unify, reify, unifiable, var, isvar, vars, variables, Var

from .core import run, eq, conde, lall, lany
from .goals import seteq, permuteq, goalify, membero
from .goals import (
heado,
tailo,
conso,
nullo,
itero,
appendo,
rembero,
permuteo,
permuteq,
membero,
goalify,
)
from .facts import Relation, fact, facts
from .term import arguments, operator, term, unifiable_with_term

Expand Down

0 comments on commit cd96923

Please sign in to comment.