#clojure log - Oct 09 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:00 Jesterman81: thanks for the help guys, appreciate it

0:00 awwaiid: oh even fancier

0:01 justin_smith: ,(map (juxt :foo :bar) [{:foo "foo" :bar "dummy" :axe "blood"} {:foo "baz" :bar "dummy"}]) ; if you want two specific keys

0:01 clojurebot: (["foo" "dummy"] ["baz" "dummy"])

0:57 kenrestivo: there's also select-keys

0:57 oic, backscroll

1:54 ddellacosta: kind of a Java question, but: how do I add something to the java.library.path (in Mac OS X)? I'm trying LD_LIBRARY_PATH in my bashrc but it's not working. Can I pass it in directly via lein?

2:02 nevermind, figured it out, I guess that's what jvm-opts is for

2:11 xinix: who knows Storm by clojure?

2:13 a real-time streaming style computation framework...who has its source code?

2:14 Rhainur: xinix: ???

2:14 lazybot: Rhainur: How could that be wrong?

2:14 Rhainur: xinix: it's open source: https://github.com/apache/storm

2:32 cfleming: So I have a question about circular namespace dependencies in Clojure

2:32 I thought they were actually illegal, but it seems like this might not be the case.

2:33 ztellman's manifold library has a bad case of them, by using require in the middle of a file.

3:18 xsyn: I have a stupid question

3:18 if I have a function which has a datalog query inside it

