microKanren is a minimalist relational (logic) programming language. This project is a port of microKanren to CSharp. It is an almost exact translation of the original implementation, which was written for Petite Chez Scheme.
To install MicroKanren, run the following command in the Package Manager Console
PM> Install-Package MicroKanren
The following example demonstrates how MicroKanren can be used from a simple program:
using MicroKanren;
class SimpleProgram:Core{
public string Do(){
var res = CallFresh((q)=> Eq(q, 5) )(EmptyState);
return res.ToString();
}
}
> new SimpleProgram().Do()
(((([0] . 5)) . 1))
See the spec file for more examples. The spec file is almost an exact port of the microKanren tests written in Scheme.
The code in this gem is closely based on the following sources:
- The microKanren paper by Jason Hemann and Daniel P. Friedman. I read this paper a couple of times, and will probably have to read it a few more before I have a better understanding about what this code is doing and how to write more effective logic programs.
- This code is also in parts copied from Scott Vokes' port of microKanren to Lua. It was great to have the Lua code as a second example of the implementation in the paper, and it made my job especially easy since Lua is so similar to Ruby.
This project requires .net 4.0 or higher.
- Fork it ( https://github.com/wallymathieu/csharp_ukanren/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
See LICENSE.txt.
See credits for source of original code. This is a port of a port written by [Justin Leitgeb] (http://justinleitgeb.com). This port is written by Oskar Gewalli.