1
如何在功能编程语言中实现分支定界?
我试图在所有函数f的集合上写一个分支和边界搜索:D-> R,其中域大小很小(| D |〜20),范围更大(| R |〜2 ^ 20 )。最初,我想出了以下解决方案。 (builder (domain range condlist partial-map) (let ((passed? (check condlist partial-map))) (cond ((not passed?) nil) (domain (recur-on-first domain range condlist partial-map '())) (t partial-map)))) (recur-on-first (domain range condlist partial-map ignored) (cond ((null range) nil) (t (let ((first-to-first (builder (cdr domain) (append ignored …