10 lines
389 B
Text
10 lines
389 B
Text
(function amb op res
|
|
(filter #(= res (.. .. op args))
|
|
(.. for vec (skip 2 args))))
|
|
|
|
(var safe= @(= (0 args)))
|
|
(var predicate (comp vec (map (juxt 0 -1)) flatten (skip 1) (partition 2) (map (.. safe=)) (.. and)))
|
|
|
|
(amb predicate true ["the" "that" "a"] ["frog" "elephant" "thing"] ["walked" "treaded" "grows"] ["slowly" "quickly"])
|
|
|
|
;returns [["that" "thing" "grows" "slowly"]]
|