GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jsl/ruby_ukanren: A port of microKanren to Ruby

BranchesTags
Open more actions menu

Latest commit

 

History

59 Commits
59 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
Gemfile
Gemfile
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
micro_kanren.gemspec
micro_kanren.gemspec
 
 

Repository files navigation

microKanren in Ruby

microKanren is a minimalist relational (logic) programming language. This project is a port of microKanren to Ruby. It is an almost exact translation of the original implementation, which was written for Petite Chez Scheme.

Installation

Add this line to your application's Gemfile:

gem 'micro_kanren'

And then execute:

$ bundle

Or install it yourself as:

$ gem install micro_kanren

Usage

The following example demonstrates how MicroKanren can be used from the console:

> require 'micro_kanren'
> include MicroKanren::Core
> include MicroKanren::MiniKanrenWrappers

> res = call_fresh(-> (q) { eq(q, 5) }).call(empty_state)
> res.to_s
(((([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.

Credits

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.

Dependencies

This project requires Ruby 2.0 or higher. You can see which Rubies work with this project in the Travis CI Build Status.

Note that there does seem to be a particular early patch level of of a Ruby interpreter that breaks Ruby ruby_ukanren! If the unit tests don't pass for you locally, or the example in this file doesn't work, try upgrading your Ruby to a recent patch level of one of the supported Ruby versions that is currently passing on Travis CI. See this issue for more.

Contributing

  1. Fork it ( http://github.com/jsl/ruby_ukanren/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

See LICENSE.txt.

Author

See credits for source of original code. This port was written by [Justin Leitgeb] (http://justinleitgeb.com).

Build Status

Build Status

About

A port of microKanren to Ruby

Resources

Readme
MIT license
Activity

Stars

29 stars

Watchers

4 watching

Forks

6 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.