0.8.4-SNAPSHOT Arrow_down_16x16
  • (subchecko w sl r o n)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core/logic/bench.clj:491 top

(defne subchecko [w sl r o n]
  ;; we have no more stones to test in sl to test w with
  ([_ () _ _ _]
     (fresh [hr]
       (fd/in hr (fd/interval 1 n))
       (matche [r o]
         ;; r is not empty, we add w to the output only if
         ;; w is head of r + 1
         ([[hr . _] [w . r]] (fd/+ hr 1 w))
         ;; r is empty, just add the weight
         ;; only works for w == 1
         ([() [w . r]]))))
  ;; we have stones to in sl to test w with
  ([_ [hsl . rsl] _ _ _]
     (fresh [w-hsl w+hsl o0 o1 nw]
       (fd/in hsl w-hsl w+hsl (fd/interval 1 n))
       (fd/+ hsl w-hsl w) (fd/+ hsl w w+hsl)
       ;; attempt to construct values prior w
       (subchecko w-hsl rsl r  o0 n)
       ;; attempt to construct values around w
       (subchecko w     rsl o0 o1 n)
       ;; attempt to construct values after w
       (subchecko w+hsl rsl o1 o  n))))
Vars in clojure.core.logic.bench/subchecko:
Used in 0 other vars

Comments top

No comments for subchecko. Log in to add a comment.