{"id":15503503,"url":"https://github.com/rickmoynihan/evalo","last_synced_at":"2025-10-12T08:33:15.227Z","repository":{"id":66459015,"uuid":"112547810","full_name":"RickMoynihan/evalo","owner":"RickMoynihan","description":"Experiments fooling around with relational interpretation - run a subset of clojure backwards","archived":false,"fork":false,"pushed_at":"2017-12-08T01:37:49.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T08:33:12.204Z","etag":null,"topics":["boolean-algebra","clojure","logic-programming","minikanren"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RickMoynihan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-30T01:19:46.000Z","updated_at":"2018-12-08T13:28:06.000Z","dependencies_parsed_at":"2023-02-28T19:45:59.774Z","dependency_job_id":null,"html_url":"https://github.com/RickMoynihan/evalo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RickMoynihan/evalo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickMoynihan%2Fevalo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickMoynihan%2Fevalo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickMoynihan%2Fevalo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickMoynihan%2Fevalo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RickMoynihan","download_url":"https://codeload.github.com/RickMoynihan/evalo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickMoynihan%2Fevalo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010794,"owners_count":26084807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boolean-algebra","clojure","logic-programming","minikanren"],"created_at":"2024-10-02T09:13:30.726Z","updated_at":"2025-10-12T08:33:15.205Z","avatar_url":"https://github.com/RickMoynihan.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Evalo\n\nSome experiments fooling around with relational interpretation, using\n[clojure](http://clojure.org/) \u0026 [core.logic](https://github.com/clojure/core.logic).\n\n## What is this?\n\nAn experimental relational interpreter for boolean expressions in a\nsubset of Clojure.\n\nThese experiments were inspired by the relational scheme interpreters\nof William Byrd \u0026 Dan Friedman et al, and in particular the\noutstanding work on barliman to perform program synthesis for a subset\nof scheme.\n\nIf you're like me after seeing\nthe [barliman demonstrations](https://www.youtube.com/watch?v=OyfBQmvr2Hc)\nyou rushed to see how it was done, however there's a lot of code with\nfew comments and it's not always clear what you're looking at.\n\nThankfully William Byrd has recorded many excellent video conference\nsessions explaining relational programming, however the length and\nquantity of videos are duanting to the beginner who just wants to get\na flavour for how it's done.\n\nAfter a while I decided to set my sights low and dive in and implement\na simple relational interpreter for a subset of Clojure.  It's not\nimpressive, and probably wrong, but hopefully will provide some\nguidance on getting started.\n\n## So what can I do with it?\n\nEvaluate and synthesise a tiny subset of Clojure code corresponding to\nfixed arity variants of the functions/macros `and`, `not`, `or`,\n`xor`, over the values `true` and `false`.\n\nLet's have a go...\n\n`$ git clone git@github.com:RickMoynihan/evalo.git`\n\n`$ cd evalo`\n\n`$ lein repl`\n\n```clojure\n  ;; Lets ask some simple questions in boolean logic...\n\n  ;; What do the boolean values true, and false evaluate to?\n\n  (run 1 [q] (evalo-1 true q)) ;; =\u003e (true)\n\n  (run 1 [q] (evalo-1 false q)) ;; =\u003e (false)\n\n  ;; Quelle suprise... How about the expression (not true)\n  \n  (run 1 [q] (evalo-1 `(not true) q)) ;; =\u003e (false)\n\n  ;; Ok something harder, how about (not (and true true))\n\n  (run 1 [q] (evalo-1 `(not (and true true)) q)) ;; =\u003e (false)\n\n  ;; Let's try it backwards...  Give me ten programs that evaluate to\n  ;; true...\n\n  (run 10 [q] (evalo-1 q true))\n  ;; =\u003e (true\n  ;;    (clojure.core/not false)\n  ;;    (clojure.core/not (clojure.core/not true))\n  ;;    (clojure.core/and true true)\n  ;;    (clojure.core/not (clojure.core/and false false))\n  ;;    (clojure.core/or false true)\n  ;;    (boolo.core/xor false true)\n  ;;    (clojure.core/not (clojure.core/not (clojure.core/not false)))\n  ;;    (clojure.core/not (clojure.core/and false true))\n  ;;    (clojure.core/or true false))\n\n  ;; Ok, given the application (and true ~something) what something\n  ;; makes the expression true?\n\n  (run 1 [q] (evalo-1 `(and true ~q) true)) ;; =\u003e (true)\n\n  ;; Ok, given the application (~something (and true true)) what\n  ;; something makes the expression true?\n  \n  (run 1 [q] (evalo-1 `(~q (and true true)) true)) ;; =\u003e ()\n\n  ;; Doh, looks like there were no answers, because no single argument\n  ;; boolean function in our interpreter will cause that expression to\n  ;; evaluate to true...  Lets see when given the same\n  ;; expression, (~something (and true true)), what\n  ;; something makes the expression false?\n\n  (run 1 [q] (evalo-1 `(~q (and true true)) false)) ;; =\u003e (clojure.core/not)\n```\n\n## Implementation\n\nIf you have minikanren or core.logic the implementation is trivial.\nSimply\n[implement relational variants](https://github.com/RickMoynihan/evalo/blob/master/src/evalo/core.clj#L7-L37) of\nthe boolean operators `oro`, `ando`, `noto`, `xoro`.  Now we can\nimplement\n[the evaluator](https://github.com/RickMoynihan/evalo/blob/master/src/evalo/core.clj#L39-L63) itself,\n`evalo-1`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickmoynihan%2Fevalo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickmoynihan%2Fevalo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickmoynihan%2Fevalo/lists"}