3:18 and the query is (q '[:find]… )

3:19 and I want to pas the :where clause of the query a value

3:19 how do I get it to eval that value?

3:19 so that the query sees it?

3:19 currently I'm getting: Unable to resolve symbol: id in this context

3:55 Nevermind, found my solution

3:55 my problem was that I was trying to use datalog to query a csv

3:57 ddellacosta: (Java interop question:) er, how do I call a static method on a nested class?

3:57 amalloy: ddellacosta: use the right name for the nested class

3:57 it's not Foo/Bar or Foo.Bar, it's Foo$Bar

3:58 ddellacosta: amalloy: yeah, I've got that far, but this doesn't seem to be working for me: (.staticMethod Foo$Bar) <- is that wrong?

3:58 amalloy: that's not how you call static methods on any class

3:58 ddellacosta: amalloy: yeah, so, I'm wholly ignorant of that I guess. :-(

3:58 * ddellacosta goes to look up java interop docs

3:59 amalloy: (Foo$Bar/staticMethod)

3:59 ddellacosta: amalloy: ah, right, thanks. Found it here simultaneously: http://clojure.org/java_interop

4:31 yedi: does anyone use cljs on the client with a non-clj lang on the server? curious about people's experiences and common dev practices

4:38 CookedGryphon: is there a neat way to do a count with transducers? I'm mapping a function over a coll, and then want to count how many items now pass a predicate

4:38 previously I was doing a filter then counting the result, but it I shouldn't need to construct an intermediate sequence at all

4:39 I mean i could map (constantly 1) and then transduce +, but that feels a bit clunky too

5:05 keeds: yedi: fynder.io use cljs with Haskell

5:55 cfleming: Can anyone point me to some information about &form & &env, in particular describing when they have to be explicitly passed, and when they should appear in argument lists?

5:57 I understand that they have to be passed when calling a different arity of the same macro

5:58 ticking: Does anybody know why the IAtom protocol of cljs is empty?

5:58 Bronsa: cfleming: they should never be explicitly passed

5:59 cfleming: Should they ever appear in arg lists of defmacro? They appear in the arg list of defn, but that's an fn marked with ^:macro

5:59 Bronsa: no they shouldn't, that's an implementation detail

5:59 cfleming: Bronsa: According to this, you sometimes have to: http://stackoverflow.com/a/25569059/155368

6:00 Bronsa: cfleming: that's a horrible thing to do

6:00 cfleming: you're invoking the macro as a function there

6:00 cfleming: Bronsa: It's not me - sadly as a tool developer I have to support people who do horrible things :-)

6:00 Bronsa: This is for arity checking in Cursive

6:00 Bronsa: one should do instead (defmacro x ([] `(x 1)) ([x] x))

6:01 cfleming: Bronsa: defn has them explicitly in its arg list

6:01 Bronsa: cfleming: that's because defn is implemented before defmacro

6:02 cfleming: Bronsa: Right. I'm just trying to figure out the rule for arity checking - currently Cursive thinks defn accepts 3 args and a rest.

6:03 Bronsa: Neat trick in your alternative there, but I can't say it's intuitive.

6:03 Bronsa: it's not a trick, it's the only way to do it right :)

6:04 cfleming: eeeh, I disagree, you're saying it's more intuitive to expect a macro to work like a function inside its decl?

6:04 cfleming: Well, or use a helper function as suggested in that post - or just not have multi-arity macros :-)

6:05 Bronsa: note that in the stackoverflow example he's doing (macro &form &env a b) and expects a and b to be evaluated at call time

6:05 cfleming: I think the helper function is probably the clearest solution of all of them.

6:05 Bronsa: me too

6:06 cfleming: but it's not always feasable. see e.g. c.c/or or c.c/and

6:06 cfleming: I think I'm just going to filter out &form and &env from arg lists and calls for checking arity, and anyone who does anything crazy like let-binding something and then explicitly passing it will get what they deserve.

6:06 Bronsa: heh

6:07 cfleming: how are you doing arity checking anyway? using :arglists?

6:07 cfleming: If it weren't for defn I'd just ignore the whole edge case.

6:07 Bronsa: if so, good luck with that. people are overwriting :arglists, it's unreliable

6:07 cfleming: No, I use the actual function arglists, so for defn it'll just be name & rest

6:07 Bronsa: ah ok

6:08 cfleming: Which is not very useful.

6:08 Yeah, I'd love to be able to rely on :arglists for more things (parameter info etc) but it's basically useless for my purposed.

6:08 purposes.

6:09 This arity checking is more useful for functions.

6:09 I also have to ignore any calls with unquote-splicing

6:09 Like (assoc ~map ~@kvs)

6:10 Bronsa: yeah. I proposed to split :arglists into :arglists and :doc-arglists months ago so that :arglists can be used by tools/compilers safely but it never got attention from core.

6:10 cfleming: Fortunately when I index I get both - it would be great to have it in the language.

6:10 Bronsa: cfleming: ah I didn't realize you're analyzing the unexpanded code

6:11 cfleming: Bronsa: Yeah, Cursive only works on source.

6:11 Bronsa: Which has its ups and downs, but mostly ups :-)

6:12 Bronsa: So I use :arglists when showing docs and so forth, and the actual arglists for this kind of thing.

6:13 Bronsa: yeah that's the only sensible way to do it

6:13 cfleming: Bronsa: I implemented a parsing framework for macros similar to seqex, so I'll potentially be able to use that to show more useful errors in the editor for forms that have an associated parser.

6:14 Bronsa: in eastwood we are actually using :arglists, but there are issues when users overwrite the default :arglists

6:14 cfleming: Eastwood parses source sometimes too, right?

6:15 Bronsa: yes it does, but mostly relies on the expanded AST & runtime informations

6:15 cfleming: I'm actually planning to pillage Kibit and Eastwood for inspections in Cursive soon.

6:15 Bronsa: awesome

6:16 cfleming: really good work with Cursive btw, I'm super impressed. I unfortunately don't use it myself as I've invested way too much time in emacs but I'll definitely be suggesting cursive to everyone who asks

6:16 (inc cfleming)

6:16 lazybot: ⇒ 4

6:16 cfleming: I can do some interesting other ones too, like (if-let [x (something)] ...) - if x is never referred to I can offer to update it to (if (something) ...)

6:16 Thanks, I'm glad you like it!

6:17 I'll be talking at the conj about the difference in approach between Cursive and practically everything else

6:17 i.e. the pros and cons of using source

6:17 It allows some really nice functionality

6:17 And means that everything just works with cljs

6:19 I'll let you know when the Kibit/Eastwood stuff is in so you can take a look. One of the many nice things about using IntelliJ is that that's all real time in the editor, and the quickfixes are right there too.

6:20 Bronsa: cool

6:21 cfleming: They seem to have improved their indexes in v14 too, which allows them to do this sort of thing: http://blog.jetbrains.com/idea/2014/10/automatic-notnullnullablecontract-inference-in-intellij-idea-14/

6:21 Guest_: may I ask, as a new Clojure learner, dabbling in Light Table - what I benefit from Cursive?

6:22 (would , not what)

6:22 cfleming: The interesting thing there is that they have a global graph structure, but still show the results in real time - I don't know how they do that.

6:22 Bronsa: magic that Just Works™ :)

6:23 cfleming: That means that I might be able to do some limited global type inference (which fns return seqs, for example) and provide useful warnings.

6:23 Bronsa: That's the idea :-)

6:23 I'll be able to mark globally unused vars shortly.

6:24 Guest_: Sure, it depends a bit what you're doing. Generally Cursive is very easy to set up and get going.

6:24 Guest_: If you're doing CLJS LightTable still has a lot going for it in terms of ease of use.

6:25 Guest_: But IMO Cursive has more functionality that you can grow into it as you learn more about it and get more used to Clojure.

6:27 Guest_: I see - have to try ... so I'm getting IntelliJ first and then more

6:27 thanks for answering

6:27 cfleming: Guest_: Think of it as probably roughly equivalent power to Emacs but without a lot of the swearing :-)

6:27 Guest_: great

6:27 cfleming: If you have problems, either hit me up here or on cursive@cursiveclojure.com

6:27 Guest_: I'm not going to learn emacs right now, I guess ...

6:28 :-)

6:28 cfleming: If you're just learning Clojure, I wouldn't recommend learning both at the same time, no.

6:28 dysfun: and of course emacs will ultimately be more extensible than cursive

6:28 cfleming: dysfun: Sure, no doubt.

6:28 Guest_: right now I'm in the "easy" section of 4clojure

6:28 dysfun: not that i didn't have to work quite hard on some things

6:29 Bronsa: dysfun: the question is if you really need all that extinsibility when coding

6:29 cfleming: dysfun: That said, there's a lot that Cursive can do that Emacs can't either - different pros and cons.

6:29 dysfun: of course. like everything.

6:29 personally i use emacs because a) my fingers are hardwired b) IDEs just irrationally irritate me

6:30 Bronsa: I mean, I've built emacs into my OS, but as for editing clojure I'm not sure clojure-mode + SLIME is much superior to Cursive at this point

6:30 dysfun: SLIME? nrepl-cider

6:30 Bronsa: no thanks

6:30 dysfun: heh, i patched that

6:30 i use ac-nrepl-compliment sometimes too

6:31 Bronsa: I've tried switching from slime to nrepl/cider at least 5 differnt times, everytime I went back crying.

6:31 cfleming: Yeah, there's still a bunch of Emacs functionality I'm catching up with, but it's all fairly doable. But there are a lot of things that an AST and global indexes allow that are really cool.

6:32 dysfun: i was never a SLIME user and i gravitated towards cider

6:32 cfleming: Bronsa: I'm actually going to have to add a minimal REPL to Cursive - there are a surprising number of people who basically want inferior-lisp

6:33 I was surprised, anyway.

6:33 dysfun: what functionality do you provide that you consider replaces it?

6:34 presumably something like lighttable's live eval?

6:34 cfleming: That I consider replaces what?

6:34 dysfun: the need for a repl

6:34 cfleming: Oh, I don't - Cursive has full nREPL integration

6:34 dysfun: oh i see what you mean

6:35 i'll have to give it a play sometime. when i last used it, it was pretty terrible for actually writing lisp

6:35 cfleming: But there are a lot of people who don't want that - they just want a prettier wrapper around clojure.main, basically

6:35 What was, IntelliJ?

6:36 Bronsa: cfleming: I'm actually not surprised -- one of the things I dislike most of both Cursive & CCW is actually their repl interface

6:36 dysfun: Cursive

6:36 cfleming: dysfun: If you try it again I'd be interested to know what you're missing.

6:37 Bronsa: It's not so much the interface, people don't want nREPL, and especially lots of magic in middleware.

6:37 Bronsa: cfleming: ah well, I don't know anything about that :)

6:38 cfleming: Bronsa: see https://gist.github.com/levand/b1012bb7bdb5fcc6486f

6:39 clgv: Bronsa: what is bad about repl interface in CCW & Cursive?

6:39 milos_cohagen: If 95% of the time I use emacs+cider to eval forms and get back response in mini-buffer, would that be called using a repl?

6:40 dysfun: cfleming: it was more that i didn't even have things i consider basic like rainbow parens

6:40 cfleming: dysfun: It does have that, you have to turn it on

6:40 milos_cohagen: I'll pull up the repl buffer if I print something big.

6:41 TEttinger: dysfun, yeah I loved that in light table. but nightcode doesn't have rainbow parens yet

6:41 clgv: cfleming: do you use tools.analyzer to get the AST for Cursive?

6:42 cfleming: clgv: No, I use a custom parser

6:42 clgv: The AST elements have to be derived from IntelliJ base classes

6:42 clgv: cfleming: ah ok. a translation from a tools.analyzer would have been difficult?

6:42 CookedGryphon: Does anyone know if count can work with transducers?

6:43 clgv: +AST

6:43 CookedGryphon: I don't want to build the intermediate collection, just count the things that end up coming through after my mappings and filters

6:43 clgv: CookedGryphon: should be doable though you will need a volatile for the counting state

6:43 cfleming: clgv: I'm actually not sure - I started out using a custom parser before tools.analyzer was around, and I haven't investigated whether it would be worth switching.

6:44 clgv: cfleming: ah so that is the main reason

6:44 CookedGryphon: clgv: Is there nothing in the standard library, this doesn't feel like something I should need to roll my own for

6:44 clgv: CookedGryphon: probably not yet since transducers are alpha

6:44 or ebta?

6:45 cfleming: clgv: The parser is actually pretty simple since I have to maintain all source information (comments etc) too, so it's very much just the basic forms - lists, symbols, keywords etc. The more interesting stuff I build on top of that myself.

6:45 clgv: CookedGryphon: but you could come up with a `counting` function and submit it as patch

6:46 cfleming: clgv: Speed is also an important issue since Cursive parses a *lot* - the current parser is actually Java

6:47 clgv: cfleming: interesting, though you could just use clojure with mutable stuff (deftype with mutable fields)

6:48 cfleming: to gain similar/same speed

6:48 Bronsa: clgv: there are actually issues with that b/c clojure functions have to box chars

6:49 clgv: Bronsa: ah well, didn't know you need to store primitive chars for that...

6:51 Bronsa: clgv: cfleming I actually don't think using tools.analyzer for guiding an editor/IDE gains you that much TBH

6:51 clgv: Bronsa: yeah, I am not really satisfied with the implementation of Clojure's primitive function

6:51 Bronsa: but if you have no parser at the start of your project?

6:51 *no other parser

6:51 +analyzer

6:52 Bronsa: clgv: the thing is, t.a helps you if you can actually evaluate each form as you go. if you can't, you have to work your way to lie to tools.analyzer and make it believe everything's fine

6:53 this is a consequence of clojure's compilation model btw, there's nothing I can do about it

6:54 clgv: Bronsa: ah ok, in short it is not analyzing statically?

6:55 Bronsa: clgv: it is analyzing statically, the issue is that the compilation level is the top-level form

6:55 compilation unit*

6:57 clgv: Bronsa: so you mean you got to maintain the context that was evaluated before the current top-level form?

6:57 Bronsa: clgv: yeah well, I just plug into clojure's namespaces

6:58 clgv: the POC is this: (defn x [] 1) (defmacro y [] (x)) (defn z [] (y))

6:58 clgv: you could analyze just fine the first two forms without any evaluation

6:59 but when you get to z, you need x to be evaluated in order to be able to do the macroexpansion

6:59 clgv: ok

7:00 Bronsa: racket has a mechanism to work around this issue, by defining some sort of compilation levels but basically all lisps that I'm aware of have this "issue" that emerges

7:05 cfleming: Bronsa: Do you know why the extra attr-map at the end of the multi-arity form of defn is required?

7:06 Bronsa: cfleming: no, I never understood why it's there

7:06 nor have I ever seen it actually used FWIW

7:06 cfleming: Bronsa: Me either, it's not even in a different scope - it's really weird.

7:07 That's good to know.

7:09 clgv: cfleming: yeah that one is strange.

7:23 Guest_: newbie looking for help in understanding recursive example

7:23 the assignment ist http://www.4clojure.com/problem/28

7:24 the (working) solution I have is:

7:24 (defn -flatten [coll]

7:24 (if (coll? coll)

7:24 (mapcat -flatten coll)

7:24 [coll]))

7:24 clgv: Guest_: post it on refheap.com please

7:24 Guest_: ah, ok

7:25 [learning how to do this]

7:25 https://www.refheap.com/91454

7:25 clgv: Guest_: what is you question about that function?

7:26 Guest_: trying to analyze what's going on inside the recursive loop

7:27 I inserted a (println coll) to look at ir

7:28 like so:

7:28 https://www.refheap.com/91454

7:28 why do I never see the complete coll in the prints?

7:28 (I#M feeling dense ...)

7:29 schmir: Guest_: the println changes the return value

7:30 Guest_: ah ...

7:31 recursive thinking need alot of practicing, I guess

7:33 what would be the best way to look into the iterations of a recursive loop?

7:34 (I thought println would be sensible)

7:34 schmir: the problem you introduced has nothing to do with recursion.

7:34 Guest_: ok

7:34 schmir: println returns nil

7:34 Guest_: yes

7:35 I had the println before the mapact

7:35 schmir: so, the function with the println returns nil, since you put the println at the end of the do block

7:35 clgv: Guest_: just add (println coll) after [coll]

7:35 Guest_: (sorry)

7:35 clgv: then you see the collection per function call

7:36 Guest_: in a (do ..) ?

7:36 clgv: no

7:36 Guest_: ok

7:36 thanks

7:36 clgv: just before the `if` the `defn` has an implicit `do` for its body

7:36 Guest_: (I know this questions are very newbish)

7:37 clgv: Guest_: you got a book to learn those basics quickly?

7:37 Guest_: yes

7:37 clgv: ,(defn -flatten [coll] (if (coll? coll) (mapcat -flatten coll) [coll]))

7:37 clojurebot: #'sandbox/-flatten

7:37 clgv: Guest_: then best interleave reading and experimenting at the repl

7:38 Guest_: yes, just now in Light Table

7:38 "#'sandbox" is something I can look up?

7:39 clgv: ,(-flatten (last (take 100 (iterate list nil))))

7:39 clojurebot: (nil)

7:39 clgv: ,(-flatten (last (take 500 (iterate list nil))))

7:39 clojurebot: (nil)

7:39 clgv: ,(-flatten (last (take 5000 (iterate list nil))))

7:39 clojurebot: #<StackOverflowError java.lang.StackOverflowError>

7:39 clgv: Guest_: `sandbox` is the namespace where the bot evaluates our commands

7:40 Guest_: ah, sorry

7:40 clgv: Guest_: in your repl you likely have `user`

7:40 Guest_: understood

7:40 thanks

7:40 clgv: the last expression demonstrates that the -flatten is subject to a stackoverflow. but maybe you wait until later to find out what the problem is ;)

7:41 Guest_: could be solved by recur, I guess

7:42 clgv: Guest_: for a lazy-seq approach there should be no stacked `concat` which is implicitely called in `mapcat`

7:42 Guest_: ah ...!

7:42 good, that is something to think about

7:43 "interleave reading and experimenting at the repl" is what I do since a few days

7:43 clgv: ,(flatten (last (take 5000 (iterate list nil))))

7:43 clojurebot: (nil)

7:43 clgv: gooad ^^. next you should get an individual irc name so that people can remember you around here ;)

7:43 Guest_: ok

7:44 thanks again!

7:57 mmeix: done

7:57 clgv: good.

8:00 mmeix: "stacked 'concat' " was the point, I hadn't quite understood

8:00 but it gets clear

8:02 (I'm positively surprised by the helpfulness I experienced here in te last days)

8:04 clgv: mmeix: you usually get good help here. usually you should find a minimal version of your source that produces the same problem and describe what you expect and what happens to get fast answers

8:04 mmeix: yes, I'm trying ...

8:05 for a newcomer the question is often not so clear, but it's getting better :-)

8:05 back to 4clojure

8:06 clgv: lazybot can also help you if you know examples that specify your function ;)

8:06 mmeix: what/who is lazybot?

8:06 clgv: $findfn odd? (range 5) [1 3]

8:06 &42

8:06 lazybot: ⇒ 42

8:06 clgv: that guy ^^

8:06 mmeix: a robot I guess

8:07 lazybot: Execution timed out.

8:07 []

8:07 clgv: $findfn odd? [0 1 2 3 4] [1 3]

8:08 lazybot: Execution timed out.

8:08 clgv: ah well maybe that feature broke...

8:08 lazybot: []

8:59 justin_smith: $findfn 6 3 3

9:00 lazybot: Execution timed out.

9:00 [clojure.core/max-key clojure.core/cond clojure.core/char-escape-string clojure.core/-' clojure.core/*data-readers* clojure.core/- clojure.core/default-data-readers clojure.core/unchecked-subtract clojure.core/*clojure-version* clojure.core/unchecked-subtract-int clo... https://www.refheap.com/91458

9:01 justin_smith: so it times out, and it also finds me a bunch of answers

9:01 cool

9:03 greghendershott: I want to split a URL string into the components (scheme, host, port, etc.). In Racket I'd use string->url. What's a good way to do that in Clojure?

9:04 justin_smith: ,(bean (java.net.URL. "http://www.google.com"))

9:05 clojurebot: #<MalformedURLException java.net.MalformedURLException: denied>

9:05 justin_smith: greghendershott: if you run that locally you will see the "bean" abstraction for that class - but each key in that map also represents a more efficient method call that you can call directly

9:06 greghendershott: justin_smith: Ah, so Java interop for that. Thanks!

9:06 justin_smith: ,(.getProtocol (java.net.URL. "http://www.google.com"))

9:06 clojurebot: #<MalformedURLException java.net.MalformedURLException: denied>

9:06 justin_smith: :P

9:06 sw1nn: hi, can anyone offer any suggestions on avoiding this stack overflow using transducers? Problem exists in clojure and clojurescript (running in chrome 37). Not sure if I'm doing something dumb, but for small values of the repeat it works as expected, but larger values cause Overflow. https://gist.github.com/sw1nn/f8463b5bfed6db7a9f30

9:07 justin_smith: greghendershott: yeah, the jvm interop for the net stuff is decent, and you can use various apache libs for more advanced functionality too (by including them in your project.clj of course)

9:08 dnolen_: greghendershott: note using bean means you can use interact with the url as a map, (:protocol (bean (java.net.URL. "http://google.com")))

9:08 verma: TIL about bean

9:08 justin_smith: dnolen_: yeah, that's why I showed that first - do you happen to know how big the overhead on bean is?

9:09 greghendershott: justin_smith: dnolen_: Thanks. A (correct) regexp for splitting URLs is non-trivial, so happy to use something "official".

9:09 dnolen_: justin_smith: probably not small but this doesn't sound like he's going to stick it in a loop

9:09 justin_smith: fair point :)

9:10 greghendershott: Feeling a little worried I don't know enough Java, and how much will I need to learn to be effective in Clojure. But, I'm just getting started.

9:10 dnolen_: sw1nn: I'm somewhat confused as to why that code is written that way

9:10 greghendershott: Open mind, turn on firehose

9:11 justin_smith: greghendershott: knowing java is not a huge concern, knowing how to search and read javadoc (and use what it describes via interop) will help you a lot

9:12 greghendershott: justin_smith: Ah right I meant the libs/ecosystem, what's out there to use. Not the lang. Thanks for the tip re javadoc and interop.

9:12 justin_smith: greghendershott: I find the javadoc-search-pane (for chrome and firefox) really helpful for finding what I want

9:12 * greghendershott takes notes

9:13 justin_smith: https://chrome.google.com/webstore/detail/javadoc-search-frame/mfgkihmpcjjnijmkchojlbccbmhcdfcd?hl=en

9:13 it does completion of potential matches as you type, which is a huge help

9:13 sw1nn: dnolen_: well, it's an experiment with transducers, so it could be artificial. I'm receiving sequences [0 1 0 1 0] I want to total up all the 1s basically.

9:14 ie. [[0 1 0 1 0][1 0 0 1 0] ... [1 1 1 0 0]]

9:14 greghendershott: justin_smith: Thanks!

9:16 dnolen_: sw1nn: in any case the stack trace is clear, it looks like you have build up a bunch of lazy map ops and you realize it at the end and blow the stack. Nothing much to do w/ transducers.

9:17 Bronsa: sw1nn: what dnolen_ said. if you replace map with a mapv it should work fine

9:17 or (doall (map

9:17 sw1nn: dnolen_: ahh..I was being dumb :-), mapv works.

9:19 justin_smith: greghendershott: dnolen_: turns out the standard deviation of bean is greater than the execution time of a direct method call. https://www.refheap.com/91459 0.28 vs. 8.4 µs

9:20 For what it's worth. I had heard bean had a big overhead but had not microbenchmarked it before.

9:24 ckirkendall: Anyone out there run into the clojurescript compiler hanging indefinitely when dealing with large quoted forms.

9:25 dnolen_: ckirkendall: haven't heard of this being a problem, but entirely possible - somebody may have never tried that before

9:25 ckirkendall: I know at one point large EDN structures were an issue until a parsing fix landed in Closure Compiler

9:26 stuartsierra: justin_smith: oh yeah, `bean` does full reflection on every call; wildly inefficient.

9:26 Bronsa: stuartsierra: on every call? couldn't it do it once and cache?

9:27 stuartsierra: Couldn't I fly if I flapped my wings hard enough?

9:30 ckirkendall: This is a large edn file being brought in as a quoted structure through a macro.

9:31 Bronsa: ckirkendall: in clojure it's often not a good idea to include big literals in code, I suppose it might be similar for cljs

9:31 ckirkendall: dnolen_: it compiles find if optimizations is set to none.

9:31 dnolen_: ckirkendall: so it's a Google Closure thing it sounds like

9:31 ckirkendall: dnolen_: that is the feeling I have.

9:32 dnolen_: ckirkendall: you may be hitting another parse corner case in Closure, what version of Google Closure do you see via lein deps :tree?

9:33 ckirkendall: dnolen_ Bronsa: v20140625

9:35 schmir: how do I exclude some namespaces from an uberjar?

9:35 dnolen_: ckirkendall: yeah pretty recent, you might want glance over the generated :none JS to see if something stands out

9:36 ckirkendall: also might make sense to describe how much JS you are generating - megabytes?

9:36 ckirkendall: dnolen_: will do. In the mean time I think we will take Bronsa's suggestion and try loading this at run time.

9:37 dnolen_: ckirkendall: yeah that's the simpler solution - another option is to just give Google Closure more memory - there's really no such thing as too much in my experience.

9:37 justin_smith: updated - with more fields accessed, and a hash-map created, the performance difference is much smaller

9:38 https://www.refheap.com/91459

9:38 ckirkendall: dnolen_: going to look at the memory thing right now., If that is the issue its easy to fix.

9:40 justin_smith: schmir: if you only need those libs at dev time, you can put them in a dev profile http://blog.japila.pl/2012/06/exclude-dependencies-from-uberjar-in-leiningen-2/

9:40 oh wait, namespaces...

9:41 you could put the namespaces in a separate folder that is in your :dev :source-paths so that they are only found during dev time

9:43 schmir: justin_smith: right. but I'm looking for another solution. I'd like to keep the files in the same directory.

9:43 justin_smith: a hacky way to do it would be deleting the .class files from the uberjar - it's just a zip file after all

9:43 xeqi: schmir: In that case use :uberjar-exclusions https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L385

9:44 justin_smith: oh that's much better

9:44 (inc xeqi)

9:44 lazybot: ⇒ 14

9:45 schmir: xeqi: ok, will try that. I thought this is only for resource files. let's see

9:46 justin_smith: resource vs. class stuff is a very leaky abstraction - it's all just stuff that ends up on the classpath

9:52 schmir: xeqi: thanks. that seems to work, though it still aot compiles the excluded files.

9:52 (inc xeqi)

9:52 lazybot: ⇒ 15

9:52 ckirkendall: dnolen_ memory doesn't seem to be the issue. On to the javascript.

9:58 arrdem: mdrogalis: lol @ pool request

10:04 mdrogalis: arrdem: :D

10:04 I'm a doofus in the morning.

10:05 greghendershott: justin_smith: So the map from (bean (java.net.URL. "http://www.google.com")) includes `:content #<HttpInputStream sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@56e01e8a>`

10:05 Is that b/c `bean` is calling getContent http://docs.oracle.com/javase/7/docs/api/java/net/URL.html#getContent%28%29 which opens a connection?

10:05 b/c I don't want a connection, I just want to parse the URL into its components.

10:05 Hmm....

10:06 justin_smith: greghendershott: that would be a good reason to use the accessors directly, and likely, yes, that is what is happening

10:06 greghendershott: Maybe I can not use `bean`, and somehow call the members individually?

10:06 Ah OK I'll work with that. Thanks.

10:06 justin_smith: right - did you see my updated paste? it includes creating a hash map directly using the accessor methods

10:07 https://www.refheap.com/91459 see the very last benchmark

10:07 greghendershott: justin_smith: Oh sorry, no I missed that. scrolling.... back. You posted it again. :) Thanks! Got it.

10:08 OK so this is cool. I didn't expect I'd need to learn interop basics this early, but it's fine, that's good.

10:08 justin_smith: it's pretty simple

10:08 (mostly)

10:09 greghendershott: Simple things are simple, I imagine? :)

10:10 justin_smith: it's not just that - there's little things that expose differences between how clojure uses the jvm and how java uses it -- varargs are a bit weird, and things that specialize on int

10:11 clgv: justin_smith: did you typehint `loc` or is it's type inferable by the compiler?

10:11 -' :(

10:12 justin_smith: clgv: loc is defined before the other forms are compiled

10:13 or does that not help?

10:13 I can try with typehinting and see if it makes a difference

10:13 clgv: justin_smith: if it has a typehint on the var it's fine otherwise there is reflection involved

10:13 ckirkendall: dnolen_: the quoted form that seems to be giving it trouble is 49k when compiled with no optimizations. I don't see anything that is odd obout the javascript.

10:14 justin_smith: clgv: so I need (def loc ^java.net.URL (java.net.URL. "http://www.google.com")) ?

10:14 I'll try it

10:14 clgv: no on the var

10:14 move it one position to the front

10:14 justin_smith: clgv: got it, thanks

10:14 this hinting stuff keeps surprising me

10:16 clgv: justin_smith: vars are an indirection so the compiler has no clue which type of value they refer to (it could change during runtime). with the type hint you tell the compiler that the type remains the specified one

10:17 justin_smith: OK

10:18 TimMc: That's a really good point.

10:20 justin_smith: oh wow, that is a huge difference, paste updated - that makes the direct access version very fast https://www.refheap.com/91459

10:20 (inc clgv)

10:20 lazybot: ⇒ 29

10:22 clgv: ah yes, that's more like it :D

10:22 Bronsa: I am always moderately annoyed that clojure doesn't have any option to turn on simple global type inference on things like (def a (Foo. ))

10:23 justin_smith: yeah, it was counterintuitive that it wouldn't attempt that

10:23 I mean, that's a pretty safe thing to add a hint to

10:23 clgv: Bronsa: but you still would need something like (def ^:infer-constant-type foo (Foo.))

10:23 Bronsa: build profiles are getting to the top of my wish-list pretty fast

10:23 clgv: since you are allowed to rebind the var to anything

10:24 Bronsa: clgv: no a per-form config option wouldn't make sense, agreed

10:24 clgv: Bronsa: damn I forgot to mention the work on "static" functions as feature I want in the survey

10:25 hyPiRion: Have people talked about how they want better error messages yet?

10:25 Bronsa: clgv: build profiles are way more essential IMHO

10:26 clgv: Bronsa: just my perspective ;)

