Fork me on GitHub

I’d say that libraries for SQL manipulation, they have to have an explanation in readme on the front page - Why do they exists and why they’re better that korma/yesql/hugsql/whatever?


he talked about it a little bit


i can't vouch for it though, haven't used it


but yes i agree


I think this ought to a simple question but I'm afraid it'll turn out to be complicated: why does transit-clj ( need me to provide a byte array of some fixed size (in the example there, 4KB) to fill with transit-ified content? (I ask because transit-cljs, the ClojureScript version, is delightfully simple to use without what seems to be the limitation of a fixed-length buffer.)


fashiha: I think you are misunderstanding the example


the example creates a bytearray outputstream, which is an outputstream (something you can write to) and then turn in to a byte array


the bytearrayoutputstream does an arraylist sort of growing of the buffer it writes to, but you can also give it a size to preallocate, which is what that 4k is


but you can wrap any output stream in a transit writer


@hiredman: well I'll be a monkey's uncle.


@hiredman: ok, so if I omit 4096 from that example, it continues to work. Very nice! But ok, then here's the other difference with the (what seems to be simpler) cljs version: subsequent calls to transit/write append to the ByteArrayOutputStream, leaving previously written values in-place . I don't want to do that, I want to write one cljs value to transit, do something to that (send it over websocket, spit to file, etc…), then write another value, overwriting the original.


you are bringing a spoon to a knife fight


whatever library you use on the jvm will almost certainly expose an outputstream for writing stuff, just wrap that in a transit writer


Anyone know a library where you can read emails and tell if they are read or unread?


would also be nice to be able to delete emails


email is very complicated, best to avoid it


my last job was at an email archiving company


it is going to depend on if you are accessing email on some server (if this is the case you are almost certainly using imap) or locally in some storage format (mbox, maildir, etc)


if it is in on disk in maildir you are pretty much home free


@hiredman: you're right! http-kit websocket API does accept a stream 😮 !


Hmm, so http-kit's websocket API's send! ( does use a stream, but strictly an InputStream or byte[]. In transit-clj's example, the transit writer populates an OutputStream, ByteArrayOutputStream to be precise ( Last year, @arohner suggested creating a fresh ByteArrayOutputStream for each invocation of transit's write and convert that to a string for subsequent use ( But @hiredman's comments above make me think I should be able to connect the stream being populated by transit to a stream being emptied by http-kit—is this a reasonable idea?


I've never used Java streams so it's very likely my understanding of how this could work has huge holes in it.


After some reading, I think I understand more how ByteArrayOutputStreams are used in Java simple_smile and will create them each time I need to make a transit payload, convert it to string, and send it out. Some day this nubness will pass!


I think I'm having a dense moment. I'm trying to work with instaparse, and it's being required weird. There's nothing defined at insta/something but insta tab complete shows instaparse.abnf,, etc. Anyone have any idea why it's not showing up as just insta like in the examples?

(ns proj.strategies
   (:require [instaparse.core :as insta]))


Does Java annotation interop work with definterface/gen-interface?


woo, apparently the answer is yes


is it possible to call (swap! atom f) on an atom and return additional information from the f, rather than just the updated value of the atom?


i.e. i have a set of things in an atom.. i want to add some other things to the set and return the set of things that were already in the set


@nimalan: using add-watch is likely what I would do in that instance


@jswart: thanks, that makes sense.. kinda a bummer that it wont be in the context of the function call in which im updating the atom


Yeah, one of two things is likely happening. Either your code can be changed so that you don’t need an atom and you can do it in the scope of your function call.


Or you can’t, and so you need to do something like you are considering now.


👍:skin-tone-5: got it!


there is a function, I forget what it is called, compare-and-set! maybe, which you can use to write your own version of swap! that does whatever you want


do do silly things with a second atom, or a promise, or add-watch, or whatever


Ah yes, cool I'll take a look at that