Sfoglia il codice sorgente

here's an append-o for you.

it's kind of simple, but also subtle, because it can get minikanren to
not find all the things.
Lucas Stadler 11 anni fa
parent
commit
9a047f8427
1 ha cambiato i file con 9 aggiunte e 0 eliminazioni
  1. 9 0
      scm/logic.scm

+ 9 - 0
scm/logic.scm

@ -21,3 +21,12 @@
21 21
(define cons-o
22 22
  (lambda (x l r)
23 23
    (== r (cons x l))))
24
25
(define append-o
26
  (lambda (l s r)
27
    (conde
28
     ((== l '()) (== s r))
29
     ((fresh (a d res)
30
             (== `(,a . ,d) l)
31
             (== `(,a . ,res) r)
32
             (append-o d s res))))))