我仍然是 Scheme 的新手,并试图通过 call/cc 和 amb 运算符来解决魔方。目前,它正在打印:
1 1 1 31 Row 1
16 16 1 1 Row 2
16 1 16 1 Row 3
1 16 16 1 Row 4
我不明白为什么它只使用这些数字。是我的与众不同吗?程序?这是我的代码:
;; check whether an element of one given list is a member of any
;; of the other given lists
(define distinct?
(lambda (o l)
(if (null? l)
#t
(if (= (car l) o)
'()
(distinct? o (cdr l))))))