-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathExercise_4_63.rkt
36 lines (29 loc) · 876 Bytes
/
Exercise_4_63.rkt
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
#lang racket/base
(rule (son-of ?m ?s)
(or (son ?m ?s)
(and (wife ?m ?w) ;; find m's wife's son
(son ?w ?s))))
(rule (grandson ?g ?s)
(and (son-of ?f ?s)
(son-of ?g ?f)))
(add-assertion! '(son Adam Cain))
(add-assertion! '(son Cain Enoch))
(add-assertion! '(son Enoch Irad))
(add-assertion! '(son Irad Mehujael))
(add-assertion! '(son Mehujael Methushael))
(add-assertion! '(son Methushael Lamech))
(add-assertion! '(wife Lamech Ada))
(add-assertion! '(son Ada Jabal))
(add-assertion! '(son Ada Jubal))
(grandson Cain ?son)
;;; Query results:
(grandson Cain Irad)
(son-of Lamech ?son)
;;; Query results:
(son-of Lamech Jubal)
(son-of Lamech Jabal)
(grandson Methushael ?son)
;;; Query results:
(grandson Methushael Jubal)
(grandson Methushael Jabal)
;; https://www.biblegateway.com/passage/?search=+Genesis+4&version=NIV