The working implementation is now up on github [1]. It's just three simple
classes, one for goals, one for logic variables and one for states in the
output stream. I exploit operator overloading so you can write programs
like:
Goal Simple(Kanren x)
{
return Kanren.Exists(x => x == 5)
& Kanren.Exists(y => y == 5 | y == 6);
}
"Kanren.Exists" is call/fresh, I just found it easier to read if I thought
of it as an existential proposition. It interleaves disjunctions, but it
doesn't eagerly evaluate immature streams, leaving it up to the client at
the moment.
Sandro
[1] https://github.com/naasking/uKanren.NET
On Monday, 23 February 2015 13:49:59 UTC-5, William Byrd wrote:
>
> Hi Sandro!
>
> I think replacing the disj with conj should lead to divergence
> (looping forever) for this example. That is, the computation will run
> forever.
>
> Is this right, Jason and Dan?
>
> Cheers,
>
> --Will
>
> On Mon, Feb 23, 2015 at 11:41 AM, Sandro Magi <[email protected]
> <javascript:>> wrote:
> > I'm aware of the existing implementation on github, but as a translation
> > from a Scheme implementation it's not very idiomatic. I have a much
> simpler
> > implementation written, but I'm not sure of one of the test results.
> What is
> > the expected output of the following tweaked example from the paper [1]:
> >
> >> (defi ne ( fives x) (disj (≡ x 5) .(λg (s/c) (λ$ () (.( fives x)
> >> .s/c))).))
> >> (defi ne (sixes x) (disj (≡ x 6) (λg (s/c) (λ$ () ((sixes x) s/c)))))
> >> (defi ne fives-xor-sixes (call/fresh (λ (x) (conj ( fives x) (sixes
> x)))))
> >> (fi ves-xor-sixes empty-state)
> >
> > This is the fives-and-sixes example, replacing a disj with conj. I would
> > expect this to produce no results, is that correct?
> >
> > Sandro
> >
> > [1] http://webyrd.net/scheme-2013/papers/HemannMuKanren2013.pdf
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "minikanren" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > Visit this group at http://groups.google.com/group/minikanren.
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"minikanren" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/minikanren.
For more options, visit https://groups.google.com/d/optout.