Fork me on GitHub
#clojure-uk
<
2021-03-03
>
thomas09:03:00

Morning and welcome @david.corthorn

👋 3
thomas09:03:30

@dharrigan you could use MQTT for that 😉

dharrigan09:03:43

But I think there was someone who was hyping (in a good way!) a library they wrote

dharrigan09:03:15

Thanks @mccraigmccraig 🙂 I'll have a looksee

mccraigmccraig09:03:15

(via our own lib, which could do with some dependency updates, but still works fine: https://github.com/yapsterapp/clj-nats-async )

dharrigan09:03:34

yup, just looking at that right now 🙂

mccraigmccraig09:03:58

and if you do k8s, https://github.com/nats-io/nats-operator makes cluster setup trivial

danm11:03:31

An advantage of WFH is I don't disrupt other people by hacking up a lung. Still, covid test came back negative

dharrigan15:03:39

So, exploring datalog

👀 3
dharrigan15:03:25

If you have a fact that contains a vector, i.e., [{:foo ["a" "b" "c"]} {:foo ["a" "b"]}], how would you find only the foo that contains the c?

dharrigan15:03:53

so far, I can get back all the foo's, but filtering?

dharrigan15:03:09

anyone with more expierence of datalog?

jiriknesl15:03:12

are keys always :foo?

jiriknesl15:03:27

What about something like (filter (fn [item] (contains? (set item) "c")) coll)?

dharrigan15:03:57

so, you would have to supply a filter function, nothing directly in datalog. I see I see.

jiriknesl15:03:33

Sorry, I haven’t used datalog yet.

mccraigmccraig15:03:24

i used a datalog on mapreduce thing a while ago (cascalog) - it was great, and a refreshing change from SQL, but i really can't remember how to put queries together

alexlynham15:03:19

"i really can't remember how to <whatever i was doing more than 3 mths ago>" is like, my spirit animal

💯 9
😂 6
😿 3
alexlynham15:03:50

just kind of have to hope that your subconscious is filing it all away somewhere right?

alexlynham15:03:45

def feel like my conscious brain is not very smart (or getting smarter), but things seem to generally work and get better over time, so i sense a hidden hand at play

folcon15:03:58

You need to either pass it in directly or do it as a query from what I remember @dharrigan

dharrigan15:03:47

thank you all, will review

dharrigan16:03:07

Got it to work thank you

3
dharrigan16:03:23

I had to "flatten" it a bit, by providing a schema (playing around with datalevin)

dharrigan16:03:57

(def foo (edn/read-string (slurp "/home/david/tmp/foo/foo.edn"))) ;; #'da/foo
;; [{:name "wibble", :foo ["a" "b" "c"]} {:name "wobble", :foo ["a" "b"]}]

dharrigan16:03:12

(d/q '[:find ?name
       :in $ ?alias
       :where
       [?e :foo ?alias]
       [?e :name ?name]]
     @conn
     "c") ;; #{["wibble"]}