Fork me on GitHub
#clojure
<
2016-09-24
>
sbauer00:09:29

Ctags certainly can be handy :)

sbauer00:09:01

If that's the one <_>

bfabry00:09:21

nope, I forgot about ctags. marks and workspace-nav were what I was thinking of

bfabry00:09:56

also gblame

sbauer00:09:13

Ah nice, I'll have to check those ones out!

crocket00:09:23

LightTable is promising in that it is configurable in clojurescript.

crocket00:09:35

ClojureScript might be better than elisp.

witek00:09:27

How to poll all available messages from core.async channel? I need a vector with all the available messages. Needs to be non-blocking and return an empty vector if no messages are available...

witek00:09:36

I solved my problem by using (recur) 😄

Alex Miller (Clojure team)00:09:33

You can use async/reduce with conj to conj into a collection

lukism11:09:13

hmm, how to do get https requests in clojure? I tried using clj-http but I get SSLException Received fatal alert: internal_error sun.security.ssl.Alerts.getSSLException (Alerts.java:208)

mchampine13:09:59

clj-http works fine for HTTPS. Start by connecting to other known-good HTTPS servers and make sure the client is working. Could be an incompatible server version/configuration. Debugging TLS errors can be challenging because so many things can go wrong. Turn on full debug, and try to narrow in on the specific error.

mnewhook13:09:16

Anyone got any hints on how to make this merge lazy?

hlolli14:09:22

@mnewhook dont loop, but try using doseq/for/seq

mnewhook14:09:40

you mean either doseq, for or seq? or?

gfredericks14:09:18

the most general thing for creating lazy seqs is lazy-seq and recursion, and you might need that

gfredericks14:09:22

I can't tell what you're trying to do exactly

mnewhook14:09:49

merge N sorted sequences.

mnewhook14:09:08

I was looking at lazy-seq but what isn’t clear is how I’d advance the sequences (what is done with the recur step)

gfredericks14:09:48

with lazy-seq you use explicit recursion rather than recur

mnewhook14:09:18

that won’t blow the stack on very large sequences?

kauko14:09:17

Btw, it's more idiomatic to use something like :default for the final body of a cond

kauko14:09:22

But what exactly do you want to be the input and output of your function? I don't really understand what you're trying to do here

bcbradley14:09:19

when do you guys think clojure.spec will be ready?

bcbradley14:09:47

right now i'm using 1.9-alpha but some of the libraries i use fail to pass some of the core specs

mnewhook14:09:51

the inputs are N potentially very large sorted sequences and I want to produce the merged sorted sequence [[0 2 4 5 ] [ 1 3 5 7]] -> [0 1 2 3 4 5 5 7]

bcbradley14:09:51

especially ns

bcbradley14:09:03

for instance https://github.com/LightTable/Clojure fails at lighttable.nrepl.handler

bcbradley14:09:12

"one too many arguments"

bcbradley14:09:27

probably line 12

mnewhook14:09:55

the above snippet works, but requires everything to be in memory.

kauko14:09:56

How about just flatten and sort?

bcbradley14:09:17

a lot of code exists out there that has been using "working" but not documented functionality. Strictly speaking, they shouldn't, but they are. This core spec stuff is revealing a lot of that.

bcbradley14:09:28

its breaking people's code

mnewhook14:09:48

won’t flatten require everything to be in memory?

mnewhook14:09:36

Also keep in mind that for me this is also a learning exercise (ie: my clojure is bad) 🙂

bcbradley14:09:00

i think i can probably help

bcbradley14:09:22

i had a similar problem earlier

bcbradley14:09:45

here is what i did to solve it: come up with a function that maps each element in the sequence to a value

bcbradley14:09:38

then map the sequence to a map that uses that value as a key, and the unmodified original value as the value

bcbradley14:09:46

then use merge-with

bcbradley14:09:55

provide a function to merge-with to resolve collisions

mnewhook14:09:58

sounds like everything must also be in memory?

mnewhook14:09:22

in practice the inputs are very large (infinite?) line-seq of data.

bcbradley14:09:59

ultimately you are going to have to answer some basic questions about what you are doing, and be honest with yourself about the complexity that it implies

bcbradley14:09:15

if i have two "infinite" sequences

bcbradley14:09:40

is it possible that the output somehow depends on the order of what i've been given?

