Fork me on GitHub
#clojure
<
2016-01-16
>
andrewboltachev00:01:28

Hi. Can anyone suggest, what this horrible error might be caused by? http://dpaste.com/209ZJK8

richiardiandrea00:01:19

@andrewboltachev: it looks like these are cljs warnings, you might want to ask in #C03S1L9DN, or even #C06DT2YSY, but it might be some require missing, or project.clj pointing to something weird

andrewboltachev00:01:00

@richiardiandrea: ok, thanks. it's om-intermediate-template actually

triss02:01:57

so how would one go about flattening all but the deepest seq in seq of seqs?

triss02:01:21

say i want to go from [1 2 [3 [4 5] 6] [[[7 8] 9]]]

triss02:01:13

to [1 2 3 [4 5] 6 [7 8] 9]?

noziar06:01:30

@triss: I think this could do the trick: simple way:

(defn f [v]
  (if (some coll? v)
    (into [] (mapcat #((if (coll? %) f vector) %)) v)
    [v]))
fancier way:
(defn g [v]
  (let [branch? #(and (coll? %) (some coll? %))]
    (->> (tree-seq branch? identity v)
         (into [] (remove branch?)))))
Note this uses transducers (just to keep vectors), but it's easy to adapt to older versions of Clojure. Also I'm not sure what result you expect for an input such as [1 2 3] so you may have to tweak a bit for this particular case (do you want [1 2 3] or [[1 2 3]]?)

hans06:01:10

Does anyone know how this error reported by Tomcat 8.0.24 can be avoided?

16-Jan-2016 07:49:06.464 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [shell-command-executor-0.1.0-SNAPSHOT-standalone] created a ThreadLocal with key of type [clojure.lang.Var$1] (value [clojure.lang.Var$1@ce59370]) and a value of type [clojure.lang.Var.Frame] (value [clojure.lang.Var$Frame@639ad1cf]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

nberger07:01:38

Looks pretty similar to http://dev.clojure.org/jira/browse/CLJ-1125, @hans. It says it is fixed in clojure 1.6.0

hans07:01:18

@nberger: Right. Which is why I'm asking. I'm using clojure 1.7.0

nberger07:01:12

Oh ok, no idea then

yenda15:01:40

I had a nasty bug in my program because I was getting the common part with #(get %1 2) and it turns out that when the maps are different you get a list not a vector

yenda15:01:03

is it normal ? it looks inconsistent to me

bronsa15:01:36

docstring says "tuple of [..]", vaguely implying a vector

bronsa15:01:03

@yenda: I'd say that qualifies as a bug, would you mind opening a ticket for this?

yenda15:01:30

damn you can't edit a ticket on jira?

yenda15:01:36

I did it too fast

bronsa15:01:27

I can edit it for you

bronsa15:01:28

@yenda: done, let me know if it's ok. Also, as a rule, don't use tags like "bug" or "feature" -- the ticket type is already about that

yenda15:01:05

thank you

yenda15:01:53

can I propose a patch ? i found the bugfix

bronsa16:01:32

sure. just make sure you have a CA signed and you use the correct patch format (using git format-patch)

yenda16:01:05

apparently tests don't care what type of collection they get

Alex Miller (Clojure team)16:01:23

sequential collections are compared regardless of type (so list / seq / vector are the same)

yenda17:01:09

would it be ok to add these tests ?

bbloom19:01:15

so here’s a thing i’m tinkering with… considering finishing it up & submitting a CLJ/west talk about it: https://github.com/brandonbloom/metaclj — hopefully i find the time in the next week or two… feedback welcome simple_smile

ghadi19:01:06

Is that related to staging?

bbloom19:01:11

yeah, it is

bbloom19:01:36

it’s based on the “bracket” and “escape” operators from the staging literature, which are fancy versions of syntax-quote and unquote

jaen19:01:26

Is that something similar to what metalua does with it's metalevels?

ghadi19:01:48

Getting on a flight, interesting as always @bbloom

ghadi19:01:18

Been banging on the new HAMTs today

bbloom19:01:23

jaen: not familiar with metalua, but http://terralang.org/index.html is what got me off my ass to take another look at metaclj

bbloom19:01:26

looking at http://metalua.luaforge.net/quicktour.html now, yeah, it looks similar to the +{ and -{ syntax

ghadi19:01:38

Ugh sorry tracking link @bbloom

ghadi19:01:58

djb on the death of optimizing compilers

bbloom19:01:23

yeah i remember reading that

bbloom19:01:50

i’m a proponent of compilers that do only limited, obvious, predictable, optimizations

bbloom19:01:59

things you can meaningfully reason about and rely on

darwin19:01:18

I have a clojure library which is published on clojars. Newly I have also added a command-line client [1] into it. It has -main and uses clojure.tools.cli. I wonder how to instruct people to use it. I can use it from command-line by entering java -jar dirac-0.1.0-standalone.jar when I have that uberjar built from sources, my question is how to use it from clojars.

bbloom19:01:26

the cross your fingers and hope approach of javascript jits is awful

darwin19:01:33

I wasn’t able to find any docs about it on clojars

jaen20:01:18

@bbloom: that sounds interesting. If I understand what metlaua does properly it would make code like this evaluate instead of complaining about unquote being unbound?

(let [derp `(+ 2 2)]
  `(+ 2 ~(+ 2 ~derp)))
That is you could evaluate some quotation inside other quotation and rely on that result. Or maybe I'm misunderstanding something?

bbloom20:01:00

yeah, it should be possible to make that work

bbloom20:01:17

i haven’t done unquote yet in metaclj, but it would work just by calling eval … unless it’s inside my macro, then i can do something smarter

yenda20:01:44

@darwin: then just do a bash script that downloads the jar and runs it, or just supply the download link to the jar

arrdem20:01:21

ghadi: ar har har

darwin20:01:17

@yenda: ok, sound good, I think mvn install is what I need, and then ask mvn to give me path to that standalone jar

jaen20:01:31

Yeah, I don't think Java land has something similar to Ruby where it takes executable files from bin in the gem and makes them available to run (not a Java expert though). Writing a shell script seems reasonable in this case.

jonahbenton20:01:28

@darwin unfortunately it's more complicated than this. mvn install takes a jar already on your file system and puts it into your local maven repository- assuming you have maven.

jonahbenton20:01:22

what you probably want is as @yenda said- a bash script that only assumes the presence of java and curl, downloads a jar, and then runs it, a la a simplified version of lein's bootstrap script: https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein.

darwin20:01:28

ok, thanks, will consider that

darwin20:01:50

I wonder if there are any existing clojure libraries using this approach, or how they distribute cli clients?

dm320:01:45

AFAIK people use things like install4j

darwin20:01:23

now, I have figured out direct clojars urls: https://clojars.org/repo/binaryage/dirac/0.1.0/ but is seems there are not -standalone.jar versions there (although I’m pretty sure lein deploy clojars was showing them being uploaded)

darwin20:01:41

so I have probably another problem, how to run a jar, which has deps on its own

jonahbenton20:01:01

you can use an uberjar- a packaging of a jar plus dependencies- but capsule offers nice ergonomic options

darwin20:01:56

going to look into the capsule, thanks @jonahbenton

yenda21:01:34

you want an uberjar

yenda21:01:40

not just a jar @darwin

darwin21:01:01

@yenda: lein uberjar produces both jar and uberjar for me, both get uploaded by lein deploy clojars but only jar will appear in the clojars repo

darwin21:01:30

I think I have a promising path to success with maven

tcrawley21:01:21

@darwin: the deploy task doesn't upload the uberjar by default, so you shouldn't see any notification about it being uploaded

darwin21:01:36

have to download it first with deps: mvn dependency:get -DgroupId=binaryage -DartifactId=dirac -Dversion=0.1.0 then ask maven for classpaths for its deps and then execute java -cp $CLASS_PATH -jar $NON_STANDALONE_JAR_FROM_CLOJARS

tcrawley21:01:01

and if it is uploaded, clojars does no filtering to prevent it from being in the repo

darwin21:01:14

@tcrawley: ok, maybe I’m wrong / confused here, I just barely recall seeing it

euwyn21:01:46

can anyone point to an example of how to use stylesheets in a clojurescript react native project? (did js react native stuff before, jumping in on a clojurescript project and all i see is inline styles)

val_waeselynck22:01:02

@euwyn you may want to ask in #C03S1L9DN :)

darwin22:01:51

just for the record, this is working script I ended up with: https://github.com/binaryage/dirac/blob/master/scripts/agent-launcher.sh

rcanepa23:01:25

Hey everyone! What happens when a future is never dereferenced?… Or in other words, how safe is to execute some long task using a future if the result is never going to be used. For example, to save something in a database. Can I trust in that after the end of the task all resources are going to be freely available again?