Fork me on GitHub
Jakob Durstberger11:02:22

Hey I am trying to use amazonica on AWS lambda but library is too large. The recommendation is to exclude some SDKs like this:

:dependencies [[org.clojure/clojure "1.7.0"]
               [amazonica "0.3.48" :exclusions [com.amazonaws/aws-java-sdk
               [com.amazonaws/aws-java-sdk-core "1.10.49"]
               [com.amazonaws/aws-java-sdk-s3 "1.10.49"]]
But that looks like leiningen to me. Does anyone know how I can do that with clj-tools using the deps.edn file?

Jakob Durstberger11:02:40

facepalm I've been reading the wrong page. The reference mentions that :exclusions is supported


Also, if you don't really need some more or less advanced features of the full AWS SDK, maybe you could use a much more lean and sensible

👍 4
Jakob Durstberger19:02:36

I only now saw your message, thank you looks very promising 🙂


I'm working on a clojure tool, what do you think?

👍 28

Looks fantastic! Looks like it's integrated to IDEA/Cursive, is that right?


No, it's a separate window that is integrated into jvm — you will get the same window no matter the editor


Even better. I'm guessing you can tap> values into it? The video might show it, but it's a bit hard to tell because it's a bit small. 🙂


Yes, tap> is going to have similar behavior to prn: results appear in output window


Isn't that what REBL does? Though your ui looks way better


It is similar to rebl, but not quite the same


Which official Docker images are y'all using to host your uberjars?


Question on file/line metadata attached to forms (not vars) by macros, see thread


The output forms of a macro may not look at all like the input forms, but I notice that exceptions for code using macros like -> have accurate file/line numbers in the stack trace. So I'm trying to figure out how to make my own macros do the same. The answer seems obvious when I look at the -> macro. It's copying the metadata of the input form to the output form like this:

(with-meta `(~(first form) ~x ~@(next form)) (meta form))
So I assume that line/file metadata is present, during compilation anyway, on every form. But by searching I can't find any confirmation or doc on this. Is this true and do you see any problem with using the same approach in my own macros?


Yes, file/line number is present in metadata on forms passed to macros. I don't know how well documented that is.


Thanks for confirming Sean.


So, yes, if you want to pass the macro invocation's metadata into the result, that's reasonable I think .


Testing libraries deal with this explicitly -- look at the source of clojure.test for example (or my expectations.clojure.test).


IF someone is going to dive into ASM generation in clojure, should we use the raw asm.ow2 interfaces or the clojure.asm namespaces? I guess more specifically are the clojure.asm.* interfaces considered private?


Hmm. Or just tools.analyze.jvm which seems a lot better than anything else.


is there an easy way to apply a function to all the elements between {} in a string? lets say I want to prefix foo to (or anything really) all occurrences like "/math/plus/{parameter-x}/{parameter-y}" -&gt; "/math/plus/{foo-parameter-x}/{foo-parameter-y}"


(string/replace "/math/plus/{parameter-x}/{parameter-y}" #"\{" "{foo-")


thanks 🙂


@chris441 clojure.asm is considered private

👍 4

I'm trying to find something I know I've seen before but I'm unable to find: I'm writing a tiny HTTP=>(S)CGI translation layer; Ring of course does a great job of turning HTTP into Ring requests which is easy enough to turn into SCGI, but SCGI means the underlying app produces a complete HTTP request byte stream that I want to return verbatim, so I want to tell ring (well, I guess technically jetty or whatever the underlying server is) "no, don't serialize a response, literally just whistle these bytes into the socket"


I think I never want to modify the response so I don't care about parsing it


I'm pretty sure I've seen exactly this API but I can't tell if I'm misremembering or if it was in aleph or maybe http-kit or something else


maybe the easier way to do this is to use aleph, start from tcp, and see if I can do the http parsing bits a la carte


ring accepts an InputStream as a body, so whatever you have, you can wrap in something like a ByteArrayInputStream @U07QKGF9P


Hello again :) I’m listening to our Cognicast interview tonight

👋 4

Unfortunately the CGI response is the entire HTTP response including headers, so I’d still need to parse that


I guess I can read until 0d 0a 0d 0a


But I don’t like to write software that will earn me honorary mentions in CVEs a few years from now :)


I don't have a helpful solution, but there is a http parser kicking around for java that's pretty lightweight. It operates on a stream I think.


You could use that to create a ring response.


how would you write the spec for clojure.core/list*?


nvm, I got myself confused. s/* is what I want I think


Does anyone know whether I can get string content back (rather than exception thrown or from the exception object) when (cheshire.core/parse-stream reader) fails because the content being parsed is not valid JSON? (I could convert reader to string and then use parse-string, but supposedly parse-stream is faster)


wdyt of this logic?

  (parse x)
  (catch Exception _
    (str x)))
The only concern would be performance; i.e. you cannot catch many exceptions per second


I do not know whether something like the TeeInputStream class mentioned on this page would let you have two different readers for the same data source, one being cheshire.core/parse-stream, the other being a reader that puts the result into a string:


@U45T93RA6 I think (str x) won’t work if x is a reader/stream. @U0CMVHBL2 This might slow down overall performance if 98% is happy case where we do not need access to the string when json parsing is successful. But this sounds quite valid approach and I can’t think of any other approach unless rewrite aother json parser.


there's StringReader... between that and TeeInputStream or some other logic you might be able to achieve a working try/catch


No, it's a separate window that is integrated into jvm — you will get the same window no matter the editor