Fork me on GitHub
#clojure
<
2019-01-15
>
devn00:01:00

@dpsutton mm, it does not throw

devn00:01:41

it handles the "potentially giant unrealized sequence" scenario

dpsutton00:01:23

I meant on a non collection it should throw. It seems like you want exceptions here.

dpsutton00:01:39

And then you just throw if the bounded count is not exactly 1

orestis11:01:16

> As some of you probably know, Christophe Grand has joined nREPL’s team and is working on bringing some amazing features from unrepl to nREPL: > The ability to upgrade a plain socket REPL to nREPL. > Sideloading - allowing clients to act as network classloaders. > A rich value printer with collection elision. > (Extremely) Exciting times ahead! I cannot thank Christophe enough for the amazing work he has been doing on nREPL recently! People like him are the heart and soul of the Clojure community and the reason why I love being part of it!

orestis11:01:24

Wow, this is very exciting news

borkdude11:01:15

Is there a JSON library which lets you only read what you need from a JSON string, to save performance? Like what you would do when writing your own JSON deserializer for a type in e.g. Java or Haskell.

victorb12:01:11

is there any way I can hook into ring.middleware.reload when it's actually doing a reload? Would like to perform some custom task when it's reloaded (specially restart a task that runs every X seconds)

victorb12:01:52

looking for something similar to on-js-reload from figwheel, which lets you run code when the code has changed

kwladyka12:01:25

Ring reload event only if ns which you point to is reloaded. I have dev/user.clj which is wrapper app on core app with extra middleware. You can add to this ns restart task code.

kwladyka12:01:12

I am writing from phone. Sorry if too general

victorb13:01:22

ah, right, so basically just split things up more. Makes sense. Thanks @kwladyka

hjrnunes13:01:49

Hi all. Does anyone have any tips on how to deal with clojure metadata on the Java side?

hjrnunes13:01:42

I have some data with my own metadata attached which I need to pass on to Java code. How do people normally deal with this?

noisesmith17:01:50

the metadata is accessible via a method on the Object it's attached to, but you can just use meta via Clojure.var

IFn meta = Clojure.var("clojure.core", "meta");
meta.invoke(o);

noisesmith17:01:24

if you cast the object to IFn, java should let you call the meta method

o.meta();
, but I think the meta function is more reliable as an entrypoint

noisesmith17:01:01

But maybe I misunderstood? Are you doing this from Clojure and just want to know how to pass the metadata?

hjrnunes10:01:19

Hey! Thanks

hjrnunes10:01:39

Yes, I'm doing it from Clojure, but the data needs to go through some Java and back. So I'm thinking what's the best way of doing that.

noisesmith18:01:02

the meta function retrieves the metadata, then you can use it with the java methods in whatever way makes sense

noisesmith18:01:52

and if you need to round-trip, you can use with-meta to attach the metadata to a new data structure if needed - but this only works with Clojure things (vars, functions, persistent collections, symbols etc.)

dangercoder15:01:01

Is there a way to to (str #inst "2018-10-15T14:45:07.000000000-00:00") without the time being converted to my time zone?

Alex Miller (Clojure team)15:01:59

Yes, you really need to look into java time stamp formatting

Alex Miller (Clojure team)15:01:31

Clojure really relies on the jdk for all that stuff

dangercoder15:01:26

Will do, thanks

dangercoder15:01:05

Answer to my question: use SimpleDateFormat

kwladyka20:01:16

Is it possible to read session value with https://github.com/xeqi/peridot ? I am doing this now in that way:

(->> (get-in mock [:cookie-jar "localhost" "ring-session" :value])
               (get @mem)
               :uuid
               (some?))
But it would be nice to use come kind of ring reader from session instead.