#clojure log - Aug 10 2013

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

2:22 clj_newb_2345: is there a "docker rm ALL" command ?

2:22 wrong chan

2:37 sinistersnare: hello, how can i write the following java code in clojure (using java interop) 'dropSound = Gdx.audio.newSound(Gdx.files.internal("drop.wav"));'

2:37 ive imported 'Gdx'

2:38 would it be something like (.audio.newSound Gdx (.files.internal Gdx "drop.wav"))

2:48 Raynes: sinistersnare: (.newSound Gdx/audio (.internal Gdx/files "drop.wav")) ; I think.

2:48 sinistersnare: oh that makes much more sound

2:48 sense*

2:48 thinking about sound too mucuh...

7:20 xy1: how do I setup my projects or dev machine to accept a self signed certificate in leiningen? I found the :certificates option for defproject. but were to put the certificate such that the project.clj works on all dev machines?

7:24 pepijndevos: xy1; resources folder?

7:25 xy1: pepijndevos: but I have multiple projects using that repository? so adding the certificate to all seems a lot of effort.

7:26 pepijndevos: otherwise I only have option via environment variables or fixed folder right?

7:26 pepijndevos: I guess

7:27 xy1: humm I could add the ":certificates" option to the ~/.lein/profiles.clj right? then the certificate could be in the same folder

7:30 seems to work :D

8:46 geoffeg: Is there a way to get clojure.xml to use the document's schema to properly apply types? I'm trying to convert from XML to JSON (with some processing the middle) and every field from the xml ends up as a string even though many fields are integers.

8:57 llasram: geoffeg: Any notion of things in XML which aren't string document content is something layered on top of XML, none of which clojure.xml is aware of

8:59 geoffeg: alright, thanks

10:01 bkirai: Hello, I'm learning Clojure and I have a question about the basics. How can I make the function to return the "rows" variable: http://pastie.org/private/z56c4d0sonvzik25hqmmww

11:04 squidz: does anybody know how evaluate a emacs buffer to a specific nrepl session? It seems to always try to evaluate in the last created nrepl

11:50 lgs32a: when i invoke r/fold with a monoid and a foldable sequence (r/map, r/filter), will the computation run in parallel or do i have to add a combining-fn

11:53 ah i just saw in the source code that the monoid will be used as combine-f

11:55 IamDrowsy: exactly. and if it will run in parallel depends on your initial sequence

12:33 nkozo: I have a web page guarded by ring.middleware.stacktrace/wrap-stacktrace, when I raise an exception created with ex-info, the backtrace is shown on the page, but if the exception comes from a failed assert, then anything is shown, only 500 Server Error is returned. Somebody knows hy?

12:40 ok, now I'm really surprised: (instance? Exception (AssertionError. )) => false

12:40 dotemacs: hello, downloaded & installed the latest lein script at ~/bin/lein. Made it executable, when I run 'lein version' I get: https://gist.github.com/6201024 But when I do export HTTP_CLIENT='/usr/bin/curl -f -L -o' and run 'lein version' it obviously works. Shell bash, version 3.2.48, OS X 10.7.5

12:40 Did I miss a step which states that I need to declare the HTTP_CLIENT or ...

12:40 ?

12:42 sorry, wanted to ask this in leiningen channel

12:42 triyo: I've got a leiningen based project I haven't touched in a while and I now have a latest version of lein installed. When I run the uberjar command, I now get a NoClassDefFoundError: my_pkg_module/main. Is it not compiling my .clj files that are in the default source path under ./src?

12:45 I checked by running `jar -tvf ./my-prj-standalone.jar | grep my_pcg_module` and found nothing related.

12:46 However, if I run `lein run` all starts well.

12:47 * triyo just realised that there is now a #leiningen channel. Been away for to long :-(

12:47 lgs32a: when using leiningen, can I partly omit source files?

12:47 because :omit-source omits all

