浏览代码

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 年之前
父节点
当前提交
9a047f8427
共有 1 个文件被更改,包括 9 次插入0 次删除
  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))))))