~ashton314/microKanren

e1382963fceef4f5f7b2da451f10e23d2f1c5d50 — Ashton Wiersdorf 5 months ago 2669b52
Add README builder; more examples in relations playground
2 files changed, 34 insertions(+), 0 deletions(-)

A .build.yml
M relations_playground.rkt
A .build.yml => .build.yml +19 -0
@@ 0,0 1,19 @@
image: freebsd/13.x
packages:
  - hs-pandoc
secrets:
  - 4520e1e0-568d-40dc-af1c-0710afd432d3
sources:
  - https://git.sr.ht/~ashton314/microKanren
tasks:
  - build: |
      cd microKanren
      pandoc README.org -o ~/readme.html
  - publish: |
      set +x
      curl -H "Content-Type: text/html"                      \
           -H "Authorization: Bearer $(cat ~/.build-secret)"  \
           -XPUT                                             \
           --data-binary @readme.html                        \
           'https://git.sr.ht/api/repos/microKanren/readme' &&
      echo "README set"

M relations_playground.rkt => relations_playground.rkt +15 -0
@@ 6,14 6,24 @@
  (conde
   [(== c 'teddy) (== p 'saraih)]
   [(== c 'andrew) (== p 'steve)]
   [(== c 'brook) (== p 'steve)]
   [(== c 'caroline) (== p 'steve)]
   [(== c 'peter) (== p 'steve)]
   [(== c 'steve) (== p 'bill)]
   [(== c 'roger) (== p 'bill)]
   [(== c 'will) (== p 'roger)]
   [(== c 'andy) (== p 'roger)]
   [(== c 'earnest) (== p 'roger)]
   [(== c 'jack) (== p 'bill)]
   [(== c 'anne) (== p 'john)]
   [(== c 'danni) (== p 'john)]
   [(fresh (s) (married p s) (parent c s))]
   [(fresh (s) (married s p) (parent c s))]))

(define (married h w)
  (conde
   [(== h 'steve) (== w 'anne)]
   [(== h 'nate) (== w 'danni)]
   [(== h 'bill) (== w 'katie)]
   [(== h 'john) (== w 'kitty)]
   [(== h 'andrew) (== w 'saraih)]))


@@ 22,6 32,11 @@
  (fresh (p) (parent g p) (parent p s)))

;; (run 20 (rel p c) (conj+ (grandparent c p) (== (cons c p) rel)))
;; (list->set (run 10 (gp) (grandparent 'andrew gp)))

;; unfortunately we need to gather 93 results until we get all the
;; answers for bill's grandchildren:
;; (list->set (run 93 (c) (grandparent c 'bill)))

(define (fav-num n)
  (disj (== n 42)