12:49 triyo: lgs32a: seems to be just a boolean flag and I don't see that any pattern can be specified to include or exclude certain source files

12:51 lgs32a: yeah i know

12:52 can you recommend a starting point to hack that in leiningen myself?

12:54 triyo: Yes, I have one way you could.

12:54 uberjar-exclusions [#"(?i)^META-INF/[^/]*\.SF$"]

12:54 So something like …. uberjar-exclusions [#"(?i)^my_java_src/[^/]*\.java$"]

12:54 something like that.

12:55 That'd work

12:56 lgs32a: ^^^

12:56 And BTW, that approach is not really a hack unless there is an easier way.

13:06 lgs32a: triyo: ty

13:07 triyo: pleasure

13:11 pandeiro: i'm occasionally getting 'Wrong type argument: stringp, nil' message when trying to eval code with org-babel:clojure or start an nrepl session in Emacs. The nREPL session ends up starting anyway but I would like to identify what might be causing this. Anyone know where I can look? The *Messages* buffer shows it happening like so: 'list-files: Wrong type argument: stringp, nil'

13:51 nifff: is (rest vector1) as fast as (rest list1) ?

13:52 change in the front for vectors are slow?

14:08 jtoy_: anyone know what im ding wrong with this hiccup? https://www.refheap.com/17484 im trying to generate html but it generates clojure code

14:12 normally i use for, but i join here so im not sure how to do this

14:18 aaelony: joty_: did you wrap your code in (html … ) ?

14:18 TimMc: $mail nifff Calling rest on a vector doesn't produce a new vector, it gives you a seq over the vector.

14:18 lazybot: Message saved.

14:18 aaelony: Jtoy_: did you wrap your code in (html … )

14:19 jtoy_: see above...

14:19 https://github.com/weavejester/hiccup

14:23 timvisher: so how does one go about programatically initiating a call to a static method?

14:24 i've got a bunch of static field symbols that I'd like to see the value of, but i can't seem to programatically generate a call to it

14:47 TimMc: $mail timvisher You can use Java's reflection API (see Class) to get ahold of static method handles, which can be invoked.

14:47 lazybot: Message saved.

15:16 wolfes: Is it possible to get an aleph server (run with lein) to restart itself automatically after code modification, like the way "lein ring server" works to restart ring servers? Project in question: https://github.com/wolfes/nspire

15:41 coventry: Anyone here gone through the pedestal tutorial? I'm having trouble getting the backend to work at the end of part one. I should do (use 'dev) and (start) in repls started in the tutorial-client and tutorial-service subdirectories, right? https://github.com/pedestal/app-tutorial/issues/35

15:46 kmicu: I. No problems spotted.

15:47 Always remember to 'lein clean/rm -rf out'

15:55 bbloom: odd thought: i've used sorted-set and sorted-map quite a bit, but i don't think i've ever once explicitly sorted a collection in clojure

16:01 coventry: kmicu: Yeah, this is from a fresh check out of v2.0.14, so there was no tutorial-client/out to begin with. Is it correct to initialize each repl with (use 'dev) and (start)?

16:25 shiranaihito: does anyone else find it annoying that an empty sequence is "truthy"?

16:25 in python they're not, right? i find that much more natural

16:27 kmicu: shiranaihito: No.

16:27 schmir: shiranaihito: it's not python...I've been a victim of that behaviour once..I hope I've learned it now

16:27 shiranaihito: schmir: what do you mean?

16:27 ("victim")

16:28 schmir: my program had a bug because of that

16:28 shiranaihito: umm..

16:29 schmir: the only thing I miss from python is py.test.

16:29 shiranaihito: how was it "because of that"? i mean, it's certainly possible to write bug-free code that relies on empty seqs being false

16:30 gfredericks: shiranaihito: the seq function is often used to transform emptiness to falsiness

16:30 for all collections not just seqs

16:30 shiranaihito: gfredericks: yes, i just found out about that idiom.. i just can't see why it _should_ be necessary

16:31 bts-: shiranaihito: to me it seems that any collection of values should be truthy, regardless of how many values there are in the collection

16:31 schmir: because I assumed some expression would evaluate to false but it didn't

16:31 shiranaihito: compare something like "if values: dostuff()" with "if len(values) > 0: dostuff()"

16:31 gfredericks: shiranaihito: it's a design decision. Doing it the other way would annoy other people who don't like having to enumerate a long list of falsy things

16:32 shiranaihito: schmir: well, doesn't that just mean you weren't aware of the behaviour, ie. not consciously benefiting from it?

16:32 gfredericks: e.g. "Everything is truthy except for false and nil and the empty list and the empty vector and the empty set and the empty map but not empty java collections or arrays but also zero and undefined and NaN

16:32 "

16:32 schmir: shiranaihito: it just means I been doing python for too long

16:32 shiranaihito: gfredericks: "Doing it the other way would annoy other people who don't like having to enumerate a long list of falsy things" <-- enumerating a list of falsy things? what exactly are you describing?

16:33 (or, referring to)

16:33 schmir: i'm not sure that's actually the case :p

16:33 cespare: shiranaihito: ruby, like clojure, has very simple truthiness rules (nil and false => false), and [] is true in that language.

16:33 shiranaihito: (as opposed to python, wehre you have you to memorize a bunch of rules)

16:33 schmir: shiranaihito: if you expect things to be like in python, you should probably use python not some other language

16:34 shiranaihito: cespare: well, once you're aware of "the rules" that "any empty data structure is considered 'false'", you can then get by with a lot less typing, not having to check for emptiness at every turn.. that's kind of the point here

16:34 cespare: any empty data structure

16:34 gfredericks: "Then why don't you just use X" seems to be a conversation stopper in "why isn't Clojure like X?" conversations :/

16:34 cespare: oh my, that sounds completely full of edge cases

16:35 shiranaihito: cespare: it's simple.. empty list = false, empty map = false, empty set = false, etc

16:35 gfredericks: shiranaihito: what about empty java collections?

16:35 cespare: it's not even obvious what the semantics of 'if []' should be... what are you even testing?

16:35 it's not natural to me.

16:35 shiranaihito: gfredericks: sure, why shouldn't an empty _java_-collection be false if other collections are?

16:36 (other empty ones, that is)

16:36 gfredericks: shiranaihito: so how do we decide what things count as collections then? is the empty string falsy?

16:36 what about (keyword "")?

16:36 shiranaihito: gfredericks: of course it is.. strings are sequences of characters in python

16:36 gfredericks: should we remember to tell newbs about that one too?

16:36 shiranaihito: gfredericks: and they can be manipulated like seqs

16:37 is (keyword "") an empty collection?

16:37 gfredericks: shiranaihito: the boundary between things that count and things that don't is not clear, and you have to account for any possible type I might create

16:37 shiranaihito: if not, is there anything to tell Newbie?

16:38 coventry: shiranai: You end up needing to let each type decide what its truth/false conditions are, as in __nonzero__, and it quickly gets confusing when you're trying to write type-agnostic functions.

16:38 bbloom: i'm not even sure nil should be falsy....

16:38 gfredericks: what about instances of (deftype Gary [] clojure.lang.Counted (count [_] 0))?

16:39 shiranaihito: coventry: sure, if you want to test a custom object's truthiness like that, then you need to implement "nonzero".. but is that a problem? you'll know you're dealing with your own type anyway

16:39 gfredericks: this also allows objects that can change their truthiness

16:39 shiranaihito: gfredericks: i don't know what that does (new to clojure), but i doubt that's an empty collection either

16:39 gfredericks: shiranaihito: it doesn't look like one but (count (new Gary)) returns 0

16:40 shiranaihito: gfredericks: what's your point?

16:40 bts-: shiranaihito: it's the declaration of a new type that participates in the "Counted" protocol

16:40 bbloom: shiranaihito: since you're new to clojure, maybe you should *try it for a bit* and see if you change your mind or have formed a more informed opinion?

16:41 shiranaihito: bbloom: i just wanted to ask for opinions now.. i can't see a problem with that

16:41 so far, i just can't see the benefit

16:41 gfredericks: shiranaihito: that the current behavior is super simple and not too annoying in practice, while your proposal has a _lot_ of gray area

16:41 bbloom: the issue is that it's a very subtle design decision, of which clojure is full of many

16:41 shiranaihito: but i can see how this design decision causes me more typing compared to python

16:41 coventry: In pedestal, is there a way to pull out the messages which are creating the development view (like in the recording feature of the data UI?)

16:41 bbloom: it's meaningless to discuss this particular issue without discussing the larger philosophy of the language

16:42 and that discussion will be useless unless you have an intuitive feel of the choices clojure makes in the various design spaces

16:42 shiranaihito: gfredericks: i don't see the gray area, as long as everything works consistently, like in python (afaicr)

16:42 bbloom: shiranaihito: the counted 0 thing is already a gray area, he pointed one out

16:42 and java collections

16:42 shiranaihito: bbloom: that seems overly complicated/vague

16:43 coventry: shiranai: things don't work consistently in python, that's the point of gfredericks example. The python cognate would be an __nonzero__ method which just returns false.

16:43 gfredericks: shiranaihito: exactly -- but you'd have to make a decision about that

16:43 bbloom: shiranaihito: precisely. that's why you need more exposure to the language before you can understand the motivation for such decisions

16:43 kmicu: shiranaihito: do not compare clj to python, pls

16:43 shiranaihito: bbloom: well, if his examples were not examples of empty collections/data-structures, then i can't see their relevance to empty collections evaluating to false

16:43 coventry: Well, actually, a __len__ method which always returns 0.

16:43 bbloom: what is a collection anyway?

16:43 what makes something a collection?

16:43 hyPiRion: Are we talking about falsey values?

16:43 gfredericks: hyPiRion: yeah

16:43 shiranaihito: hyPiRion: yes

16:43 hyPiRion: Oh

16:43 * hyPiRion leaves again

16:43 coventry: (Not that I'm down on python, it is my bread and butter.)

16:43 bbloom: lol

16:43 bts-: haha

16:44 shiranaihito: coventry: as mentioned, you may have to implement nonzero for your own types, but the standard ones do work consistently, if i recall correctly.. if that's the case, then i can't see a problem

16:44 consistency is key

16:44 bbloom: shiranaihito: nevermind the fact that this would slow down EVERY BRANCH OPERATION

16:45 plus you can trivially create an ify macro that calls a non-zero protocol method, if you really wanted this

16:45 shiranaihito: bbloom: um.. i guess? sometimes syntactic elegance requires a tradeoff in performance

16:45 coventry: pedestal need a dedicated IRC channel. :-)

16:45 bbloom: shiranaihito: and clojure made some trade offs for elegenace vs perfrmance. you proposal lies on the other side of the line drawn in the sand

16:46 shiranaihito: bbloom: hm.. well, i would be interested in circumventing this problem, once i know enough to do it

16:46 bbloom: yes, it is, in fact, clear to me that this is the way clojure works :p

16:46 bbloom: in the unlikely event that you still think this is a "problem" after learning clojure, you'll find it quite easy to "circumvent"

16:46 shiranaihito: cool :p

16:46 but yeah, at least for now, i can't imagine why i wouldn't prefer the python way

16:47 and this is the _only_ problem i've seen with clojure so far

16:47 gfredericks: I doubt anybody likes everything about clojure

16:47 bbloom: because explicit is better than implicit

16:47 and in the face of ambiguity, resist the urge to guess

16:47 ~zen ?

16:47 clojurebot: excusez-moi

16:47 coventry: bwahaha

16:47 shiranaihito: bbloom: that sounds like the python zen thingy :P

16:47 bbloom: shiranaihito: yes. yes it is.

16:48 and i think clojure is far more zen than python ;-)

16:48 give it time!

16:48 gfredericks: the cool thing about clojure is that, despite being complicated and messy and often not exactly what I would have done, its value for writing practical software consistently seems to be an order of magnitude higher than any other language

16:48 shiranaihito: gfredericks: huh? :p what's not to like? (besides this, that is :p)

16:48 coventry: The debugging facilities leave a lot to be desired.

16:49 gfredericks: okay everybody name your favorite problem with clojure

16:49 shiranaihito: :P

16:49 kmicu: trolls

16:49 bbloom: the primitives aren't namespaced! grrr

16:49 shiranaihito: well this should be interesting :P

16:49 technomancy: startup tiiiiiiime

16:49 shiranaihito: mmm

16:49 coventry: drip

16:49 bbloom: says the guy who writes the only tool i ever "startup" :-)

