This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-16
Channels
- # admin-announcements (11)
- # arachne (4)
- # beginners (7)
- # boot (21)
- # clojure (41)
- # clojure-greece (2)
- # clojure-japan (7)
- # clojure-poland (4)
- # clojure-russia (25)
- # clojure-sg (1)
- # clojure-uk (3)
- # clojurescript (23)
- # cursive (2)
- # datomic (2)
- # devcards (2)
- # euroclojure (6)
- # hoplon (101)
- # immutant (4)
- # leiningen (4)
- # mount (8)
- # off-topic (2)
- # om (34)
- # onyx (2)
- # planck (1)
- # re-frame (4)
- # reagent (16)
- # spacemacs (6)
- # untangled (19)
@borkdude: maybe this one https://github.com/wishlife/defsql
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 https://youtu.be/zvocHR_gg1Y?t=9m52s
I think this ought to a simple question but I'm afraid it'll turn out to be complicated: why does transit-clj (https://github.com/cognitect/transit-clj#usage) 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.)
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
@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.
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?
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)
@hiredman: you're right! http-kit websocket API does accept a stream 😮 ! http://www.http-kit.org/server.html#websocket
https://www.youtube.com/watch?v=4s9IjkMAmns is a great talk about email
Hmm, so http-kit's websocket API's send!
(http://www.http-kit.org/server.html#websocket) 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 (https://github.com/cognitect/transit-clj#usage). Last year, @arohner suggested creating a fresh ByteArrayOutputStream for each invocation of transit's write
and convert that to a string for subsequent use (http://clojurians-log.mantike.pro/clojure/2015-07-24.html). 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 ByteArrayOutputStream
s are used in Java 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
, instaparse.auto-flatten-seq
, 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]))
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
@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.