forked from michaelballantyne/faster-minikanren
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mk-guile.scm
41 lines (34 loc) · 985 Bytes
/
mk-guile.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(define-module (faster-miniKanren mk-guile)
#:export (run run*
== =/=
fresh
conde
symbolo numbero
absento
matche))
(import (rnrs (6)))
(import (rnrs records syntactic (6)))
(define sub1 1-)
(define add1 1+)
(define fx= fx=?)
(define fxsla fxarithmetic-shift-left)
(define fxsra fxarithmetic-shift-right)
(define fxsll bitwise-arithmetic-shift-left)
(include "mk-vicare.scm")
(include "mk.scm")
(define (andmap proc . args)
(let ((l (length (car args))))
(when (pair? (filter (lambda (x) (not (= l (length x)))) args))
(error 'andmap "Lists of unequal length" args)))
(let rec
((result '())
(args args))
(if (equal? (car args) '())
(reverse result)
(let ((val (apply proc (map car args))))
(if (not val)
(reverse result)
(rec (cons val result)
(map cdr args)))))))
(define generate-temporary gensym)
(include "matche.scm")