16:50 shiranaihito: technomancy: you may have a point there :)

16:50 hyPiRion: The solution is right here: (defn falsey [] (proxy [Object] [] (equals [_] true))) -> (if (= (falsey) false) "wohoo")

16:50 technomancy: bbloom: the only person daft enough to write a CLI tool in clojure you mean?

16:50 kmicu: http://www.infoq.com/presentations/What-Sucks-about-Clojure-and-Why-You-ll-Love-It-Anyway

16:50 hyPiRion: you just have to do (= object false) every time!

16:50 bbloom: hyPiRion: ##(doc false?) noob

16:50 lazybot: ⇒ "([x]); Returns true if x is the value false, false otherwise."

16:50 bbloom: :-)

16:51 technomancy: yeah something like that

16:51 hyPiRion: bbloom: but that doesn't work with my trick

16:51 also (= false (falsey)) doesn't work either

16:51 apart from that the solution is perfect.

16:52 shiranaihito: technomancy: why is it daft to write one? .. i figure you're being at least half-sarcastic, but .. ? :)

16:52 gfredericks: bbloom: when you say "primitives aren't namespaced" you mean the special forms?

16:52 bbloom: gfredericks: yeah

16:52 cespare: shiranaihito: a cli tool is obnoxious when it takes multiple seconds to start

