Fork me on GitHub
#clojure
<
2016-06-29
>
staypufd00:06:32

@norman - it shows true

norman00:06:52

I tried loading cursive out of curiousity

norman00:06:03

But I couldn’t get the evaluate expression window to work at all

norman00:06:11

it was a clojure project and I could get a repl

norman00:06:25

but the evaluate expression window only let me use java

staypufd00:06:31

I use it in debug

norman00:06:42

yeah, I tried, but I could only enter java expressions

norman00:06:51

even though clojure was the selected language

norman00:06:04

the icon to the left of the expression input box

staypufd00:06:10

oh - you have to choose Clojure mode

staypufd00:06:29

you click the little icon to the left of the text entry box

staypufd00:06:38

and it’ll let you choose the language

norman00:06:38

yes, it was in clojure mode

norman00:06:04

I just reloaded intellij and it’s better. myseries of the unknown

norman00:06:51

evaluate (range 10 10)

norman00:06:58

you’ll see the same thing

norman00:06:07

(take 5 (range 10 20))

norman00:06:33

As you can see, the expression evaluator isn’t being terribly helpful in these cases

norman00:06:46

It’s trying to tell you thinks about the lazy seq without evaluating it

seylerius00:06:52

Is nested parsing a good way to handle a grammar that's explicitly not context-free except for a select few elements?

norman00:06:16

but that’s not a terribly helpful way to see what you want to see

norman00:06:47

@staypufd: or even just evaluate (list)

staypufd00:06:32

@norman - thanks. That makes sense

staypufd00:06:52

So it’s just saying there is 1 LazySeq in my case

norman00:06:30

No - I think it’s telling you something much more confusing

norman00:06:40

But it’s a closed source tool, so who knows

norman00:06:50

compare that to (list 1)

norman00:06:11

and then (list 1 2)

norman01:06:02

@staypufd: yeah, 99% sure it’s actually just a big and not just it presenting things in a confusing way

norman01:06:20

change to views as object for example

staypufd01:06:20

I think so too

norman01:06:21

