Fork me on GitHub

Hi, I want to turn the entries of a set into maps. It's the result of a datomic-esque query using datahike..

; ;; successfully returns all chats from room
(println  "haxorrr : "
  (d/q '[:find  ?authorid ?content ?timestamp ?messageid
       :in $ ?kind ?roomname
       [?m :message/kind ?kind]
       [?m :message/roomname ?roomname]
       [?m :message/authorid ?authorid]
       [?m :message/content ?content]
       [?m :message/timestamp ?timestamp]
       [?m :message/messageid ?messageid]]
  @conn "chat" "Beginners"))
haxorrr :  #{[a.tester Welcome to the beginner's channel. Please post any questions you have here.  Feel free to discuss! 1592143964 aed7504f-b1a7] [c.tester Quite a hypothetical, indeed. 1592143964 cf91e354-abab] [b.tester That is a hypothetical. 1592143964 7c96b2a2-ef2b] [a.tester Say I had a question, you'd want to help me figure it out. 1592143964 7c22e8fd-6391] [a.tester Real mature, gems. 1592143964 ad536ace-5a3f]}
So I'd like a vector of maps instead, that way I can sort it by timestamp and generate a page from it. Is there a better way to sort by timestamp ? open to suggestions.


does datahike support the pull syntax?


Neat. I have not used pull before... I recall it being a formative part of but I still don't really get it


woots. makin' some progress aw yeah B-) thanks y'all


👋 Hi, I'm trying to spec a tuple where I only care about the first value. The second can be every arbitrary type how can I achieve that?


Okay nvm I guess any? will work for me 😇

William Skinner20:06:25

it looks like it's spending a good deal of time in processResults which I don't really care about


@skinner89 I know you're using there, rather than next.jdbc but read this section of the latter's docs that talks about a possible issue there


I find myself wanting to change the value of something I've defined in an outer let binding form when I encounter some condition inside of an inner letfn . Realizing that what I introduce in a let binding form cannot be changed, is there something analagous to let that would actually let me change the value of a binding?


You can 'shadow' the value of an earlier binding, even within the same let , but also within an inner let . That isn't mutating an existing value, just giving the same name to a new value.


(let [a 1
      a (+ a 2)]
  a) ; 3


@radicalmatt any time you find yourself wanting to change something try thinking “well I can just make a NEW thing” 🙂

(let [a 1
      a' (+ a 2)]
  a') ; 3
I personally like the “a prime” approach where I don’t shadow bindings; instead I give them similar but different names