16:52 gfredericks: yeah I thought of that recently too

16:52 shiranaihito: kmicu: i'll check that out :P

16:52 cespare: ah right.. good point :)

16:52 kmicu: shiranaihito: you should

16:53 gfredericks: I think my least favorite things are the idioms with (seq x) and (some #{x} coll)

16:53 technomancy: shiranaihito: because the startup time is so awful, plus you can't realistically launch any JVM program without a shell shim anyway

16:53 bbloom: gfredericks: try (defn if [test then else] :blah) then (if 1 2 3)

16:53 gfredericks: bbloom: yeah I'm familiar with how the special forms work

16:54 shiranaihito: gfredericks: is (seq x) meant for what i'm talking about here? checking for an empty collection?

16:54 llasram: The JRuby people go so far as to have a C shim which links to libjvm

16:54 technomancy: inb4 contains?

16:54 bbloom: gfredericks: it sucks much if you're tinkering with a little interpreter

16:54 gfredericks: shiranaihito: yeah it's recommended for checking for non-emptiness

16:54 shiranaihito: gfredericks: and you find it a problem? .. so basically you're saying you agree with me? :P

16:54 ie. needless typing, etc?

16:54 gfredericks: shiranaihito: no, my complaint is not yours

16:54 shiranaihito: but?

16:55 gfredericks: shiranaihito: my complaint is I wish there was a separate function called not-empty?

16:55 rather than seq recommended for that

16:55 shiranaihito: hmm

16:55 gfredericks: I have no complaint about the truthiness rules

16:55 hyPiRion: gfredericks: (if-not (empty? x)

16:55 gfredericks: hyPiRion: yes but that is derided as unidiomatic

16:55 hyPiRion: I'm a rebel and do that sometimes.

16:55 kmicu: shiranaihito: about rationale behind empty coll-s, Rich talked about this in a presentation about Reducers (combine part). I do not remember which one ;)

16:55 hyPiRion: I know.

16:55 gfredericks: hyPiRion: so maybe it's mostly a complaint with the recommendation and not the language itself

16:55 technomancy: lol... falsy empty collections are so weird.

16:55 shiranaihito: kmicu: hmm.. that would be interesting to see :p

16:57 hyPiRion: gfredericks: It's the idiomatic thing to do in Swearjure, if you're able to represent it in Swearjure that is.

16:57 gfredericks: hyPiRion: phew; time to start porting

16:59 hyPiRion: Perhaps I really should consider writing that SwearjureScript compiler, which compiles down to JS without alphanumerics. At least debugging would be just as easy in the compiled code and in the original one.

17:27 coventry: What's the difference and potential advantage of (def f #'ns/g) vs (def f ns/g) when doing interactive development?