(doall (clojure.lang.LazySeq. #()))

norman01:06:30

try it with that even

staypufd01:06:00

shows same thing

norman01:06:16

And there’s no field or anything in the object that could be confusing it

staypufd01:06:19

I think that’s a object count

staypufd01:06:52

and when the thing is empty it has a bug

staypufd01:06:20

shows 3 there

staypufd01:06:24

num of objects

norman01:06:27

that’s size

norman01:06:12

(doall (take 5 (range 10 20)))

norman01:06:24

Yes, count is supposed to be the number of elements

norman01:06:47

I misunderstood what you were trying to say

staypufd01:06:05

thanks for all the help on understanding everyone

staypufd01:06:19

and @norman for all the examples and loading up Cursive

cfleming02:06:34

@staypufd: @norman: I need to work on how the Cursive debugger shows lazy seqs, but that looks like a bug to me.

cfleming02:06:44

I’ll try to reproduce that.

moizsj04:06:37

If I use an appropriately configured java ThreadPool (with a finite blocking queue or sync queue) with a Clojure agent, can I safely expect the send to block when the queue is full? (its the behaviour I want in order to create backpressure in the system)

groglogic05:06:35

@moizsj my incomplete/partial answer: if your app code was Java, then it would be clearly defined in the Java API docs. if Clojure's wrapping code, around that, is written in the "principle of least surprise" way, then, it should carry through the same behavior. my second partial answer is... to test for sure, write some Clojure POC app code that mock forces that situation to happen, and watch if it blocks or not. it's the only way to be sure, if it is not said clearly in the docs. I once had a similar "I'm not 100% sure" situation in a pure Java app, and this strategy helped me uncover and confirm a counter-intuitive leak caused by ThreadGroup back in Java 1.3 days. code > docs

Alex Miller (Clojure team)11:06:45

@moizsj: presuming you're just doing all this via interop, then yes. Calling from Clojure doesn't change anything about the behavior.

moizsj11:06:05

@alexmiller: I meant to ask, will supplying a custom executor (that has blocking behaviour) to an agent during the send call give me blocking semantics on the send?

Alex Miller (Clojure team)11:06:07

No for the place that calls send

moizsj11:06:15

@alexmiller: there appear to be 2 things in play with an agent's send behaviour. the executor and the action queue. the latter i dont understand too well

Alex Miller (Clojure team)11:06:38

Send just puts a function on the queue and returns so never blocks

moizsj11:06:49

@alexmiller: yes i want some kind of throttling ability at the place that calls send

Alex Miller (Clojure team)11:06:19

You should look at core.async for that

Alex Miller (Clojure team)11:06:41

Channels have back pressure on put for fixed size buffers

moizsj11:06:53

puts a function on the queue is this queue unbounded?

Alex Miller (Clojure team)11:06:31

The pool of threads handling send work is bounded though

moizsj11:06:39

so uncontrolled usage could result in an OOM?

moizsj11:06:24

while you're here - one more question about agents

moizsj11:06:04

the executor (either custom or builtin) runs both the actions, and notifies watchers?

Alex Miller (Clojure team)11:06:06

The pool of threads handling send-off is unbounded

Alex Miller (Clojure team)11:06:10

The code for this in Clojure is not complicated if you want to read it

moizsj11:06:21

gotcha - so i can control action (or fn) execution, and notification. but not queueing of the action.

Alex Miller (Clojure team)11:06:39

Right. I'd use core.async for that

moizsj11:06:50

cool. thanks!

shmish11112:06:52

does anyone have any experience with the riemann repl?

Al Baker15:06:00

is there a clojure library/wrapper for anything that parses Visio diagrams (vsd files)?

josh.freckleton16:06:02

what is the idiomatic way to test database-calling-fns, eg monger calls?

akiva16:06:35

Seems like integration testing rather than unit testing. But if you really want to, it’ll depend on your test harness; many of them have their own ways of mocking/stubbing.

josh.freckleton16:06:02

@akiva: I was wondering if integration testing was best. That makes sense, thanks!

neverfox16:06:29

Has anyone ever come across the Can't resolve find-ns runtime exception when running an uberjar, despite the fact that everything runs smoothly in the REPL and compilation goes fine? The only reference on the webz is https://github.com/ztellman/sleight/issues/8 and that doesn’t really tell me anything, nor does it reflect anything in my code. FWIW, it happens on a defrecord call.

akiva16:06:51

@josh.freckleton, anytime! It’s why I usually erect a façade pattern between my code and any calls to an external resource so I can test my transformations without having to worry about the resource.

ghadi16:06:15

Anyone ever used macaroons for authz from clojure?

ghadi16:06:54

it can do anything oauth can do +more, but is conceptually simpler

ghadi16:06:28

probably not in scope for #C1193CCJW but interesting nonetheless

josh.freckleton17:06:39

ah, here's a related question for my use case: can I have a short-circuiting let statement? I'm thinking of writing up an either monad, but if there's an easier way, cool!

jr17:06:53

does when-let and some-> cover your use case?

jr17:06:32

(when-let [num (some-> nil inc inc)] ...)

josh.freckleton17:06:51

@jr: I want a sequence of bound variables, and any of them can throw an exception. I'm using it in a test, where the entire sequence can depend on past bindings, and needs to all "make it through" in order to pass. I don't think when-let or some-> could do that, right? Well, maybe when-let if I include a bunch of them, but I don't want to be that verbose. When-let can only bind one var, rght?

neverfox17:06:40

So the find-ns issue seems to have been caused by having a namespace require another namespace that was deeper in the namespace “hierarchy"

neverfox17:06:51

Why that would break things in the compiled app is beyond me

timgilbert19:06:34

Hi all, is there a better way to turn :ns/key into just :key than (-> :ns/key name keyword)?