clojure-uk

A place for people in the UK, near the UK, visiting the UK, planning to visit the UK or just vaguely interested to randomly chat about things (often vi and emacs, occasionally clojure). More general the #ldnclj
mccraigmccraig 2021-03-03T06:41:55.162500Z

mΓ₯nmΓ₯n!

djm 2021-03-03T07:00:24.162700Z

πŸ‘‹

dharrigan 2021-03-03T07:37:31.163Z

Hola!

thomas 2021-03-03T09:20:00.163800Z

Morning and welcome @david.corthorn

πŸ‘‹ 1
thomas 2021-03-03T09:20:30.164200Z

@dharrigan you could use MQTT for that πŸ˜‰

dharrigan 2021-03-03T09:21:31.164800Z

Sure.

mccraigmccraig 2021-03-03T09:21:41.165100Z

we use gnatsd @dharrigan

dharrigan 2021-03-03T09:21:43.165300Z

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

dharrigan 2021-03-03T09:22:15.165600Z

Thanks @mccraigmccraig πŸ™‚ I'll have a looksee

mccraigmccraig 2021-03-03T09:23:15.166200Z

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

dharrigan 2021-03-03T09:23:34.166600Z

yup, just looking at that right now πŸ™‚

mccraigmccraig 2021-03-03T09:24:58.167300Z

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

dharrigan 2021-03-03T09:25:09.167700Z

:thumbsup:

alexlynham 2021-03-03T10:19:15.167900Z

morning

danm 2021-03-03T11:11:39.168200Z

Morning

danm 2021-03-03T11:12:31.169100Z

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

2021-03-03T11:34:39.169300Z

Morning

2021-03-03T13:33:22.169500Z

Morn'

dharrigan 2021-03-03T15:10:39.170700Z

So, exploring datalog

πŸ‘€ 1
2021-03-03T15:10:56.171200Z

Morn

dharrigan 2021-03-03T15:12:25.172700Z

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?

dharrigan 2021-03-03T15:12:53.173100Z

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

dharrigan 2021-03-03T15:13:09.173500Z

anyone with more expierence of datalog?

jiriknesl 2021-03-03T15:13:12.173700Z

are keys always :foo?

dharrigan 2021-03-03T15:13:16.173900Z

yes

jiriknesl 2021-03-03T15:15:27.175Z

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

dharrigan 2021-03-03T15:16:57.175700Z

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

jiriknesl 2021-03-03T15:17:33.176200Z

Sorry, I haven’t used datalog yet.

mccraigmccraig 2021-03-03T15:21:24.177200Z

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

alexlynham 2021-03-03T15:22:19.177300Z

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

πŸ’― 3
😿 1
πŸ˜‚ 2
alexlynham 2021-03-03T15:24:50.177800Z

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

alexlynham 2021-03-03T15:25:45.178500Z

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

2021-03-03T15:25:58.178800Z

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

dharrigan 2021-03-03T15:39:47.179300Z

thank you all, will review

dharrigan 2021-03-03T16:18:07.183100Z

Got it to work thank you

1
dharrigan 2021-03-03T16:18:23.183500Z

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

dharrigan 2021-03-03T16:18:57.183700Z

(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"]}]

dharrigan 2021-03-03T16:19:12.183900Z

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