17:37 llasram: coventry: When you use an identifier which resolves to a var, the generated code will implicitly dereference the var when run. In the case of definitions like your example, "when run" means "when defining the value of `f`"

17:38 So `f` will point to whatever value `ns/g` held at the time the `(def f ...)` form is evaluated

17:39 When you use the `#'` reader macro (or the `(var ...)` it expands to), you reference the Var *itself*, which is a Clojure reference type

17:39 hyPiRion: coventry: if you redefine ns/g later on, f will point to the newly defined ns/g if you store it as #'ns/g.

17:39 if you store f as ns/g, then you'd have to redefine f as well if you've redefined ns/g.

17:39 llasram: hyPiRion: I was getting there :-p

17:40 hyPiRion: ops, sorry :( I noticed you gave a more detailed response

17:41 llasram: Probably too detailed though, so all good

17:45 coventry: Thanks, guys. That sounds useful.

18:03 Kidee: hello, i'm long time scheme user, what analogue of synamic-wind i can find in clojure?

18:04 bbloom: Kidee: try/finally

18:04 finally blocks are dramatically simpler in the absence of continuations

18:05 Kidee: bbloom: thanks

18:05 bbloom: see also with-open and friends

18:05 Kidee: okay, thanks again. :)

18:07 chord: do you guys think that clojure will beat scala

