Coder Social home page Coder Social logo

webyrd / minikanren-with-symbolic-constraints Goto Github PK

View Code? Open in Web Editor NEW
158.0 13.0 22.0 26 KB

Version of miniKanren I normally use. Has ==, =/=, symbolo, numbero, generalized absento constraints.

License: MIT License

Scheme 99.25% Racket 0.75%

minikanren-with-symbolic-constraints's Introduction

miniKanren-with-symbolic-constraints

The version of miniKanren I normally use. Includes ==, =/=, symbolo, numbero, generalized absento constraints.

Good for writing Quine-generating interpreters, etc. :)

Also includes eigen, which represents universally quanitifed variables. Beware: this implementation does not support use of eigen with constraints other than ==.

Also includes multi-query variable version of run. For example, (run (q r s) (== (cons r q) s)).

Running

Chez and Vicare

(load "mk.scm")

Racket

(require "mk.rkt")

Guile

(load "mk-guile.scm")

Chicken

(load "mk-chicken.scm")

Running Tests

After loading miniKanren as above,

(load "test-all.scm")

regardless of scheme implementation.

minikanren-with-symbolic-constraints's People

Contributors

ceving avatar michaelballantyne avatar webyrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minikanren-with-symbolic-constraints's Issues

Using miniKanren-with-symbolic-constraints and Petite Chez Scheme

Hello!

Thank you for these files.

Issue:
I am encountering (a) a slight infelicity and (b) an unexpected error and while using these files and Petite Chez Scheme (PCS).

Description of errors with light background:
I am presently reading 'The Reasoned Schemer'. My intention is to use these files and an interactive shell of PCS to type the examples from the book and experiment. I have saved the mini-Kanren-with-symbolic-constraints files in a directory. In a terminal window, I navigate to this directory and open an instance of PCS; then -- in accordance with the markdown file -- I (load "mk.scm") and (load "test-all.scm"). All the tests pass.

(a) the slight infelicity:
When I type "succeed" (i.e. > succeed), the output is #.
When I type "fail" (i.e. > fail), the output is #.
When a user inputs a goal, the output is #.
So, since the output is the same for both "succeed" and "fail" when a user inputs a goal, the user cannot decide using the output whether the goal succeeds or fails.

In order to test whether a goal succeeds or fails, I have been inserting the goal into a cond expression (e.g. (cond [ 'a] [else 'b])). then checking whether the output is a or b.

Is this the standard way of checking whether a goal succeeds or fails?

(b) the unexpected error:
In the book, the first question I encountered that uses conde is question 44. My translation (from the book's typesetting to Scheme) of the expression in that question is:
(conde
(fail succeed)
(else fail))
When I enter this into a PCS shell, I get an error message "Exception: misplaced aux keyword (else c) near line 210, char 23 of mk.scm"

When I enter:
(conde
(fail succeed)
(fail))
I get #, as expected.

Is this second rendering (without else') the appropriate translation? i.e. should I ignoreelse''s in the book when translating from the book to the shell?

Thanks again!

Best wishes,
Andrew

P.S. I am a noob. Sorry if these are questions I should be resolving on my own.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.