10:26 Bronsa: clgv: adding features to the compiler right now is really painful

10:26 clgv: Bronsa: I'll agree on build profiles being number one if there are performance optimization for production builds included ;)

10:26 Bronsa: clgv: sure, that's the whole point :) but you need the infrastructure in place before adding those or it will get a mess

10:27 clgv: Bronsa: agreed

10:28 Bronsa: unfortunately I doubt there's any interest in refactoring the compiler ATM

10:28 justin_smith: clgv: what about automatically hinting by default on def when the class is trivial to determine at compile time? what's the counter argument for doing that?

10:28 Bronsa: justin_smith: you might be at the repl and later want to rebind the var to a different type

10:28 justin_smith: yes we are allowed to rebind a def to a different class, but even with hinting that wouldn't break anything would it? you just get the wrong type hint

10:29 clgv: justin_smith: what Bronsa said.

10:29 Bronsa: and if you have already evaluated a function that does interop on that var, it's broken

10:29 justin_smith: ahh

10:29 got it

10:29 that's what I was looking for, thanks

10:29 (inc Bronsa)

10:29 lazybot: ⇒ 58

10:29 clgv: justin_smith: primitive functions that are called accordingly are a good example for that

10:30 when you reevaluate the function without the primtive typehints the callsite will throw

10:31 Bronsa: I'd like to see a benchmark to see how much an impact compiling to (if (instance? primInterface x) (.invokePrim x ..) (invoke x ..)) instead of directly yo (.invokePrim x ..) has

10:32 protocols callsites compile to something like that and they are pretty fast so I'm not sure it would be a prohibitive enhancement

10:32 justin_smith: cheaper than reflection to be sure

10:32 clgv: Bronsa: or (try (.invokePrim x ..) (catch ApropriateExceptio e (.invoke x ..))

10:33 Bronsa: clgv: oh yeah

10:33 it might have some impact on jvm inlining though

10:34 clgv: Bronsa: both? or just the try-catch version?

10:35 Bronsa: both, or neither :P I don't really know enough about it

10:35 clgv: Bronsa: I have no clue about the internals of inlining on the jvm ;)

10:38 Bronsa: maybe I try that, I was working on more flexible primitive functions anyway

10:38 Bronsa: clgv: I'd be interested to know about that

10:43 clgv: Bronsa: currently I am just hacking the compiler from a library

10:44 i.e. reusing its class generation features for reify

11:10 yedi: does anyone use cljs on the client with a non-clj lang on the server? curious about people's experiences and common dev practices

11:12 daniel___: yedi, dont think so

11:12 thats crazy

11:12 yedi: =p , jc to know if ppl have written about their experiences somewhere

11:13 justin_smith: daniel___: saw some guy on twitter talking about using cljs with rails

11:13 shem: yedi: i'm doing such a thing right now. cljs/om in the client, perl in the server (for legacy reasons). communication via json

11:14 muraiki: shem: are you doing anything with websockets in perl?

11:14 justin_smith: daniel___: a coworker of mine made some great stuff using cljs on the frontend and google app-engine and node.js on the backend (two different projects)

11:14 shem: muraiki: nope

11:15 yedi: shem: cool! i guess it's been working out pretty well?

11:15 muraiki: shem: I work at a perl shop and our internally developed framework doesn't really have a way to easily fit in something like websockets... was just curious if you had explored that in perl :)

11:15 shem: yedi: it's certainly more fun than doing mostly everything on the server side with perl

11:16 yedi: shem: for packaging different cljs code for different webpages and sending them to the client, how do you go about that? do you simply just build a bunch separate js files from the cljs and choose which ones to included in the html markup?

11:17 oooo clojure cup results are out

11:17 shem: yedi: i use simple routing inside the root component like this: https://github.com/swannodette/om/issues/235#issuecomment-53092555

11:18 yedi: btw there's a #clojurescipt channel which might be more appropriate for this

11:18 yedi: shem: oh it's in the style of a one page application? all your pages require the same cljs?

11:18 clojurebot: excusez-moi

11:18 yedi: ah true, i forget ##clojurescript is a thing

11:19 cka3yc: 1

11:19 shem: yedi: yeah, one page logically. but many completely different views

11:21 yedi: shem: right, so when loading a view that isn't the index or main page. do you send the base/root js to the client and then it requests what's needed from the server to generate to view? so two round trips instead of 1?

11:21 the winning app: http://youmusic.clojurecup.com/ doesn't even seem to work for me

11:21 shem: nope, no communication with server

11:22 i just change the route-name in app state and om renders a different view

11:24 yedi: shem: ah ok, seems simple enough. thanks for sharing

11:24 cka3yc: Hello, trying to read tar.gz file like so :

11:24 (with-open [in (java.util.zip.GZIPInputStream.

11:24 (clojure.java.io/input-stream

11:24 "my-file-name.gz")

11:24 and getting "Not in GZIP format", but i can open this archive in my file manager without any problems, what can be the problem here? I'm on Windows 7

11:25 p_l: it's probablyt not a gzip file

11:32 daniel___: justin_smith: wasnt completely serious, it could obviously work

11:32 its a bit strange if you have a choice in the matter though

11:40 justin_smith: yeah, those examples had client requirements that ruled out clj on the back end

11:43 seangrove: I'm really starting to get attracted to the idea of a clojure-flavored haskell. Could be a lot of fun.

11:44 justin_smith: seangrove: flavor as in syntax or semantics?

11:45 seangrove: Clojore-syntax, clojurescript-macros, haskell/ghc typing

11:45 justin_smith: ahh, OK

11:45 seangrove: No runtime macros, but we don't have them in cljs anyway

11:46 Also, the degree of purity Haskell has means the compiler is free to do a lot more

11:46 It's an interesting set of ideas, I can definitely see why Haskell is academia's playground

11:55 dnolen_: seangrove: I think this idea doesn't really make any sense - you already have core.typed, HM style typing while preserving Cljoure semantics. What you're talking about sounds like Haskell w/ Lisp syntax http://clemens.endorphin.org/ILC07-Liskell-draft.pdf - it wouldn't feel like Clojure at all same way that Haskell does not

11:56 seangrove: dnolen_: Yeah, certainly I'd rather it be closer to Liskell (not a fan of Haskell syntax at this point), but core.typed being optional makes it largely useless without a ton of discipline and buy in from everyone

11:56 dnolen_: I like core.typed too, but having seen it in a large code base, it's really subject to bitrot

11:57 It's just an idea I'm considering playing with a bit more though

11:59 dnolen_: seangrove: I don't see how this any different from evolving code conventions, deprecated libraries / APIs, etc.

11:59 investing in anything is a shit ton of work

12:00 seangrove: dnolen_: Except if the libraries aren't doing the typing as well, then you're doing a huge amount of work for every library that you bring in

12:00 Just a cultural thing that causes a lot more pain for core.typed users than for ocaml/haskell users

12:00 dnolen_: seangrove: what you're saying still doesn't make sense given the larger goals of gradual typing

12:01 seangrove: the the point is not to type everything in the world

12:01 this is a waste of time

12:01 seangrove: dnolen_: Ah, yes, I'm sorry. I'm saying that gradual typing is a really tough problem

12:01 Don't mean to open up a debate, it's not a hugely interesting problem

12:01 dnolen_: seangrove: no static typing has the same problem

12:01 bbloom: seangrove: gradual typing is rapidly becoming pretty well understood :-)

12:01 dnolen_: seangrove: there's thing called Type Providers in F# for a reason

12:02 seangrove: dnolen_: I'll have to look up type providers, thanks. Haven't looked into F# at all yet

12:02 dnolen_: seangrove: even if you did come up with such a thing good luck providing semantics for interop anyhow

12:03 bbloom: type providers are pretty damn cool

12:04 dnolen_: which is another thing that core.typed doesn't get enough credit for, attempting to give semantics to host

12:05 seangrove: dnolen_: How so?

12:05 zot: is there any notion of directly accessing the parent namespace? e.g., i'm in foo.bar.baz, and want to access foo.bar/funk — is there a relative/.. style access, or do i just need to explicitly say foo.bar/funk?

12:05 dnolen_: seangrove: dude, read the paper :)

12:05 seangrove: dnolen_: Will do

12:05 clgv: zot: no. there is no such runtime concept as parent namespaces

12:05 bbloom: zot: relative imports are a bad idea

12:06 clgv: zot: actually, there is no guarantee that a namespace class for a parent (according to your definition) exists at all

12:06 zot: use aliases as in (:refer [foo.bar :as fb])

12:06 technomancy: bbloom: why is that?

12:07 zot: i don't have a need for guarantees, but i too am curious about the bad idea flag :)

12:07 s/flag/flag-in-the-ground/ :)