18:07 Raynes: Nobody wants it to beat Scala.

18:07 They're not mutually exclusive.

18:08 I sure hope round doorknobs beat handles!

18:08 :p

18:08 bbloom: HANDLES4LIFE

18:08 chord: Raynes: clojure will beat scala

18:09 Raynes: Okay.

18:09 I appreciate the insight.

18:10 chord: Raynes why do you think otherwise

18:10 Raynes: Because they're not really competing.

18:10 chord: so you don't know

18:13 seangrove: Thought bbloom was talking about an irc philosophy of permanent nicknames

18:14 bbloom: seangrove: just wanted to fan the flame war. personally, i'm more of a fast sliding automatic doors guy. let's hurry up with that whole future thing

19:01 coventry: kmicu: Thanks a lot for responding to my github pedestal issue.

19:17 clj_newb_2345: what is the correct way to ensure that a docker container gets a particular ip address?

19:17 so I have setup a docker image that contains ssh + firefox

19:17 now, I want to ensure that when I run this container, it get s particular ip address

19:17 how do I ensure this?

19:18 damn it

19:18 wrong chaannel again

19:18 sorry everyone

19:19 Foxboron: clj_newb_2345: i was about to ask :)

19:22 futile: Are there any tools that tell me what vars exist in a given lein project and what file/line they're on?

19:33 callen: futile: I'm told text editors do this well.

19:33 futile: I mean Clojure library.