bcbradley14:09:12

could it be that the first value of the infinite sequence A and last of the infinite sequence B would influence the result C?

mnewhook14:09:30

there are lots of problems which are basically what I’ve said. N way merge of sorted data which is too big to fit in memory being the most obvious one.

mnewhook14:09:46

I’ve solved this problem in non-functional languages lots of times.

mnewhook14:09:02

my functional foo is bad, hence I’m not good at solving this with clojure 🙂

kauko14:09:45

Not an easy problem to solve 😄

kauko14:09:05

I'm sure it can be done, but I've never really had to think about laziness too much

mnewhook14:09:13

heh, I can generally solve this for my needs in, say golang, in 10 minutes or so.

mnewhook14:09:19

clojure not so much!!

bcbradley14:09:03

let me ask you something

mnewhook14:09:11

in theory it shouldn’t be that hard.. you have lazy sequences of input and want to produce the output lazily where the data is pulled one element at a time.

bcbradley14:09:13

let x contain both input sequences

bcbradley14:09:17

could you come up with a function f

bcbradley14:09:29

so that (f x) gives the first output in the output sequence

bcbradley14:09:36

and (f (f x)) gives the second

bcbradley14:09:39

and so forth?

mnewhook14:09:18

(f x) would have to produce 2 outputs. the first output and the modified x I think?

bcbradley14:09:29

i'd probably just put them both in a map

bcbradley14:09:37

can you pull that off?

bcbradley14:09:49

if so, then use (iterate f x)

bcbradley14:09:51

suppose when you "run out" you start returning "nil" on the "out" key / value, or better yet just dissoc it

mnewhook14:09:23

ok, going to give that a try!

gfredericks14:09:23

@mnewhook you don't need to worry about stack with lazy-seq and recursion because lazy-seq creates a thunk that defers execution

bcbradley14:09:45

then you can use (take-while pred (iterate f x))

gfredericks14:09:13

it is definitely possible to write this without having everything in memory

bcbradley14:09:35

does anyone here know how far along spec is?

bcbradley14:09:39

i mean, is it close?

kauko14:09:54

My guess is the answer is it's done when it's done 😛

bcbradley14:09:11

its gonna break so much code though

bcbradley14:09:13

i need to be on top of it

gfredericks14:09:25

you can find those breakages before it's released though, by trying out alphas

bcbradley14:09:39

thats what i've done

bcbradley14:09:52

the thing is i'm depending on a lot of code that is broken

bcbradley14:09:02

all i can do is make an issue or pull request

gfredericks14:09:05

you can make fork releases for unresponsive libraries

mnewhook14:09:16

that seems to work

gfredericks14:09:41

@mnewhook looks good; if you want to get fancy you could use a sorted-set-by so you don't have to sort the seqs at each step

mnewhook15:09:50

Thanks for the hints guys!

bcbradley16:09:35

what is lazy-merge-seqs supposed to do exactly?

borkdude16:09:49

it’s a bit quiet in #clojure-spec — how do I print a spec? for example, I want to view: :clojure.core.specs/args+body

jcb16:09:31

has anyone come across any good resources about configuring ring to support partials?

jonas16:09:02

@borkdude you can inspect the registry: (:clojure.core.specs/args+body (s/registry))

borkdude16:09:49

@jonas how do I get the spec in a human readable format?

jonas16:09:21

@borkdude perhaps (s/form (:clojure.core.specs/args+body (s/registry)))

borkdude16:09:05

so: (s/describe (s/get-spec :clojure.core.specs/args+body))

Alex Miller (Clojure team)20:09:40

You don't need the get-spec in there afaik - just (s/describe :clojure.core.specs/args+body) should work?

Alex Miller (Clojure team)20:09:31

Or s/form if you want something that should be able to be sent remotely

borkdude20:09:37

ah good to know

Alex Miller (Clojure team)22:09:03

Can you do (pst *e) at the end?

Alex Miller (Clojure team)23:09:12

Ah interesting. That's a regression from the namespace map literals

Alex Miller (Clojure team)23:09:25

Any chance you could file a jira for it?

treysullivan23:09:56

Yep -- will do. Anything else you need or is the information here sufficient?

Alex Miller (Clojure team)23:09:41

It's triggered by nrepl interestingly