Skip to content

Commit 545a51e

Browse files
committed
working on exercise 4.44
1 parent f0b11fa commit 545a51e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

chapter4/chapter4.03.scm

+17
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,20 @@
351351
(reverse (go a b '())))
352352

353353
(zip-with list '(1 2 3) '(a b c d))
354+
355+
(define (require p) (if (not p) (amb)))
356+
(define (eight-queens)
357+
(define (ok-position? columns rows)
358+
true)
359+
(let ((q1 (amb 1 2 3 4 5 6 7 8))
360+
(q2 (amb 1 2 3 4 5 6 7 8))
361+
(q3 (amb 1 2 3 4 5 6 7 8))
362+
(q4 (amb 1 2 3 4 5 6 7 8))
363+
(q5 (amb 1 2 3 4 5 6 7 8))
364+
(q6 (amb 1 2 3 4 5 6 7 8))
365+
(q7 (amb 1 2 3 4 5 6 7 8))
366+
(q8 (amb 1 2 3 4 5 6 7 8)))
367+
(let ((columns (list q1 q2 q3 q4 q5 q6 q7 q8))
368+
(rows (list 1 2 3 4 5 6 7 8)))
369+
(require (ok-position? columns rows))
370+
(list q1 q2 q3 q4 q5 q6 q7 q8))))

0 commit comments

Comments
 (0)