19:33 callen: futile: one could also use cat, grep, sed, and awk.

19:33 grep -R "def" .

19:34 futile: Oh my.

19:34 callen: you don't need a clojure library, just knowledge of the shell.

19:34 futile: "(definitely a bug)"

19:34 Oh look, a wrong match.

19:34 coventry: futile: nrepl can do this. "lein pom && mvn dependency:sources;" in your project directory, then in emacs, M-. on the symbol in question.

19:34 callen: coventry: that's pretty nifty, thanks.

19:35 futile: coventry: thanks, although the idea is to embed this in another text editor so I don't know if nrepl will do the trick.

19:35 callen: lol.

19:36 coventry: futile: Look at the code for source and source-fn, they must be doing something close to what you want: http://clojure.github.io/clojure/clojure.repl-api.html

19:36 futile: thanks coventry

20:13 cespare: trying to make a lein hello world. lein run -m hello.core works fun, but after I 'lein uberjar' and try to run 'java -cp target/hello-0.1.0-SNAPSHOT-standalone.jar hello.core' I get Error: Could not find or load main class hello.core

20:13 ideas?

20:17 hyPiRion: cespare: should be sufficient to just to "java -jar target/hello-0.1.0-SNAPSHOT-standalone.jar" Does that work?

20:17 whilo: i am playing with pedestal. i have now done (app/build example-app) and (app/begin example-app) on a clojure repl, with a modified tutorial-client app to play around in a mini repl. i can send messages and they are reflected in the data, but jvisualvm shows io.pedestal.app.util.scheduler to basically run at 100%

20:18 what am i doing wrong?

20:18 cespare: hyPiRion: same thing

20:18 hyPiRion: (I also put :main hello.core in my project.clj)

20:19 hyPiRion: cespare: do `lein upgrade 2.2.0`, `lein uberjar` and you should be set. And then wait for 2.3.1 to come out

20:21 cespare: it's technomancy/leiningen#1283 if you're interested. It's already solved, Phil is just waiting to ensure not more bugs are out there.

20:21 lazybot: Bug in provider profile in 2.3.0 -- https://github.com/technomancy/leiningen/issues/1283 is closed

20:22 cespare: hyPiRion: same thing

20:26 hyPiRion: the relevant classfile seems to be in the jar.

20:26 it's pretty strange

20:26 man, I have such a terrible experience every time I use anything on the jvm

20:26 always leaves a nasty taste in my mouth.

20:39 glosoli: hey do I understands correctly that in Clojure, when you are making data structures out of existing one i.e. using conj , references are retained to the old one instead of creating all the elements from scratch ?

20:43 Foxboron: glosoli: there is a talk rich gave one touching on the theme

20:44 glosoli: http://www.youtube.com/watch?v=wASCH_gPnDw

20:44 a tad out in the movie

20:44 or talk*

20:45 kurisumasu: glosoli, it uses structural sharing, so updates are really cheap. But you can reason about them being completely different values, leaving the "how they're actually built" as an implementation detail.

20:46 glosoli: Foxboron, kurisumasu thanks

20:47 kurisumasu: glosoli, you *do* take some performance hit compared with some ephemeral data structures in some cases, but for most stuff the performance is on-par (and for some cases you get better performance, and with less trouble/headaches).

20:48 glosoli: I am too new for that, I am still reading a book on Clojure, and just wanted to make sure if I understood the statement of Clojure not doing deep copies correctly

20:52 kurisumasu: glosoli, ah, okay :)

21:07 qed: If I have a string that is a method, how do I call it from clojure? like (.toString [1,2,3]), what would I do if I wanted to call "toString"

21:15 bbloom: qed: using standard java reflection primitives via interop

21:16 qed: unless you only have a small set of known things you want to call, then you're better off just making a fixed map of those

21:24 qed: bbloom: could you give me an example?

21:24 bbloom: this is being done in the context of a macro FWIW

