I'm pretty new to minikanren (read about half of the reasoned schemer and 
have just been hacking around). Last weekend I put together a little "first 
order logic expression solver". It takes a set of logic expressions and 
solves for all the possible values of the variables used.

https://github.com/saolsen/first-order/blob/master/first-order.rkt

Here's a random example

> (run*
    (q) (eval-manyo `((IF (AND a b) (NOT c))
                      (IF c (NOT a))
                      (IFF (OR b c) a)
                      ) `() q))
'(((c . #f) (b . #t) (a . #t))
  ((c . #f) (b . #f) (a . #f)))

It also of course can be run in a few different ways including generating 
expressions which is neat.

> (run 5 (q) (fresh (e) (assertiono `(IFF #t ,q) `() e)))
'(#t (_.0 (sym _.0)) (AND #t #t) (NOT #f) (OR #t #t))

I'd like some feedback on it. I sort of hacked it together from william's 
quines and meta-interp projects. I'd love some tips from more seasoned 
logic programmers on ways I could improve it. For instance I didn't see a 
way to do the variables without two env vars but It seems there's only one 
in the quines code. I also think there are probably some other things built 
into mk that I'm not using that could make this better.

Thanks for taking a look, this is a hell of a lot of fun!

-- 
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/groups/opt_out.

Reply via email to