12:07 bbloom: b/c it makes it harder to grep for usages of namespaces

12:07 clojurebot: It's greek to me.

12:07 bbloom: b/c it saves like ~20 characters in an entire file

12:07 b/c you should use aliases anyway

12:08 b/c there's no such thing as a parent directory in unix

12:08 i'm sure i could think of a few more :-)

12:09 sritchie: technomancy: oh man, I finally found it: https://github.com/zcaudate/lein-repack

12:09 bbloom: b/c it makes the meaning of a file's code depend on the location of the file

12:09 nothing else does that right now

12:09 btw python 3 removes relative imports ...

12:10 or rather *implicit* ones, i bleieve

12:10 technomancy: bbloom: racket has them

12:10 bbloom: technomancy: racket has everything

12:10 technomancy: the grep thing I'd buy; the other reasons are bogus

12:10 I'm still wondering what it would look like if you could chop of a subtree of namespaces and treat them as an isolated unit

12:11 I think you could solve a lot of dependency problems that way

12:11 bbloom: you can't cat a file to the compiler and have it work if you've got relative imports

12:11 b/c you need to know the file's path

12:11 sritchie: technomancy: that plugin I just sent you allows you to do that with a lein proj (I just jumped in so I’m probably missing a ton of context)

12:11 bbloom: nothing else in clojure is source location dependent

12:11 technomancy: you can't cat a file to the compiler and have it work anyway

12:11 bbloom: sure you can

12:11 technomancy: FSVO of "work" that includes line numbers

12:11 bbloom: that's basically what load-file does

12:12 but it does know the file path ;-)

12:12 technomancy: right

12:12 bbloom: the way people use inferior lisp probablyw ouldn't work b/c it really just does pipe stuff, as far as i udnerstand

12:12 but i'm not a emacs guy

12:12 technomancy: any definition of "work" that doesn't give you useful error messages is not a definition I buy

12:12 milanj: hi, what's best way to extend exception

12:12 bbloom: milanj: use ex-info and ex-data

12:12 milanj: or if you absolutely must make a custom subclass for interop purposes, write java

12:13 milanj: I don't want it for inter opt purposes

12:13 bbloom: (doc ex-info)

12:13 clojurebot: "([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data."

12:13 bbloom: ^^ that's what you want

12:13 milanj: ok, let me check those

12:22 bbloom, thanks

12:22 btw. this doesn't look nice

12:23 bbloom: what's not nice about it?

12:23 technomancy: it's a lot nicer than subclassing Exception

12:24 milanj: that is right

12:24 lvh: reiddraper: Hi! You wouldn't happen to know if there's a URL generator, or, maybe more generally, generator-generator from instaparse, or generator-generator from ABNF?

12:24 milanj: bbloom, well, you manually comparing things from map that you put in exception

12:24 probably can be made better with some macro

12:25 jeremyheiler: lvh: this might help: https://github.com/bowmanb/schema-contrib

12:25 for urls

12:25 milanj: I can, judging by this you only need on Exception class

12:25 jeremyheiler: it uses instaparse under the hood

12:25 lvh: jeremyheiler: Yeah, I'm using that. It has a URI schema, I'm trying to turn that into a test.check generator

12:25 bbloom: milanj: i'm not sure i understand your complaint

12:26 technomancy: milanj: it is a shame there's no built-in macro to pattern-match against ex-data

12:26 mdrogalis: milanj: I think I know what you're saying. You're repeating the keywords in the map?

12:26 You'd have to repeat the method call to Exception's subclass. It's a superficial difference, if I understand correctly.

12:27 milanj: if java was like this we would throw only OneException with map in it and then compare it by hand

12:27 technomancy: java sucks at having syntax for data though

12:27 milanj: yes, cool thing is that lisp allow it to play with syntax

12:27 reiddraper: lvh: nothing that i'm familiar with, but a url generator would not be difficult to write

12:28 technomancy: milanj: there's sort of pattern-matchy stuff in slingshot that works on ex-infos

12:28 Bronsa: how cool would it be if catch could destructure ex-infos?

12:28 technomancy: https://github.com/scgilardi/slingshot

12:28 lvh: reiddraper: yeah, I just try to avoid writing code :) any particularly good contrib libs that I could contribute a generator to?

12:28 milanj: technomancy, thanks, I'll check that for sure

12:28 native solution is ugly

12:29 technomancy: milanj: it gives you all the building blocks you need, but it's low-level

12:29 reiddraper: lvh: hmm, maybe https://github.com/gfredericks/test.chuck

12:29 cc gfredericks ^

12:29 lvh: reiddraper: awesome, thank you :)

12:29 reiddraper: np

12:30 milanj: technomancy, sure, but exception handling is something that is basic enough to have good solution in core language

12:30 so anyone can use the same solution

12:30 technomancy: milanj: and so is pattern matching; I agree =)

12:30 lvh: particularly gen'/for seems very useful for my url maker :)

12:31 technomancy: milanj: but if you ever tried to contribute a change to clojure you'd understand why it's this way

12:32 milanj: technomancy, I just started with clojure, coming mainly from CL world (and Java in last couple of years)

12:32 mdrogalis: Welcome :)

12:32 milanj: (don't make me mention cl conditions system) : ))

12:33 Bronsa: technomancy: things are a bit better now than before though, puredanger is actually responsive :)

12:33 milanj: ok, thanks to all

12:33 technomancy: milanj: yeah the only thing I'm still jealous of CL about =)

12:33 mister_zombie: Hi, I'm new to clojure, as an introductory project I wanted to build a thing that parses a webpage to check for missing alt properties on img tags

12:34 milanj: btw. is that decision because of interopt with java or something else (not to have conditions) ?

12:34 technomancy: Bronsa: I've seen fixes go through better than in the old days, but I'd still much rather contribute to slingshot than clojure itself.

12:35 justin_smith: milanj: you keep calling interop (inter operation) interopt (inter optimization?)

12:35 mister_zombie: I don't really want to start off building a parsing library, is there any good one out there?

12:35 danneu: what's a nice way to implement (select-keys2 {:a 1, :b 2} [:a :b :c]) -> {:a 1, :b 2, :c nil}

12:35 milanj: I meant inter-op

12:36 danneu: nvm zipmap+juxt comes to mind

12:36 ckirkendall: mister_zombie: enlive has some tools that would make this easy.

12:37 mister_zombie: I tried it but I couldn't get it to work

12:37 I had issues with attributes

12:37 justin_smith: ,(into {} (map (juxt identity {:a 1, :b 2}) [:a :b :c])) ; danneu

12:37 clojurebot: {:a 1, :b 2, :c nil}

12:38 lvh: reiddraper: If (gen/sample my-generator) returns a bunch of duplicates, is that a bug in my generator, or considered OK behavior?

12:38 reiddraper: lvh: totally depends, try (gen/sample my-generator 100) and see if you get more diverse data

12:39 ckirkendall: mister_zombie: can you give me an idea of the type of problem you had.

12:39 lvh: reiddraper: ah; that made me realize the answer actually

12:40 reiddraper: lvh: sampling is also (just like testing) subject to sizing, and the size increases as you ask for more tests, or more samples

12:40 lvh: reiddraper: (basically it's just a fixed url + a fixed pair + an optional pair with only five or so possible values; so as soon as sample *can* ask for more than, oh, 6 types or so, it's going to repeat itself)

12:40 reiddraper: I guess it could be rephrased as: does every generator need to be able to produce arbitrary examples

12:40 gfredericks: reiddraper: I had great success with exponential hops down the shrink tree the other day; such a bizarre tactic though

12:40 lvh: reiddraper: or can it say "these are all the things I have, sorry"

12:41 reiddraper: I guess it's not usually a problem because most real generators, especially composed ones, will be able to produce many more examples than you can ever check

12:41 reiddraper: lvh: test.check doesn't care if there's lots of duplication, but it also doesn't take advantage or do anything smart with that

12:41 lvh: reiddraper: ok, cool, thanks again :)

12:41 reiddraper: gfredericks: hmm, we should talk about that, still thinking next week might be good to meet up?

12:41 gfredericks: I down it's worth considering as an official shrink strategy but it was fun

12:41 oh urm

12:42 reiddraper: maybe next week is bad actually

12:42 anything later is probably fine. also RIGHT NOW would work.

12:43 reiddraper: gfredericks: i'm in my last two days at basho, so now probably isn't good... :) , we'll figure it out

12:49 ckirkendall: mister_zombie: https://gist.github.com/ckirkendall/4fca64e381067f999f35

13:02 mister_zombie: ckirkendall: Oh. That's very cool.

13:06 sritchie: so, with environ and the 12 factor thing of sharing config through environment variables,

13:07 if I’m never supposed to check them into source control, how am I supposed to sync a dev environment between team members?

13:09 technomancy: sritchie: nothing wrong with checking dev default values into source control

13:09 justin_smith: sritchie: relevant page for reference http://12factor.net/config

13:10 technomancy: depends on what you use - I have seen for example the credentials to an internally used mysql server accidentally get open sourced

13:10 technomancy: which config via env would have prevented

13:10 technomancy: justin_smith: developing against a server that isn't on your laptop? =(

13:10 sritchie: justin_smith: so how would you get those credentials to new devs?

13:10 justin_smith: sritchie: a scrit that sets up all the dev time env, that isn't in vc

13:11 sritchie: and just gets emailed around or something?

13:11 I can see putting that in a separate project,

13:11 under VC, which just never gets open sourced -

13:11 seems just as “secure” as any other distribution channel

13:11 justin_smith: technomancy: it's a cms, the designer needs to be able to create asset handles, the frontend needs to be able to create content placeholders, etc. and everyone should have this stuff in sync

13:12 technomancy: acknowledged it is a specific workflow, but this kind of thing is not super uncommon

13:12 sritchie: actually, here’s one config question I had for you guys -

13:12 technomancy: I actually put default settings in the code itself, only because you have to restart the whole JVM to change actual env vars

13:12 sritchie: I’m moving all my config over to the env, but having strict “dev” and “prod” configs isn’t quite working,

13:12 since I might want to run production stripe queries, or send mandrill emails, from my repl

13:13 (but not actually store production DB info locally)

13:13 so that requires switching just one config variable, the stripe key, and nothing else

13:13 one way to do that is to prefix environment variables with “DEV_” or “PROD_”, but that’s pretty busted,

13:14 (and then have a dynamic variable that I can override for specific repl calls)

13:14 or is there some other, cleaner way to accomplish this -

13:14 of maintaining granularity at the repl

13:15 justin_smith: sritchie: how about this for flexibility: the vars come in through the env, that is used to populate system properties (which are all updatable at runtime)

13:15 mi6x3m: Can someone explain:

13:15 ,(var '+)

13:15 clojurebot: #<CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0:0)>

13:16 mi6x3m: a, wait, it's a macro lol

13:16 justin_smith: sritchie: the reason not to put this into system properties directly is the jvm prints out properties at boot, which you probably don't want for credentials

13:16 mi6x3m: ,(var +)

13:16 clojurebot: #'clojure.core/+

13:16 hiredman: mi6x3m: (var ...) is a special form

13:16 sritchie: justin_smith: haha, sure

13:16 Bronsa: mi6x3m: not a macro, a special form

13:16 justin_smith: ,'(var '+)

13:16 clojurebot: (var (quote +))

13:16 sritchie: justin_smith: but then to override, I’d need some way of having the dev AND prod loaded at the same time,

13:16 hiredman: #'+

13:16 mi6x3m: any way to get the var from a symbol?

13:16 sritchie: so that I could switch between them

13:16 justin_smith: that’s what seems to break the 12 factor