21:25 bbloom: {:to-string (fn [x] (.toString x)) .....}

21:25 oh, if it's in a macro, then you can probably ~(symbol ".toString")

21:29 qed: bbloom: oh, duh

21:29 bbloom: thanks

22:01 devn: https://gist.github.com/devn/26de53b4f47ad7ab3920 bbloom -- if you're around could you give that gist a look? I'm screwing something up. A user is going to pass in a client to the fn being created

22:02 bbloom: devn: is there a particularly reason you're asking me, rather than more generally?

22:03 devn: no, i just knew you were around and know that you're a really smart dude

22:03 bbloom: i updated that gist btw, i had something obvious messed up

22:03 here's the issue:

22:03 (meth->pred "isJavaScriptEnabled") returns foo.bar/is-java-script-enabled? as expected

22:04 when I call it though: IllegalArgumentException No matching field found: isJavaScriptEnabled for class clojure.lang.LazySeq clojure.lang.Reflector.getInstanceField (Reflector.java:271)

22:04 why does it think it's a lazyseq?

22:04 bbloom: have you tried macro expand?

22:04 devn: yeah

22:04 (clojure.core/defn is-java-script-enabled? [c__2583__auto__] (clojure.core/let [client-opts__2584__auto__ (yokogiri.core/get-client-options c__2583__auto__)] (.isJavaScriptEnabled client-opts__2584__auto__)))

22:05 Raynes: devn: The problem is that your predicates should never do meth.

22:05 devn: haha, why did i know someone was going to bring up meth

22:05 bts-: not even once

22:05 Raynes: You should have known who as well.

22:05 devn: Raynes: to be totally honest with you, i think in the back of my mind i knew it would be you or callen

22:06 Raynes: Dear God, callen, we're getting lumped together in things now.

22:06 I think we need to take some time off.

22:06 devn: Raynes: any idea on what's up with my macro?

22:06 Raynes: Oh, you wanted me to be helpful. Sorry. One moment.

22:06 devn: haha

22:07 i think it's the let

22:08 but im not sure how to fix it. I need to unquote the result of get-client-options, but that blows up because it doesn't know what c# is yet

22:10 Raynes: devn: What is get-client-options?

22:10 bts-: do you mean to be calling isJavaScriptEnabled on the client options instead of the client?

22:10 devn: Raynes: (.getOptions client)

22:10 bts-: yes

22:11 Raynes: Well.

22:11 That's what you're telling it to do.

22:11 devn: heh, well, i found a solution

22:11 everyone stop what you're doing

22:12 err, if you're looking at why this wasn't working

22:12 it's 100% my fault

22:12 get-client-options changed and needed to be re-evaled

22:12 * devn has a sad face right now

22:12 Raynes: I was about to say, this macro does exactly what you've told it to do. :P

22:13 xeqi: true of programs in general

22:13 devn: Raynes: i had changed get-client-options to a thingy which would return a map of all the current options

22:13 Raynes: xeqi: Especially Chef.

22:13 devn: which is why im writing this macro

22:13 anyway, gotta run, thanks guys

22:14 Raynes: You're welcome.

22:14 I'll happily tell you that your macro works any day!

22:17 ambrosebs: are there snapshot releases of clojurescript on maven?

22:17 or more likely sonatype

22:20 Bronsa: cool. emacs just crashed while opening Compiler.java

22:40 axle_512: Does anyone know if core.cache has support for "weight". (Guava caches have this feature)

22:41 Guava says: if your cache values have radically different memory footprints -- you may specify a weight function with http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/cache/CacheBuilder.html#weigher(com.google.common.cache.Weigher) and a maximum cache weight

22:41 Is there something similar in clojure.cache?

23:31 ystael: Anybody know how to make clojail.core/thunk-timeout pass *out* along to the thread it spawns?

23:32 actually, don't answer that

23:32 sorry

Logging service provided by n01se.net