Fork me on GitHub
#beginners
<
2017-06-29
>
harrigan09:06:09

Why do the two specs (s/+ int?) and (s/& (s/* int?) #(> (count %) 0)) behave differently when trying to conform an empty seq? The first fails (as expected) but the second conforms it to nil.

harrigan10:06:17

My confusion seems to stem from s/&: (s/* int?) and (s/& (s/* int?)) do not conform an empty seq in the same way

a1310:06:45

Yes, it looks like s/& completely ignores all further predicates for [] and returns nil anyways

a1310:06:48

(s/conform (s/& (s/* int?) #(= (count %) 0)) []) -> nil

(s/conform (s/& (s/* int?) #(= (count %) 1)) [1]) -> [1]

harrigan10:06:40

Yes. The #(= (count %) 0) isn’t even evaluated.

harrigan11:06:18

I’ll continue this in #clojure-spec

alexmiller13:06:47

Just so this isn't hanging - this is a known bug with s/& not checking preds if an empty coll matches

alexmiller13:06:54

Patch pending

lepistane13:06:16

may i ask something about spring boot

lepistane13:06:24

and security?

lepistane13:06:36

could be generalized about whole rest story

lepistane13:06:50

so before people used session to deal with users states (logged in or not)

lepistane13:06:54

and now we use tokens

lepistane13:06:20

so users logs in, server generates token, returns it and user uses that token for every next call

lepistane13:06:33

where does server save/hold/keep valid tokens?

pkova13:06:05

the server has encrypted the token with its private key

pkova13:06:12

so it can always check whether a given token is valid

lepistane13:06:27

makes sense so it's not saved anywhere TNX!

dhruv119:06:19

Shared this in the java channel. Not sure how active it is so asking here.

dhruv119:06:33

someMethod(int my-integer, String... topics) what is Strings... ?

noisesmith19:06:23

(into-array String [....])

noisesmith19:06:15

on the vm level, varargs are represented by an array, and clojure doesn't abstract that like java does, so you need to create the array

dhruv119:06:29

ah! thank you!

dhruv119:06:06

i totally forgot about into-array thanks!

jaysherby20:06:41

Does anyone know of any recent ring-compatible http server benchmarks? I don't know whether to use jetty or immutant or aleph or what to get the most out of my server app.

jaysherby20:06:14

I was leaning towards aleph, but my server isn't going to benefit from streaming data given how it works.

jaysherby20:06:39

I saw those, but they're two years old.

noisesmith20:06:27

I promise that jetty hasn't caught up in the meantime

noisesmith20:06:50

I'd decide whether you find aleph or immutant's features / abstractions more useful (and compare the relative recursive size of the deps) - they are close enough in performance that the difference between the two is very unlikely to be your performance bottleneck - especially in a system where your request handlers are written in clojure

noisesmith20:06:16

I picked aleph because I find streams more interesting than interceptors for my design, but maybe you'd come to the opposite decision