Fork me on GitHub
#datascript
<
2018-11-20
>
didibus09:11:25

Why don't both these thing give me the same result?

(d/q '[:find ?a
       :in [[?a]]
       :where
       [(> ?a 2000)]
       [(even? ?a)]
       [(= 1090 (/ ?a 2))]]
     (map vector (range 0 20000)))

(->>
 (range 0 20000)
 (filter #(> % 2000))
 (filter even?)
 (filter #(= 1090 (/ % 2))))

ClashTheBunny15:11:00

You can't call a function in a function in datascript:

(datascript.core/q '[:find ?a
         :in [[?a]]
         :where
         [(> ?a 2000)]
         [(even? ?a)]
         [(/ ?a 2) ?aover2]
         [(= 1090 ?aover2)]]
       (map vector (range 0 20000)))

1