13:16 Bronsa: ,(resolve '+)

13:16 clojurebot: #'clojure.core/+

13:17 danneu: (or (:db-uri *env-override*) (:db-uri env) "datomic:mem://localhost:4334/dev")

13:17 hiredman: ,(apropos "var")

13:17 clojurebot: (clojure.core/*allow-unresolved-vars* clojure.core/alter-var-root clojure.core/find-var clojure.core/var-get clojure.core/var-set ...)

13:17 hiredman: etc etc

13:17 justin_smith: sritchie: you would have a function that populates the properties from the env at boot, but you can also update individual keys (since they are in properties) in runtime

13:17 mi6x3m: damn, I totally forgot about resolve although I use it once every mins...

13:17 (inc Bronsa)

13:17 lazybot: ⇒ 59

13:18 sritchie: justin_smith: I just meant as far as naming conventions. Since, to override, I’d need access to the prod variable as well

13:18 justin_smith: I know I can make it work, I have been, it just requires a bunch of switches,

13:18 or embedding the environment mode in the variable name

13:18 justin_smith: yeah

13:19 I wonder if this could be addressed with some usage of environ + component?"

13:19 s/"//

13:20 danneu: yeah, components could init with an optional config map that's merged into environ.core/env

13:21 technomancy: sritchie: consider carica too; IMO the env var stuff falls over for more complicated use cases, especially when you want nested data.

13:23 TimMc: I generally store my entire program as an environment variable.

13:24 sritchie: TimMc: :)

13:24 technomancy: nice, looking

13:24 TimMc: Unfortunately, they're trying to "patch" the "bug" I've been using to do that.

13:26 sritchie: technomancy: looks like carica wants you to check the entire config into source, yeah?

13:29 technomancy: sritchie: no, it's designed to have prod config overlaid at deploy time

13:30 martinklepsch: when using pipeline-async I wouldn't be able to pipe intermediate into the to-chan right? (lets say the progress of a file being uploaded)

13:33 mi6x3m: has anyone here used a plugin to copy files with leiningen?

13:33 like for resources

13:34 danneu: gulp.js ;)

13:40 sritchie: technomancy: so, with heroku, I’d still need a deploy tool to transfer the carica config file over, yeah?

13:40 technomancy: I’m currently on dokku and using environ, which works well there -

13:40 technomancy: sritchie: oh yeah, carica isn't really heroku-friendly

13:43 sritchie: technomancy: figaro has a script that dumps all variables to heroku - that would probably solve it for carica

13:43 have some way to read from the env as well, with some convention for the nesting,

13:43 then inject all variables into heroku’s env

13:43 technomancy: sritchie: you kinda lose the advantages of carica though

13:44 supporting non-string types, etc

13:44 sritchie: sure

13:58 verma: in clojurescript how do I check if a certain object is a native javascript arraybuffer type, or in other words can reliably check types of native JS types? js/Array js/ArrayBuffer js/Float32Array etc.

14:01 in cljs repl (type "hello") gives me #<function String() { [native code] }>

14:01 eriktjacobsen: I’m using clojure.java.jdbc 0.3.4… even in the simplest test case of a primary key select on a table with 4 rows, i’m seeing queries take 900ms-1200ms where they are 100ms on the mysql commandline client. Same client, same host, same query. Brief internet search doesn’t show any outstanding known performance issues… any ideas to debug ?

14:02 justin_smith: eriktjacobsen: just a shot in the dark, try using a connection pool?

14:03 but that is a huge overhead, and just creating a connection would not explaian a delay like that

14:04 eriktjacobsen: justin_smith: thanks looking into c3p0 now

14:06 noonian: verma: you can probably do (= (array) js/Array)

14:06 verma: i mean (= (type (array)) js/Array)

14:09 xeqi: is there a core.logic relation to say something is a symbol?

14:09 verma: noonian, checking

14:10 nice, that works, that check is a function against functin check :)

14:10 noonian: yep :)

14:10 verma: (type (array)) returns a function like object

14:10 :P

14:10 (inc noonian)

14:10 lazybot: ⇒ 6

14:10 noonian: yeah, just typing Array in a js console returns the same thing pretty much

14:11 verma: oh yes, true

14:11 noonian: because in js the constructor function *is* the type

14:12 verma: this is however, far better type checking compared to what native js offers

14:15 eriktjacobsen: justin_smith: hmm the current c3p0 seems broken… as soon as I add [jdbc.pool.c3p0 :as pool] to require, it causes java.jdbc to break “Could not locate jdbc/core__init.class”

14:15 doctorm: Can any vim-fireplace users tell me what :Require is supposed to do? I was thinking you could use it to eval a namespace in your repl, but all it does for me is pitch an error.

14:15 mister_zombie: How would I go around packing my compojure app as a standalone jar I can run?

14:16 justin_smith: eriktjacobsen: hmm - you may need to exclude its version, or it may be developed against an archaic version of jdbc

14:17 mister_zombie: I put a "main" setting in my project.clj, pointing to the correct namespace, but I don't know what to do after that.

14:17 eriktjacobsen: I think its just out of date… deps tree doesn’t show it trying to include jdbc: “ [clojure.jdbc/clojure.jdbc-c3p0 "0.3.0"]

14:17 [com.mchange/c3p0 "0.9.5-pre8"]

14:17 [com.mchange/mchange-commons-java "0.2.7"]

14:17

14:18 noonian: mister_zombie: just run 'lein uberjar' from the project directory; you will need a -main fn defined for the entry point

14:18 mister_zombie: noonian: What do I put in the main?

14:18 noonian: mister_zombie: it will create a verbosely named jar in target

14:19 mister_zombie: in project.clj under :main put a symbol telling it what namespace your -main function is in

14:19 and in that namespace have a (defn -main [& args] (println "hello world"))

14:23 kjellski: just starting out with clojure, wasn't there a syntax element that lets you specify the var and functions to apply to it all after each other? and you don't need to repeat the var all the time?

14:23 justin_smith: eriktjacobsen: to back up and take a different tack for a moment: you could profile (the jdk comes with jvisualvm for example) and figure out what the app is trying to do when those delays happen

14:23 eriktjacobsen: or maybe even jstack (command line utility, shows all stack traces of all threads)

14:24 eriktjacobsen: kjellski: You can pipeline stuff such as (-> data fn1 fn2 fn3 fn4)

14:24 kjellski: eriktjacobsen, agh, I'll fiddle with that one in the repl :) is it a macro?

14:25 noonian: kjellski: if you want to do things to the return values you can use '->' for java object interop (like using a bunch of setters) you can use (doto (MyObj.) (setSomething "bar") (setSomethingElse "baz"))

14:25 justin_smith: kjellski: if you repeated the var you would not get stacked results - do you want a sequence of stacked effects, or parallel operations on the original?

14:25 noonian: kjellski: yeah its a macro

14:25 ,(macroexpand-1 '(-> {:foo 17} (assoc :bar "bar") println))

14:25 clojurebot: (println (assoc {:foo 17} :bar "bar"))

14:25 mikerod: I'm a bit saddened that http://dev.clojure.org/jira/browse/CLJ-1224 is not making it into clj 1.7

14:26 kjellski: noonian, ah, I needed this for javascript interop, that might help to set some stuff on easeljs shapes, thanks!

14:26 mikerod: I can't wait until records can make efficient keys in maps

14:26 noonian: kjellski: yeah, np

14:26 kjellski: I think doto is what I needed :) thanks @all!

14:26 puredanger: mikerod: I'll take the hit on that one, sorry (just didn't get to screening it)

14:27 mikerod: puredanger: I forgive you. hah :-P - It's ok. Transducers sooner than later is a Good Thing.

14:30 mister_zombie: I get this when I try to compile or run now : Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V, compiling:(ring/middleware/params.clj:1:1)

14:31 kjellski: noonian, much cleaner, thanks :)

14:32 mister_zombie: Project file: http://pastie.org/9635118 code file: http://pastie.org/9635122

14:38 nkozo: core.async question: I have a go-loop receiving data from a chan, it must be sure the data is not mutated after is sent to his chan, there is a way to make the chan execute a transformation function (to clone the data) everytime an element is put into it, but synchronously? I mean, when (>! c v) returns is assured v is already transformed to v2, and the go-loop only sees v2 values

14:42 weavejester: nkozo: You’re sending mutable data through a channel?

14:42 nkozo: weavejester: is a compromise

14:43 weavejester: nkozo: What’s the situation?

14:43 nkozo: i want to keep a client api simple, so they can send bytebuffer's over the chan without doing anything special

14:44 never used chan transducers / pipelines, so I'm not sure this is possible

14:45 weavejester: Why would the client want to send bytebuffers over a channel?

14:46 nkozo: to compose network packets

14:47 weavejester: Okay, so the client is sending a byte buffer to a channel, which is then being delivered to a socket or somesuch?

14:47 nkozo: yep

14:47 weavejester: What’s the purpose of using a channel?

14:47 nkozo: asynchronicity

14:47 and homogeneous api

14:48 i know there are other alternatives, I want to know if this specific one is possible :)

14:48 weavejester: Why a bytebuffer over something like an array?

14:49 So you want a channel that clones the data coming in to ensure immutability?

14:49 nkozo: arrays are mutable also, same problem

14:49 weavejester: exactly

14:50 weavejester: executes a function when a value is put in him and uses the return value as the new one

14:50 weavejester: Is cloning a bytebuffer each time more efficient than just using a vector?

14:50 nkozo: suposse yes :)

14:51 weavejester: Okay, I’ll suppose you’ve benchmarked it

14:51 You could use clojure.core.async/map> I believe to apply a function to the input before putting it on the channel

14:52 nkozo: no, I'm doing only a thinking exercise, also to learn the core.async api

14:52 Bronsa: weavejester: well each assoc/dissoc on a vector you're always cloning at least one array

14:52 clojurebot: Excuse me?

14:52 Bronsa: err, conj

14:52 weavejester: Bronsa: Yeah, but the arrays are a fixed and relatively small size.

14:53 Bronsa: right

14:53 weavejester: Bronsa: Cloning a byte buffer n times is likely to be less efficient, I suspect, than putting the byte buffer into a vector once.

14:54 But for a hypothetical exercise, I guess that doesn’t matter

14:54 Bronsa: weavejester: yeah, depends on the size

14:56 weavejester: Does anyone happen to have any suggestions for what to name a function that takes in a configuration and spits out a handler?

14:56 I was thinking “endpoint”, but that might be a little overloaded

14:56 justin_smith: endpointFactory

14:56 (not really)

14:56 kjellski: is there something like a step function that creates a lazy seq of numbers as is defined by the gap between the numbers?

14:57 llasram: ,(range 1 10 2)

14:57 clojurebot: (1 3 5 7 9)

14:57 mister_zombie: Would any of you mind telling me what I'm doing wrong? "lein run" fails, and so does "lein uberjar" — Project file: http://pastie.org/9635118 code file: http://pastie.org/9635122

14:57 kjellski: llasram, thanks! :) I only tried the second argument!

14:57 nkozo: the general problem is how to put a mutable value1 to a chan and making the chan executing automatically a function that extracts an immutable value2 from value1, sends value2 to the chan reader and makes (>! c value1) return after value2 was extracted (so value1 can be safely mutated)

14:58 danneu: mister_zombie: what's the err

14:58 weavejester: mister_zombie: You’ve specified your main function as a handler function.

14:59 danneu: yeah, your root handler is millepattes.handler/app

14:59 your -main fn is a fn that boots the server

15:00 weavejester: You also have (use ‘ring.adapter.jetty) sitting at the top level for some reason

15:01 But then refer to jetty/run-jetty down at the bottom

15:01 noonian: :ring {:handler millepattes.handler/-main} should be millepattes.handler/-main instead

15:01 er millepattes.handler/app instead

15:12 mister_zombie: So I corrected the thing for :ring, how do I make my -main okay?

15:12 weavejester: mister_zombie: You have a bad ‘use’ statement at the top you need to fix.

15:13 You want to remove it, and add: [ring.adapter.jetty :as jetty] to your requires

15:17 noonian: mister_zombie: yeah, your -main function looks ok to me, you just need to fix the other little things that are throwing errors when the namespace gets loaded

15:18 mister_zombie: I get this now: Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V, compiling:(ring/util/servlet.clj:1:1)

15:19 weavejester: mister_zombie: Oh, you have an ancient ring-jetty dependency in your project file for some reason

15:19 mister_zombie: Update it to 1.3.1

15:20 verma: man I can never get vim-fireplace + piggieback to work correctly, it was working fine, and now its totally stopped working, no matter what I do, it never starts

15:20 weavejester: mister_zombie: It’s worth noting that with lein-ring you don’t need a -main function, since lein ring server / lein ring uberjar cover its usecases

15:21 mister_zombie: weavejester: Really? lein ring uberjar was all I needed? XD

15:22 weavejester: mister_zombie: Yes, so “lein ring server” will start up a dev server, and “lein ring uberjar” will create an uberjar with an automatic main function

15:24 verma: anyone here use vim-fireplace + piggieback?

15:28 mister_zombie: Thank you all, much appreciated

15:32 Say I want to deploy to an application container, would the uberjar do just fine?

15:33 kjellski: Is there an easier way to create this squence of vectory then this?

15:33 ,(map vec (partition 2 (interleave (range 0 1000 100) (range 0 1000 100))))

15:33 clojurebot: ([0 0] [100 100] [200 200] [300 300] [400 400] ...)

15:35 TimMc: ,(map (fn [x] [x x]) (range 0 1000 100)))

15:35 clojurebot: ([0 0] [100 100] [200 200] [300 300] [400 400] ...)

15:35 TimMc: kjellski: ^

15:36 kjellski: TimMc, :D thanks, now I feel like I haven't seen the obvious solution...

15:40 weavejester: mister_zombie: The uberjar is for standalone apps, but there’s an uberwar option (lein ring uberwar) for deploying to servlet containers

15:41 doctorm_: verma: I got disconnected, did you get an answer to your Piggieback question?

15:41 mister_zombie: weavejester: Awesome

15:44 aztak: good evening!

15:44 mmg: is there a way to see jvm parameters in the clojure rpl? specifically -Xmx ?

15:45 dbasch: ,(System/getenv)

15:45 clojurebot: #<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.*)>

15:45 dbasch: mmg try that

15:45 amalloy: dbasch: that's not and environment var

15:45 aztak: mmg: I think you need to hit the JMX subsystem to get info about -Xmx params

15:45 dbasch: depending on how you ran the jvm I guess

15:45 aztak: (Runtime/getRuntime et. al)

15:47 dbasch: (.totalMemory (Runtime/getRuntime))

15:47 amalloy: i don't think that actually works, does it?

15:48 if your heap hasn't grown to use up all the space allocated yet, then .totalMemory only returns the heap size

15:48 aztak: mmg: http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html or if you need more info: http://docs.oracle.com/javase/7/docs/api/index.html?javax/management/remote/JMXConnectorServerMBean.html

15:48 amalloy: that is, it returns the current heap size, not the max heap size

15:49 mmg: thanks!

15:49 mi6x3m: does anyone have some experience with lein-resource?

15:49 amalloy: man, it is really hard to find the right words to distinguish between "size of heap" and "size of objects allocated on heap"

15:50 aztak: amalloy: used/committed/max ? :)

15:50 amalloy: excellent, well done

15:52 dbasch: actually why do you need to know Xmx from a repl? Did someone else run the repl?

15:52 otherwise it’s whatever you told it

15:55 amalloy: dbasch: like an episode of the price is right? "we started this clojure repl...now guess how much ram it has!"

15:55 mi6x3m: is there any piece of code to edit leiningen structures

15:55 like removing a dependency

15:58 dbasch: amalloy: am I allowed to do stuff inside the repl before guessing? That may be fun

15:59 amalloy: you can do whatever you want, we're not really on tv

16:08 noonian: i'd watch that tv show if it existed

16:11 verma: doctorm_, no :(

16:11 doctorm_: verma: What are you trying to use it with? I’ve got it to work with weasel successfully

16:12 verma: doctorm_, I just have a cljs project, which I connect over the default austin repl (rhino) and its been sort of unpredictable

16:12 it works sometimes and everything is great, but then just totally stops

16:12 doctorm_, I've been hearing about weasel, let me check that

16:13 doctorm_: verma: Give it a shot, I haven’t tried austin, because I heard about similar things happening

16:13 verma: doctorm_, I would hope that its austin specific stuff that's not working, and piggieback is doing its job fine :)

16:14 doctorm_: verma: Cool, ping me if you run into trouble connecting to weasel

16:14 verma: doctorm_, sure thing, thanks!

16:17 amalloy: huh. i just got a stack overflow from running `lein deps :tree`

16:17 technomancy: amalloy: 2.5.0 or older?

16:17 amalloy: oh, for sure. 2.3.4, apparently

16:19 technomancy: should be fixed, yeah

16:19 amalloy: what was the issue?

16:19 technomancy: dunno; xeqi fixed it iirc

16:20 TimMc: technomancy has people for that kind of thing

16:22 * technomancy makes bumper stickers saying "I outsource my software development. And I vote."

16:24 m1dnight: Is there a cleaner way to check "(or (= x y) (= x z))"?

16:24 technomancy: (#{y z} x)

16:25 m1dnight: hah! I knew it! :) Thank you

16:27 amalloy: unless one of y or z is false or nil

16:27 m1dnight: nope, checking if a keyevent is either one or the other

16:27 justin_smith: (contains? #{x y} z)

16:28 m1dnight: I'm jealous of the people who write proper functional code

16:29 I try,but I don't always manage. Kinda stuck in OO coding.

16:31 dbasch: m1dnight: your or statement is perfectly functional

16:32 I see nothing unclean with it btw

16:32 m1dnight: well, yes it is. But byfunctional I mean the dense functional code that you can never get in OO or other languages

16:32 An experienced functional programmer writes way more elegant FP code than somebody like me

16:32 And I envy that :p

16:35 ustunozgur: a bit off-topic but , is anyone aware of any articles that compares functional programming and frequency domain representation of signals?

16:35 as in oop vs functional ~ time domain vs freq domain

16:35 justin_smith: ustunozgur: I found a great paper applying information theory to code reading / bug detection

16:37 ustunozgur: justin_smith: which one is it?

16:39 justin_smith: ustunozgur: http://macbeth.cs.ucdavis.edu/natural.pdf

16:40 ustunozgur: Thank you.

16:42 Richard Hamming also had some thought on the matter in his Art of Science and Eng book. A quote: "Until we better understand languages of communication involving humans as they are (or can be easily trained) then it is unlikely many of our software problems will vanish."

16:43 it's chapter 4 for the curious worrydream.com/refs/Hamming-TheArtOfDoingScienceAndEngineering.pdf

17:01 _pr0t0type_: Hey guys, is there a gdb/pdb for lein projects I can to set break points?

17:01 I want to be able to halt the application at some line and inspect stuff

17:07 ustunozgur: _pr0t0type_: http://www.reddit.com/r/Clojure/comments/28udm4/does_clojure_have_a_breakpoint_capable_debugger/

17:08 verma: doctorm_, even the regular non-weasel stuff is failing the same way, e.g. (cemerick.austin.repls/exec)

17:10 doctorm_, and (cemerick.piggieback/cljs-repl) never returns the prompt back :(

17:10 going on a killall frenzy

17:11 technomancy: _pr0t0type_: breakpoints are easy as long as you don't need stepping

17:11 verma: ok, I had a ton of zombie repls running, checking again

17:12 ok, got a prompt this time :)

17:19 seangrove: Wow, madness http://1010.co.uk/gneve.html

17:20 amalloy: seangrove: if you can't do it in emacs, it's not worth doing, after all

17:22 40,000 lines of warnings from `lein deps :tree` about conflicting dependency versions. kill me now

17:22 mgaare: seangrove: I must use this

17:23 jeremyheiler: amalloy: i'l rm -rf your code base if you'll rm -rf mine

17:25 verma: ok, I am done with this shit man :( .. what's a good starting point into trying emacs with clojure?

17:25 I am going to use it with evil mode of course :P

17:26 jeremyheiler: verma: i switched cold turkey from vim

17:26 i felt like evil-mode would've just gotten in the way of properly learning emacs

17:27 verma: I don't want to really learn emacs :( .. I just want a good dev env for clojure, and vim + fireplace is failing me right now :(

17:27 noonian: verma: clojure for the brave and true has a good walkthrough for getting emacs setup nicely with clojure: http://www.braveclojure.com/

17:27 jeremyheiler: verma: have you tried intellij with cursive?

17:27 technomancy: verma: the one at clojure-docs.org is good too

17:27 http://clojure-doc.org/articles/tutorials/emacs.html

17:28 mgaare: verma: emacs prelude is not a bad starting point either

17:28 technomancy: cider's super unstable ATM though

17:28 eriktjacobsen: I just use Vim and a repl in another window… honestly I dont think you need fireplace or any workins

17:28 WildBamboo-Josh: Just be aware that if you go down the Cider route in Emacs, I think it's advisable to stick to the stable 0.7 version. 0.8 is a big rewrite and quite unstable at the mo

17:28 noonian: yeah, even with emacs i use lein repl most of the time

17:28 technomancy: even 0.7 isn't that stable

17:28 WildBamboo-Josh: oh ok, lol

17:29 jeremyheiler: i thought 0.7 was a big rewrite..

17:29 verma: eriktjacobsen, its nice to be able to send stuff to repl sometimes I guess, do you have a workflow for that?

17:30 technomancy, noonian WildBamboo-Josh so emacs + cider 0.7 is the recommended way right now?

17:30 brehaut: just use melpha, then nothing will be stable, and cider will seem like a rock

17:30 eriktjacobsen: I generally have a split off on the side with repl-friendly macro-expanded or variable-injected values ready to copy / paste

17:30 technomancy: verma: I would stick with 0.6 or nrepl.el

17:30 eriktjacobsen: Just a scratch buffer that never gets saved, just for common queries and expanded things

17:32 WildBamboo-Josh: brehaut: lol

17:33 amalloy: eriktjacobsen: that sounds unbearable

17:33 verma: eriktjacobsen, you copy and paste stuff?

17:34 eriktjacobsen: yup, two windows vertically split or on separate monitors, and 3 key strokes (copy,switch,paste)

17:34 never bothered me and works fine over ssh

17:35 technomancy: oh good; the clojure-doc.org article no longer recommends ESK

17:35 mgaare: for what it's worth, I run cider 0.8 and haven't really had problems

17:36 dbasch: verma: I downgraded from 0.7 to 0.6 a while back

17:36 0.7 did not like something about my setup

17:36 technomancy: the simplest thing is just to use nrepl.el; it's still on marmalade

17:37 brianwong: hello, i am trying to catch a java.io.FileNotFoundException around 'with-open'

17:37 verma: technomancy, is it awesome?

17:37 technomancy: verma: it's ... fine?

17:37 brianwong: the problem is, the file never closes when i catch this exception

17:37 technomancy: I haven't been keeping up with the fancy new features

17:37 but it's enough for me

17:37 brianwong: is there a common idiom for this problem?

17:38 brehaut: technomancy: time to implement nrepl directly in atreus

17:38 brianwong: https://www.refheap.com/91498

17:38 so when a filepath is given that doesnt exist, the exception is caught, but the file isnt closed, so the program gets stuck

17:39 mdrogalis: brianwong: I think with-open closes it in a finally block, no?

17:39 brianwong: i thought that was built into the macro as well

17:40 that is why im a bit confused

17:40 dbasch: brianwong: if the path doesn’t exist, there is no file to close

17:40 what do you mean the file isn’t closed?

17:40 mdrogalis: Seems to be https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L3512

17:40 Yeah, heh. That's a good point, dbasch.

17:41 brianwong: dbasch, that is a good point. my command-line tool hangs with this try/catch

17:41 if i remove the try catch, the exception just propagates as expected

17:42 maybe it is somewhere else in my prgram that doesnt handle the return value well

17:42 ill do more research

17:42 dbasch: brianwong: check that the file exists before calling with-open

17:42 or don’t use with-open, and do your own try/catch

17:42 verma: man, I was in the middle of this awesome clojure flow, and now all this env issues :(

17:44 brianwong: thanks for the advic

17:44 advice

18:07 m1dnight: If I want to use trace in a simple lein repl, where would I put the dependency?

18:07 I.e., not in a project workspace

18:09 jeremyheiler: m1dnight: the :dev profile in ~/.lein/profiles.clj, I think

18:10 technomancy: jeremyheiler: user profile actually

18:10 m1dnight: jeremyheiler: That worked!

18:10 Didn't know about that file :x

18:12 jeremyheiler: technomancy: what differentiates user from dev?

18:12 technomancy: jeremyheiler: :dev is for per-project stuff

18:12 jeremyheiler: gotcha

18:17 _pr0t0type_: clojure.data.json (json/read-str) returns a hashmap with strings as keys. Does anyone know how to make that return keywords instead during deserialization? ie from {"data" []} to —> {:data []}

18:18 mister_zombie: How do I pull my namespace in the lein repl?

18:18 AeroNotix: _pr0t0type_: if you pass :key-fn you can run arbitrary stuff on the key of the JSON

18:18 m1dnight: (ns ..) ?

18:18 that should work..

18:18 AeroNotix: so you could pass the function keyword

18:19 m1dnight: Or do you mean (use 'name.space) ?

18:19 mister_zombie: I have my stuff in some namespace, i'm in the root of the project (with the project.clj file), I want to toy with some functions in my namespace

18:20 AeroNotix: mister_zombie: is the namespace a part of the project where project.clj is

18:20 SegFaultAX: mister_zombie: You can just require/use it as normal.

18:20 mister_zombie: yes

18:21 AeroNotix: mister_zombie: lein repl will pull it in by default

18:21 SegFaultAX: mister_zombie: You can also use in-ns to operate in the context of that ns.

18:21 _pr0t0type_: AeroNotix: pass in? Can you elaborate a bit on that?

18:21 AeroNotix: _pr0t0type_: such as (json/read-str some-str :key-fn keyword)

18:22 and it'll apply the function `keyword` to all keys in the JSON objec

18:22 mister_zombie: Thanks!

18:22 AeroNotix: object*

18:22 mister_zombie: Sweet!

18:23 _pr0t0type_: AeroNotix: awesome, thanks dude!

18:23 SegFaultAX: mister_zombie: This is the de facto blog post on Clojure namespaces (including refer/use/require/import)

18:23 http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html

18:23 AeroNotix: _pr0t0type_: nw friend

18:23 mister_zombie: Thanks!

18:24 AeroNotix: I want to draw bar charts from clojure -- any good/cool libraries?

18:24 amalloy: AeroNotix: 4clojure uses incanter

18:25 AeroNotix: amalloy: wow ok, that looks good

18:26 dbasch: _pr0t0type_: with cheshire you can do (parse-string str true) and it gives you keywords for keys

18:41 doctorm: verma: Sorry, just got back. I can walk you through the way I set up weasel if you haven’t already mastered emacs. I’ll do a little write up and post it, although it is mostly documented on the github page.

18:44 verma: doctorm, thanks! I am just looking at emacs right now, didn't really start anything yet, setting up evil mode right now.

18:44 doctorm, I am having trouble with all repls basically

18:45 not sure what to do

18:45 I can launch them from the command line lein repl .. and use the

18:45 m

18:45 but only to a certain degree though, that stops working after a while too

18:46 doctorm: verma: Yeah, it’s something I’m struggling with too. I’m in the process of moving to LightTable (just getting vimlike modal editing figured out there). vim-fireplace is good, but not quite good enough (mainly stack traces don’t seem to show in the repl, ever)

18:46 verma: if you're writing a doc, you'd be doing a huge flavour to vim people wanting to use it for clojure dev, all resources are scattered around, and the docs mostly don't tell you exactly what to do, and I am too lazy to read so much stuff

18:47 doctorm: But I’ll still do a writeup with weasel, because that is something I got figured out, and I didn’t experience it breaking like you described

18:49 verma: lol, s/flavour/favor/g

18:55 justin_smith: doctorm: stack traces may be suppressed there by default, there is always (clojure.repl/pst) which will show the most recent stack trace

18:55 or, more accurately, I should say, shows the stack trace for the most recent exception

18:57 doctorm: justin_smith: Thanks, I’ll check that out. It’s not the only reason for moving to LightTable, I also like the idea of using an editor whose architecture I can understand and is written in the language I’m using.

18:59 eriktjacobsen: justin_smith: earlier you recommended jvisualvm…. any guides you’d recommend. I’m used to gdb / valgrind in c. Don’t see a call tree, and it seems so much time is spent in clojure.tools.nrepl.transport and various core stuff its hard to decompress

19:01 justin_smith: eriktjacobsen: if you want something like gdb, there is jdb

19:01 and as I mentioned, jstack will show a stack trace of every thread

19:04 eriktjacobsen: also, specifically in jvisualvm, the CPU profiler/cpu panel and the threads view may help you figure out what's happening with those long running jdbc queries

19:12 lodin: Is there any way to unload a class (created with deftype)? This is for auto reloading purposes.

19:13 justin_smith: eriktjacobsen: for example here is me profiling a call to jdbc: http://i.imgur.com/RJTZh2R.png notice the cpu time is in jdbc$get_connection and jdbc.util.ReadAheadInputStream.fill

19:13 amalloy: lodin: if there are outstanding references to instances of that class you can't unload it, and if there aren't you don't need to

19:14 probably. i guess maybe that last bit isn't true?

19:14 tldr i don't actually know much about classloaders

19:15 lodin: amalloy: If I reload a file and the deftype has been removed, I can still reference it.

19:15 eriktjacobsen: justin_smith: hmm first time using jvisualvm, what are you using for settings in “start profiling from” and profile / dont profile? Im not seeing any jdbc entries when profiling the jdbc code. looking up the jvisualvm docs now

19:15 justin_smith: eriktjacobsen: all I did was double click on the process on the left pane, and go to the profiler pane, then click on "CPU"

19:16 lodin: amalloy: And that's a problem, because next time I run it it will fail.

19:16 justin_smith: eriktjacobsen: it should all be evident from my screenshot

19:16 lodin: amalloy: I tried pretty hard to get rid of references, even remove-ns, but that didn't help.

19:16 justin_smith: eriktjacobsen: I never got an option of where to profile from, I just clicked on the CPU button, then ran my query, and watched those red bars move

19:17 amalloy: lodin: yeah, indeed. i don't really know of a way to unload classes

19:17 lodin: I also found that doing the deftype repeatedly, overwriting the class with an identical class, leaks memory.

19:18 justin_smith: http://stackoverflow.com/questions/148681/unloading-classes-in-java this makes me think class unloading is incompatibe with how clojure does things

19:18 the claim is that the only way to unload a class is to garbage collect the classloader that brought it in, clojure just uses one classloader

19:19 amalloy: justin_smith: the first part of that is true, pretty sure the second isn't

19:19 justin_smith: or is it possible to specify a custom classloader in clj such that it can later be unloaded?

19:19 eriktjacobsen: justin_smith: gotcha. with default settings i’m not seeing anything but clojure internals: http://imgur.com/R2VJMj6

19:20 will dig

19:20 justin_smith: for doall to be doing that much, makes it sound like an expensive or very large lazy seq is being forced?

19:21 but the fact that no jdbc classes show up there at all is suspicious

19:22 amalloy: justin_smith: i think clojure makes a new DynamicClassLoader per eval request and daisy-chains them together, but it's probably more complex than that

19:22 dbasch: I wonder if all this is still accurate http://stackoverflow.com/a/7473707/586880

19:22 eriktjacobsen: the internals of all those calls are the same. lots of clojure.core and clojure.lang, nothing from my own libraries or jdbc

19:23 justin_smith: eriktjacobsen: yeah, it makes me think something else that did not get captured is realizing something very large and / or very expensive

19:23 eriktjacobsen: it may be informative to look at the threads view and see which threads are working - many of them have informative names

19:24 eriktjacobsen: also, some jstack calls from the command line while a query is running should show where each thread is - the stack trace should reveal who is spending all this CPU time on a doall

19:37 eriktjacobsen: Thank you a bunch for the info

19:37 lodin: justin_smith, amalloy: So the conclusion is that no, it's not currently possible and probably won't be a for a while?

19:37 amalloy: i believe so

19:40 doctorm: verma: https://www.refheap.com/91502

19:40 verma: While testing it, I ran into a bunch of different problems depending on the order I did certain things

19:42 verma: So try it out in that order, and see if you have any more luck. I’ll be away for a bit, but back later tonight. Let me know if it works

19:44 xeqi: amalloy: I believe it was a space leak from lazyness, though when I fixed that I redid most of the pedantic code and changed some algorithms

19:44 amalloy: xeqi: yeah, that sounds consistent

19:46 TimMc: Next week I'll be working on a wrapper for liverepl that will provide line-editing, injection of dependencies (w/ pomegranate), and limited classloader leakage

19:46 Wish me luck.

19:46 lodin: Is it worth submitting a bug report about (do (deftype Foo []) (deftype Foo [])) leaks memory? I.e., the shadowed class is not GCed.

19:48 brehaut: lodin: hmm, i am super vague on the details, but i think classes are stored in the permgen, so theres no way to free them until the next vesion of java that ditches permgen is available

19:50 java 8 is the version that ditches permgen

19:50 * lodin googles permgen.

19:51 TimMc: The permanent generation in Java's generational GC.

19:51 brehaut: lodin: google JEP 122 as well

19:51 which is to say, the generation that is not collected (because its permenant)

19:52 Jaood: who needs clojure when you have java 8?

19:53 hiredman: lodin: how sure are you it leaks memory?

19:54 Jaood: tough crowd

19:54 brehaut: Jaood: you get more laughs with funny jokes ;)

19:54 Jaood: ;)

19:54 hiredman: http://dev.clojure.org/jira/browse/CLJ-1152 mentions some java command line flags to turning on logging of classloading/unloading

19:55 lodin: hired: I wouldn't put a number on it. :-) But it seemed to me, looking at the memory used by the java process, that it leaked.

19:55 brehaut: lodin: a lot of non-reference count based collectors collect at non-deterministic times.

19:56 hiredman: lodin: how comfortable are you monitoring the memory usage of a java process?

19:56 it is a known stumbling point

19:56 brehaut: lodin: dead objects arent collected until there is a reason to do so (ie, memory pressure requires more free space)

19:56 hiredman: most jvms also don't return memory to the os, even if it is "free"

19:57 they hang on to it incase they need it later

19:57 lodin: Yeah I know, but I figured based on the previous discussion that the observation agreed with leakage.

19:57 Jaood: greedy jvm

19:58 lodin: So let's take a step back. :-)

19:58 hiredman: I think the gc behaviour of classes was a little more subtle then just "the never get gc'ed" even before java 8

19:58 lodin: It looks like deftype leaks memory. Does it?

19:59 hiredman: lodin: it may, or may not, I dunno, you haven't presented evidence either way

20:00 lodin: hiredman: I'm asking for evidence. :-)

20:00 devn: hiredman: im cribbing most of what you did on your branch to pull it into weavejester/lein-ring, but i got stuck... https://github.com/weavejester/lein-ring/pull/130

20:01 would be curious to know if you have any ideas

20:01 mthvedt: new classes do not leak memory, they get garbage collected when the class is no longer referenced

20:01 same with deftype

20:01 hiredman: deftype in itself cannot leak memory

20:01 mthvedt: although in clojure you must explicitly remove the namespace

20:02 if your deftype is in one

20:02 lodin: mthvedt: Could you elaborate on that?

20:02 hiredman: but it generates a java class, and if the java runtime you are using (there are several) doesn't reclaim classes that could happen

20:02 johann: hey guys, i'm trying to write some images online to disk. i just tried using pmap and agents to make it concurrent. the images on disk aren't filling out to the full dimensions for reasons beyond me. anyone know what may cause this?

20:03 mthvedt: hiredman: ok, the recent sun/oracle JVMs garbage collect classes.

20:03 hiredman: the ability to redef a deftype like you did using do depends on clojure's DynamicClassloader, which does keep a reference to classes in a map in a static field, but it only keeps the last class with a given name

20:03 lodin: hiredman: I did another test, and it does look like it just releases the classes later rather than sooner.

20:04 at least on this machine.

20:04 mthvedt: lodin: a class is no longer referenced in java when its objects, class objects, classloader, and “sibling” classes from the same classloader are all out of scope.

20:04 …if i remember right.

20:05 TimMc: clazz.parentNode.nextSibling

20:05 oh wait, this isn't the DOM

20:05 mthvedt: in clojure you can achieve the class/classloader conditions by unmapping the ns, which i’ve actually done successfully in experiments

20:06 with generating arbitrary numbers of deftypes

20:09 amalloy: brehaut: hasn't every version since like java 5 been the one that ditches permgen?

20:09 it's not actually a "java" thing so much as a detail of various jvms, not necessarily all of them, anyway

20:10 lodin: mthvedt: I'm not sure I follow. How did you unmap the ns? remove-ns?

20:11 mthvedt: lodin: yes iirc

20:15 devn: hiredman: with your version of lein-ring, do you specify servlet-class and servlet-name, or is that not necessary? do you specify init and handler like you normally would?

20:25 lodin: mthvedt: I tried http://pastebin.com/1hiLyWpJ . What am I missing?

20:34 mthvedt: lodin: not sure tbh, been a while since i messed around with that. it looks like that shouldn’t happen though.

20:38 squeedee: Hey folks. Whats the general concensus on name collisions with core? Like i felt that 'lsystem.iterate' was a great function name...

20:40 justin_smith: squeedee: :refer-clojure in your ns block

20:41 lodin: hiredmen: Can I call that a bug at least? ;-) (Seriously though, any insights into why it works like that would really be appreciated.)

20:41 *hiredman

20:42 squeedee: justin so the idiom is to name things as they should be. Consumers just need to exclude?

20:42 justin_smith: why exclude? :use is bad anyway

20:42 brehaut: amalloy: i think with java 8 you can actually download an oracle jvm that implements it

20:43 amalloy: perhaps as part of something called meatspace (if my rememberng is correct)

20:43 (its probably not correct, that sounds nuts)

20:43 amalloy: not sure if serious...

20:43 metaspaace

20:43 squeedee: well i guess i should try it, but i thought you mean refer-clojure :exclude iterate

20:43 meant*

20:43 hiredman: lodin: what are you trying to do?

20:44 justin_smith: squeedee: oh yeah, I thought you meant consumers of your lib

20:44 brehaut: amalloy: that sounds a lot more sane than my recollecting and would make more sense

20:44 lodin: hiredman: http://pastebin.com/1hiLyWpJ

20:44 justin_smith: squeedee: yeah, use :exclude in :refer-clojure, name things the name that makes sense

20:44 lodin: hiredman: I want to get rid of the class.

20:44 hiredman: lodin: you can't

20:45 squeedee: justin_smith thanks :D

20:45 lodin: mthvedt, hiredman: I'm getting different bets here ...

20:45 amalloy: huh, interesting. i got pull requests to flatland/useful this morning. i thought forks couldn't get pulls

20:45 hiredman: lodin: I have mthvedt on ignore, so I have no idea what he is saying

20:46 lodin: but if he told you unmapping the namespace would do anything there he is very mistaken

20:47 squeedee: amalloy on github?

20:48 mthvedt: i don’t understand the passive-aggression

20:48 amalloy: squeedee: yes

20:48 squeedee: amalloy: anything can get pulls

20:48 you can make a pr to a branch

20:49 dbasch: permgem was indeed removed in java 8, TIL

20:49 squeedee: if its public, it can be done. fork or no fork

20:49 dbasch: PermGen

20:50 squeedee: btw amalloy, you've helped me a lot today :D (with all your comments, stackoverflow and elsewhere)

20:51 amalloy: i have?

20:51 squeedee: yep. most of the useful answers i've found today have been in part thanks to you.

20:55 amalloy: man, a whole heck of a lot of pull requests to amalloy/useful have piled up. apparently my notification settings were not sending them to me

20:56 jeremyheiler: amalloy: finally!

20:56 lol

20:58 amalloy: weird. i was unwatching the repo

20:58 lukecossey: Anyone ever tried to get the goog.fx.css3.Transitions working with Safari?? Every other browser is fine.

21:02 amalloy: hey, here's a pull request by me from two years ago. it is thoroughly unfamiliar to me: https://github.com/amalloy/useful/pull/13

21:06 technomancy: amalloy: happens to me all the time

21:06 (github magically unwatching repos for me)

21:06 amalloy: technomancy: it was a pull request to my own repo!

21:06 oh

21:06 verma: thanks doctorm, I will give it a shot

21:06 technomancy: yeah, that one ... not so sure what's going on

21:07 amalloy: technomancy: i expect the unwatching was my fault, as some weird side effect of splitting up the flatland stuff into amalloy/ninjudd/raynes repos

21:07 technomancy: amalloy: it's happened waaaaaay too often to me IME for it to be something I hit by accident

21:08 lodin: hiredman, amalloy, et al.: I'm off. Thanks for your comments and pointers.

21:09 mthvedt: lodin: still there?

21:09 lodin: mthvedt: Yes.

21:10 mthvedt: lodin: i’ve been playing with a repl/profiler, and it looks like i’m wrong about deftypes being GCed. however, NSes do get GCed, but only if unmapped.

21:11 i’m not sure if that’s correct behavior, just a tidbit for you.

21:12 lodin: mthvedt: How did you get to the conclusion that deftypes not being GCed?

21:12 mthvedt: lodin: generated a large number of them and watched the profiler.

21:13 that is, a number larger than current allocated memory.

21:14 lodin: mthvedt: That's what I did as well, but I don't know enough about how JVM and the OS handles memory to be certain I interpret that correctly.

21:15 Except I didn't use the profile. I just watch the java process memory.

21:16 justin_smith: lodin: wouldn't one test be to see if you can make the jvm run out of space? give a relatively low max permgen and max heap, then repeatedly make classes that should be collectible. See if you can make it crash just doing that.

21:16 mthvedt: lodin: sun/oracle JVM will prefer garbage collecting to expanding the heap. growing heap + a lot of objects hanging around = they aren’t being garbage collected.

21:16 justin_smith: also, profiling is not super hard, the jdk comes with a profiler, other ones are not hard to find

21:18 lodin: justin_smith: Yeah, this has given me a reason to look into profilers and JVM settings. I'm not a java guy, so this is new territory for me.

21:18 verma: crap, trying to start cljs env in cider nrepl gives me this: UnsupportedOperationException count not supported on this type: Symbol clojure.lang.RT.countFrom (RT.java:556)

21:18 has anyone seen this before?

21:28 what is this page basically asking me to do? (sorry for off-topic)

21:28 http://www.emacswiki.org/HighlightCurrentLine

21:29 is it asking me to (require 'hl-line) ?

21:30 justin_smith: verma: if you want to load that library, yeah that's how you would do it

21:31 then you would turn on the minor mode in a buffer where you want it

21:31 verma: you can do it interactively via M-:

21:31 followed by M-x hl-line-mode in any buffer where you want it turned on

21:31 verma: justin_smith, I want to highlight the current line, really, that means I load that and set some variable to enable it?

21:31 oh ok

21:31 justin_smith: it's pretty intense, I am turning it off again now

21:32 verma: how do I get it to enable all the time? (setq hl-line-mode 1) in ~/.emacs ?

21:32 justin_smith: require loads conditionally, just like in clojure

21:32 arrdem: Grimoire beta build if anyone cares to kick it around http://arrdem.com:4000

21:32 looks like there are six bots in this channel that crawl everything..

21:32 justin_smith: verma: hl-line-mode is buffer local, though there may be a global variant

21:32 global-hl-line-mode

21:32 yeah

21:32 verma: justin_smith, nice thanks

21:33 its looks nice, its not that intense :P

21:33 justin_smith: maybe it just sucks with my color scheme

21:33 danielcompton: amalloy: thanks for the quick build, I was just about to make an internal release

21:33 verma: now i need horizontal line and I'd be one step away from CAD software

21:33 I mean vertical

21:33 justin_smith: haha

21:33 I am sure it is possible

21:33 arrdem: verma: there's a script I saw a while back that did both...

21:33 verma: yeah, I stumbled across it just now

21:34 justin_smith: verma: it would be cool to have it as a hairline crosshairs overlay

21:34 rather than highlighting the entire line

21:34 verma: media would so pick that up

21:34 amalloy: danielcompton: of useful? i actually haven't pushed the release to clojars yet. i can't figure out how to without going into the office, since clojars no longer takes scp uploads and i'm not set up here to do whatever the new stuff is

21:34 verma: hackers targetting your bytes

21:34 lodin: justin_smith, mthvedt: I tried what justin_smith said, and to me it seems like it collects the classes when the memory limit is hit.

21:35 danielcompton: amalloy: also, just saw that we need to go to 0.11.3

21:35 0.11.2 was released in feb https://github.com/flatland/useful/commit/bdd3634cce5f42ae2e3e8d0cba449a47a45c2cd7

21:35 justin_smith: lodin: if you attach jvisualvm, there is a histogram of memory usage and gc events, you should see a nice chart of it

21:35 mthvedt: lodin: interesting, can i see a refheap?

21:37 danielcompton: amalloy: no idea why that commit doesn't show up in https://github.com/flatland/useful/commits/develop/project.clj

21:38 verma: what do people usually use here to open files super fast? something similar to ctrlp in vim?

21:38 danielcompton: verma: clojure.java.io is usually fast enough

21:38 dbasch: amalloy: there’s a lein target for deploying to clojars now, but you have to set up gpg first

21:38 amalloy: dbasch: yeah, i have that all set up at work

21:38 dbasch: I did that a couple of days ago

21:39 it takes a minute

21:39 verma: danielcompton, oh sorry, should have mentioned, I am off-topicing a little bit, was interested in something like ctrlp+vim for emacs

21:39 amalloy: or i think i do, anyway. i'm even ssh'd into work, so you'd think it would work, but something weird happens to the gpg agent

21:40 verma: this looks like exactly what I need: https://github.com/d11wtq/fiplr

21:41 technomancy: I use https://github.com/technomancy/find-file-in-project/

21:41 but that's probably just because I wrote it

21:42 verma: :D

21:42 technomancy, that's awesome!

21:42 technomancy, you have a screenshot of what it looks like? is it fuzzy finder sort of?

21:42 technomancy: it is??

21:42 lazybot: technomancy: Uh, no. Why would you even ask?

21:42 lodin: mthvedt: jvisualvm confirmed that the classes are GCed. No need to use ns-remove either.

21:42 mthvedt: lodin: and these are deftypes?

21:43 technomancy: verma: it looks the same as the one you linked to

21:43 lodin: mthvedt: Yes. I did eval of deftype in a doseq.

21:43 mthvedt: tonight i’ve gotten gc to work with ordinary stuff like evaling to get a closure, but not with deftypes

21:43 can i see?

21:43 verma: technomancy, oh

21:44 technomancy: verma: oh, mine requires GNU find FWIW

21:44 lodin: mthvedt: Yeah, maybe we're talking about different things.

21:44 technomancy: I should add a readme... I wrote this in 2007 or so

21:45 verma: I think I will use flipr, since it has a screenshot and a readme :P

21:47 technomancy: I'm heartbroken

21:49 http://p.hagelb.org/10sad.gif

21:49 lodin: mthvedt: I do (doseq [_ (range 100000)] (eval (read-string "(deftype Foo [])"))) and once it hits about 40000 classes in my case (-Xmx100m and -XX:MaxPermSize=100m), it collects all but 3000-5000 of them.

21:51 scottj: fake! a) technomany no longer lives in rainy seattle, but sunny southern california. b) no facial hair

21:53 lodin: mthvedt: I apparently had a rather large permgen size when I first tested it.

21:53 technomancy: scottj: [artist's conception]

21:54 amalloy: wait, does technomancy really live in southern california now?

21:54 lodin: justin_smith: jvisualvm was brilliant for seeing this. Thanks.

21:55 technomancy: amalloy: san diego area

21:55 amalloy: why was this not on the evening news?

21:56 technomancy: I'm on the run from the law

21:56 arrdem: wait that would have _put_ it on the evening news...

21:56 mthvedt: lodin: which JVM are you using? this is not working for me.

21:57 and also which clojure?

21:57 Jaood: the NSA is after him, to much stallman koolaid

22:00 verma: man why does fiplr look different for me, its fuzzy search sucks as well :( .. I just see all matches concatenated and not listed like from top to bottom like in the screenshot

22:00 technomancy: verma: that's ido-vertical

22:00 hiredman: clojurebot: technomancy is on the run from the three laws of robotics

22:00 Jaood: technomancy: doesn't ido do fuzzy matching?

22:00 clojurebot: You don't have to tell me twice.

22:01 technomancy: Jaood: that's another setting too

22:02 ido-flex-match iirc

22:02 it's *simple* =)

22:02 scottj: imo best to look at flx and flx-ido

22:02 verma: technomancy, so I don't need fiplr at all?

22:02 scottj: if you want fuzzy matching on from the start. default is only to do fuzzy if there are no non-fuzzy matches

22:02 technomancy: verma: different libs/settings do different things. what do you want?

22:03 verma: Ctrl-T -> shows file listing from current directory -> I type in a few characters for the file I am interested -> finds and highlights most relevant result -> I hit enter -> opens the selected file

22:04 technomancy: find-file-in-project doesn't bias in favour of the current dir

22:04 verma: what does it favor?

22:04 technomancy: historical chocies

22:05 verma: oh?

22:05 technomancy: if you want something in the current dir, just use C-x C-f

22:05 mthvedt: lodin: try (doseq [_ (range 1000000)] (eval `(deftype ~(gensym "Foo") []))) , should cause an OOM.

22:05 verma: so it would remember sort of which projects I am working on etc.?

22:05 mthvedt: what i think is happing is clojure keeps references to each class name hanging around. so if you keep redefining Foo, this won’t cause an OOM.

22:06 lodin: mthvedt: clojure 1.6.0, and java 1.7.0_51 on 64-bit Win 8, and clojure 1.6.0 java 1.7.0_21 (openjdk) on 64-bit linux mint.

22:06 technomancy: verma: it won't look beyond the current project

22:07 dunno what flipr does

22:07 brehaut: technomancy: isnt that a startup?

22:07 verma: I added a ton of folders to ignore (5 actually) and it seems to be finding stuff that I want

22:07 technomancy: brehaut: it's a good bet

22:07 lodin: mthvedt: That makes sense. It shouldn't be release, because you might want to use it. Right?

22:07 verma: earlier I would search for core.cljs and it would open something I don't care about under .repl/...

22:07 so now .repl is in ignore list sort of

22:08 brehaut: technomancy: i guess flipr spends a lot of venture moeny with no actual business plan, and tries to get bought by facebook then

22:08 verma: brehaut, isn't that called enterpreneurship :P

22:09 mthvedt: lodin: right. but in a more complicated example where you remove the ns periodically, i still get OOM. my understanding of remove-ns is it’s supposed to remove those mappings.

22:09 verma: thanks for all the help technomancy

22:09 (inc technomancy)

22:09 lazybot: ⇒ 143

22:09 verma: oh jeez

22:09 :D

22:09 how do you see score without incing?

22:09 arrdem: (identity verma)

22:09 lazybot: verma has karma 0.

22:09 verma: oh what?? :(

22:10 arrdem: (identity amalloy)

22:10 lazybot: amalloy has karma 173.

22:10 Jaood: (dec verma)

22:10 lazybot: ⇒ -1

22:10 verma: :(

22:10 arrdem: (dec Jaood) ;; MAD at work

22:10 lazybot: ⇒ 3

22:10 verma: (inc verma) ; :P

22:10 lazybot: You can't adjust your own karma.

22:10 verma: :D

22:10 nullptr: (map identity [Jaood verma])

22:10 Jaood: only 170 left to be amalloy

22:11 lodin: mthvedt: Yeah. I would've expected that as well.

22:11 verma: (identity verma)

22:11 lazybot: verma has karma -1.

22:11 verma: :D

22:11 Its like I belong to the dark side

22:11 Jaood: (inc verma)

22:11 lazybot: ⇒ 0

22:11 Jaood: (inc verma)

22:11 lazybot: ⇒ 1

22:11 verma: like just started getting dark

22:11 Jaood: (inc verma)

22:11 lazybot: Do I smell abuse? Wait a while before modifying that person's karma again.

22:11 verma: :(

22:11 Jaood: (inc verma)

22:11 lazybot: Do I smell abuse? Wait a while before modifying that person's karma again.

22:11 mthvedt: (inc lazybot)

22:11 lazybot: ⇒ 31

22:11 arrdem: lol @ ratelimit

22:12 verma: :)

22:12 amalloy: clojurebot: what does abuse smell like?

22:12 clojurebot: Titim gan éirí ort.

22:12 bar1: (inc verma)

22:12 lazybot: ⇒ 2

22:12 bar1: (inc verma)

22:12 lazybot: ⇒ 3

22:12 bar1: (inc verma)

22:12 lazybot: ⇒ 4

22:12 bar1: (inc verma)

22:12 lazybot: Do I smell abuse? Wait a while before modifying that person's karma again.

22:12 bar2: (inc verma)

22:12 lazybot: ⇒ 5

22:12 bar2: (inc verma)

22:12 lazybot: ⇒ 6

22:12 bar2: (inc verma)

22:12 lazybot: ⇒ 7

22:12 verma: lol

22:12 lodin: mthvedt: As the paste above showed, the class survives the remove-ns.

22:13 mthvedt: lodin: yup

22:14 verma: argh, super annoying that my repl opens in a horizontal split

22:14 Jaood: verma: with cider?

22:15 verma: yeah

22:15 Jaood, ^

22:17 Jaood: verma: depending on your window size it chooses vertical vs horizontal split

22:17 verma: oh

22:17 ncie

22:17 nice

22:18 Jaood: but moving it its trivial anyway :)

22:18 verma: oh nice

22:18 it did split nicely now :)

22:19 lodin: mthvedt: If you find some hack to get rid of (or even just hide) the class when the ns is removed, please let me know. :-)

22:25 arrdem: ambrosebs: the idea is that /store and friends will represent a .m2 equivalent structure that you can walk to see other artifacts/groups

22:26 ambrosebs: UI needs work I guess... but the idea is that core.typed, tools.analyzer and the rest can sit in the same tree now with no changes

22:27 ambrosebs: arrdem: nice

22:28 arrdem: adding articles now so there's a structure for sharing long form commentary like destructuring and macro notes

22:28 or even just linking to other resources in a sharable (across documentation) way

23:21 ghadishayban: reiddraper: I'm using test.check to verify transducers vs. lazy seqs right now... it's not supposed to be this fun!

23:21 arrdem: (inc reiddraper)

23:21 lazybot: ⇒ 3

23:21 arrdem: oh that's just wrong

23:22 ghadishayban: I am trying to think of the minimal crappy functions to map and mapcat and take-while with

23:22 reiddraper: ghadishayban :), i'm sure we'll all be curious to see the results

23:22 ghadishayban: but I'm not doing a very good job yet

23:22 reiddraper: fun project to play with though

23:23 ghadishayban: I'm ending up with functions like (drop-while odd? (filter even? (range...)))

23:23 which is blowing up the jvm

23:24 reiddraper: ah fun, hmmm

23:25 ghadishayban: how to balance having a good test of a chain of collection transformers that doesn't need the halting problem solved?

23:25 vs. just getting it working but having it be a so-so test

23:25 i'd pay a beer for the latter right now

23:25 reiddraper: indeed

23:26 it's often fruitful with property-based testing to start with a worse test, assure yourself the SUT is correct, and then improve the test

23:26 (correct w/r/t the current state of the test)

23:28 ghadishayban: Yeah I'm using the same generator for arguments to filter and remove

23:28 which is broken if they're both in a chain of operations with the same args

23:29 for a minimal SUT I'll just vary the operations themselves, but not the arguments to them

23:33 reiddraper: seems like a great start

23:51 ghadishayban: both bugs christophe grand found today were related to r#'educed handling

23:52 #'reduced

23:52 to check collections, you'd want to exercise that well.

Logging service provided by n01se.net