#clojure logs

2013-08-10

02:22clj_newb_2345is there a "docker rm ALL" command ?
02:22clj_newb_2345wrong chan
02:37sinistersnarehello, how can i write the following java code in clojure (using java interop) 'dropSound = Gdx.audio.newSound(Gdx.files.internal("drop.wav"));'
02:37sinistersnareive imported 'Gdx'
02:38sinistersnarewould it be something like (.audio.newSound Gdx (.files.internal Gdx "drop.wav"))
02:48Raynessinistersnare: (.newSound Gdx/audio (.internal Gdx/files "drop.wav")) ; I think.
02:48sinistersnareoh that makes much more sound
02:48sinistersnaresense*
02:48sinistersnarethinking about sound too mucuh...
07:20xy1how 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?
07:24pepijndevosxy1; resources folder?
07:25xy1pepijndevos: but I have multiple projects using that repository? so adding the certificate to all seems a lot of effort.
07:26xy1pepijndevos: otherwise I only have option via environment variables or fixed folder right?
07:26pepijndevosI guess
07:27xy1humm I could add the ":certificates" option to the ~/.lein/profiles.clj right? then the certificate could be in the same folder
07:30xy1seems to work :D
08:46geoffegIs 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.
08:57llasramgeoffeg: 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
08:59geoffegalright, thanks
10:01bkiraiHello, 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:04squidzdoes 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:50lgs32awhen 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:53lgs32aah i just saw in the source code that the monoid will be used as combine-f
11:55IamDrowsyexactly. and if it will run in parallel depends on your initial sequence
12:33nkozoI 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:40nkozook, now I'm really surprised: (instance? Exception (AssertionError. )) => false
12:40dotemacshello, 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:40dotemacsDid I miss a step which states that I need to declare the HTTP_CLIENT or ...
12:40dotemacs?
12:42dotemacssorry, wanted to ask this in leiningen channel
12:42triyoI'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:45triyoI checked by running `jar -tvf ./my-prj-standalone.jar | grep my_pcg_module` and found nothing related.
12:46triyoHowever, if I run `lein run` all starts well.
12:47lgs32awhen using leiningen, can I partly omit source files?
12:47lgs32abecause :omit-source omits all
12:49triyolgs32a: 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:51lgs32ayeah i know
12:52lgs32acan you recommend a starting point to hack that in leiningen myself?
12:54triyoYes, I have one way you could.
12:54triyouberjar-exclusions [#"(?i)^META-INF/[^/]*\.SF$"]
12:54triyoSo something like …. uberjar-exclusions [#"(?i)^my_java_src/[^/]*\.java$"]
12:54triyosomething like that.
12:55triyoThat'd work
12:56triyolgs32a: ^^^
12:56triyoAnd BTW, that approach is not really a hack unless there is an easier way.
13:06lgs32atriyo: ty
13:07triyopleasure
13:11pandeiroi'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:51nifffis (rest vector1) as fast as (rest list1) ?
13:52nifffchange in the front for vectors are slow?
14:08jtoy_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:12jtoy_normally i use for, but i join here so im not sure how to do this
14:18aaelonyjoty_: did you wrap your code in (html … ) ?
14:18TimMc$mail nifff Calling rest on a vector doesn't produce a new vector, it gives you a seq over the vector.
14:18lazybotMessage saved.
14:18aaelonyJtoy_: did you wrap your code in (html … )
14:19aaelonyjtoy_: see above...
14:19aaelonyhttps://github.com/weavejester/hiccup
14:23timvisherso how does one go about programatically initiating a call to a static method?
14:24timvisheri'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:47TimMc$mail timvisher You can use Java's reflection API (see Class) to get ahold of static method handles, which can be invoked.
14:47lazybotMessage saved.
15:16wolfesIs 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:41coventryAnyone 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:46kmicuI. No problems spotted.
15:47kmicuAlways remember to 'lein clean/rm -rf out'
15:55bbloomodd 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:01coventrykmicu: 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:25shiranaihitodoes anyone else find it annoying that an empty sequence is "truthy"?
16:25shiranaihitoin python they're not, right? i find that much more natural
16:27kmicushiranaihito: No.
16:27schmirshiranaihito: it's not python...I've been a victim of that behaviour once..I hope I've learned it now
16:27shiranaihitoschmir: what do you mean?
16:27shiranaihito("victim")
16:28schmirmy program had a bug because of that
16:28shiranaihitoumm..
16:29schmirthe only thing I miss from python is py.test.
16:29shiranaihitohow was it "because of that"? i mean, it's certainly possible to write bug-free code that relies on empty seqs being false
16:30gfredericksshiranaihito: the seq function is often used to transform emptiness to falsiness
16:30gfredericksfor all collections not just seqs
16:30shiranaihitogfredericks: yes, i just found out about that idiom.. i just can't see why it _should_ be necessary
16:31bts-shiranaihito: to me it seems that any collection of values should be truthy, regardless of how many values there are in the collection
16:31schmirbecause I assumed some expression would evaluate to false but it didn't
16:31shiranaihitocompare something like "if values: dostuff()" with "if len(values) > 0: dostuff()"
16:31gfredericksshiranaihito: 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:32shiranaihitoschmir: well, doesn't that just mean you weren't aware of the behaviour, ie. not consciously benefiting from it?
16:32gfrederickse.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:32gfredericks"
16:32schmirshiranaihito: it just means I been doing python for too long
16:32shiranaihitogfredericks: "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:33shiranaihito(or, referring to)
16:33shiranaihitoschmir: i'm not sure that's actually the case :p
16:33cespareshiranaihito: ruby, like clojure, has very simple truthiness rules (nil and false => false), and [] is true in that language.
16:33cespareshiranaihito: (as opposed to python, wehre you have you to memorize a bunch of rules)
16:33schmirshiranaihito: if you expect things to be like in python, you should probably use python not some other language
16:34shiranaihitocespare: 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:34cespareany empty data structure
16:34gfredericks"Then why don't you just use X" seems to be a conversation stopper in "why isn't Clojure like X?" conversations :/
16:34cespareoh my, that sounds completely full of edge cases
16:35shiranaihitocespare: it's simple.. empty list = false, empty map = false, empty set = false, etc
16:35gfredericksshiranaihito: what about empty java collections?
16:35cespareit's not even obvious what the semantics of 'if []' should be... what are you even testing?
16:35cespareit's not natural to me.
16:35shiranaihitogfredericks: sure, why shouldn't an empty _java_-collection be false if other collections are?
16:36shiranaihito(other empty ones, that is)
16:36gfredericksshiranaihito: so how do we decide what things count as collections then? is the empty string falsy?
16:36gfrederickswhat about (keyword "")?
16:36shiranaihitogfredericks: of course it is.. strings are sequences of characters in python
16:36gfredericksshould we remember to tell newbs about that one too?
16:36shiranaihitogfredericks: and they can be manipulated like seqs
16:37shiranaihitois (keyword "") an empty collection?
16:37gfredericksshiranaihito: 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:37shiranaihitoif not, is there anything to tell Newbie?
16:38coventryshiranai: 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:38bbloomi'm not even sure nil should be falsy....
16:38gfrederickswhat about instances of (deftype Gary [] clojure.lang.Counted (count [_] 0))?
16:39shiranaihitocoventry: 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:39gfredericksthis also allows objects that can change their truthiness
16:39shiranaihitogfredericks: i don't know what that does (new to clojure), but i doubt that's an empty collection either
16:39gfredericksshiranaihito: it doesn't look like one but (count (new Gary)) returns 0
16:40shiranaihitogfredericks: what's your point?
16:40bts-shiranaihito: it's the declaration of a new type that participates in the "Counted" protocol
16:40bbloomshiranaihito: 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:41shiranaihitobbloom: i just wanted to ask for opinions now.. i can't see a problem with that
16:41shiranaihitoso far, i just can't see the benefit
16:41gfredericksshiranaihito: that the current behavior is super simple and not too annoying in practice, while your proposal has a _lot_ of gray area
16:41bbloomthe issue is that it's a very subtle design decision, of which clojure is full of many
16:41shiranaihitobut i can see how this design decision causes me more typing compared to python
16:41coventryIn 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:41bbloomit's meaningless to discuss this particular issue without discussing the larger philosophy of the language
16:42bbloomand that discussion will be useless unless you have an intuitive feel of the choices clojure makes in the various design spaces
16:42shiranaihitogfredericks: i don't see the gray area, as long as everything works consistently, like in python (afaicr)
16:42bbloomshiranaihito: the counted 0 thing is already a gray area, he pointed one out
16:42bbloomand java collections
16:42shiranaihitobbloom: that seems overly complicated/vague
16:43coventryshiranai: 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:43gfredericksshiranaihito: exactly -- but you'd have to make a decision about that
16:43bbloomshiranaihito: precisely. that's why you need more exposure to the language before you can understand the motivation for such decisions
16:43kmicushiranaihito: do not compare clj to python, pls
16:43shiranaihitobbloom: 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:43coventryWell, actually, a __len__ method which always returns 0.
16:43bbloomwhat is a collection anyway?
16:43bbloomwhat makes something a collection?
16:43hyPiRionAre we talking about falsey values?
16:43gfrederickshyPiRion: yeah
16:43shiranaihitohyPiRion: yes
16:43hyPiRionOh
16:43coventry(Not that I'm down on python, it is my bread and butter.)
16:43bbloomlol
16:43bts-haha
16:44shiranaihitocoventry: 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:44shiranaihitoconsistency is key
16:44bbloomshiranaihito: nevermind the fact that this would slow down EVERY BRANCH OPERATION
16:45bbloomplus you can trivially create an ify macro that calls a non-zero protocol method, if you really wanted this
16:45shiranaihitobbloom: um.. i guess? sometimes syntactic elegance requires a tradeoff in performance
16:45coventrypedestal need a dedicated IRC channel. :-)
16:45bbloomshiranaihito: 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:46shiranaihitobbloom: hm.. well, i would be interested in circumventing this problem, once i know enough to do it
16:46shiranaihitobbloom: yes, it is, in fact, clear to me that this is the way clojure works :p
16:46bbloomin the unlikely event that you still think this is a "problem" after learning clojure, you'll find it quite easy to "circumvent"
16:46shiranaihitocool :p
16:46shiranaihitobut yeah, at least for now, i can't imagine why i wouldn't prefer the python way
16:47shiranaihitoand this is the _only_ problem i've seen with clojure so far
16:47gfredericksI doubt anybody likes everything about clojure
16:47bbloombecause explicit is better than implicit
16:47bbloomand in the face of ambiguity, resist the urge to guess
16:47bbloom~zen ?
16:47clojurebotexcusez-moi
16:47coventrybwahaha
16:47shiranaihitobbloom: that sounds like the python zen thingy :P
16:47bbloomshiranaihito: yes. yes it is.
16:48bbloomand i think clojure is far more zen than python ;-)
16:48bbloomgive it time!
16:48gfredericksthe 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:48shiranaihitogfredericks: huh? :p what's not to like? (besides this, that is :p)
16:48coventryThe debugging facilities leave a lot to be desired.
16:49gfredericksokay everybody name your favorite problem with clojure
16:49shiranaihito:P
16:49kmicutrolls
16:49bbloomthe primitives aren't namespaced! grrr
16:49shiranaihitowell this should be interesting :P
16:49technomancystartup tiiiiiiime
16:49shiranaihitommm
16:49coventrydrip
16:49bbloomsays the guy who writes the only tool i ever "startup" :-)
16:50shiranaihitotechnomancy: you may have a point there :)
16:50hyPiRionThe solution is right here: (defn falsey [] (proxy [Object] [] (equals [_] true))) -> (if (= (falsey) false) "wohoo")
16:50technomancybbloom: the only person daft enough to write a CLI tool in clojure you mean?
16:50kmicuhttp://www.infoq.com/presentations/What-Sucks-about-Clojure-and-Why-You-ll-Love-It-Anyway
16:50hyPiRionyou just have to do (= object false) every time!
16:50bbloomhyPiRion: ##(doc false?) noob
16:50lazybot⇒ "([x]); Returns true if x is the value false, false otherwise."
16:50bbloom:-)
16:51bbloomtechnomancy: yeah something like that
16:51hyPiRionbbloom: but that doesn't work with my trick
16:51hyPiRionalso (= false (falsey)) doesn't work either
16:51hyPiRionapart from that the solution is perfect.
16:52shiranaihitotechnomancy: why is it daft to write one? .. i figure you're being at least half-sarcastic, but .. ? :)
16:52gfredericksbbloom: when you say "primitives aren't namespaced" you mean the special forms?
16:52bbloomgfredericks: yeah
16:52cespareshiranaihito: a cli tool is obnoxious when it takes multiple seconds to start
16:52gfredericksyeah I thought of that recently too
16:52shiranaihitokmicu: i'll check that out :P
16:52shiranaihitocespare: ah right.. good point :)
16:52kmicushiranaihito: you should
16:53gfredericksI think my least favorite things are the idioms with (seq x) and (some #{x} coll)
16:53technomancyshiranaihito: because the startup time is so awful, plus you can't realistically launch any JVM program without a shell shim anyway
16:53bbloomgfredericks: try (defn if [test then else] :blah) then (if 1 2 3)
16:53gfredericksbbloom: yeah I'm familiar with how the special forms work
16:54shiranaihitogfredericks: is (seq x) meant for what i'm talking about here? checking for an empty collection?
16:54llasramThe JRuby people go so far as to have a C shim which links to libjvm
16:54technomancyinb4 contains?
16:54bbloomgfredericks: it sucks much if you're tinkering with a little interpreter
16:54gfredericksshiranaihito: yeah it's recommended for checking for non-emptiness
16:54shiranaihitogfredericks: and you find it a problem? .. so basically you're saying you agree with me? :P
16:54shiranaihitoie. needless typing, etc?
16:54gfredericksshiranaihito: no, my complaint is not yours
16:54shiranaihitobut?
16:55gfredericksshiranaihito: my complaint is I wish there was a separate function called not-empty?
16:55gfredericksrather than seq recommended for that
16:55shiranaihitohmm
16:55gfredericksI have no complaint about the truthiness rules
16:55hyPiRiongfredericks: (if-not (empty? x)
16:55gfrederickshyPiRion: yes but that is derided as unidiomatic
16:55hyPiRionI'm a rebel and do that sometimes.
16:55kmicushiranaihito: about rationale behind empty coll-s, Rich talked about this in a presentation about Reducers (combine part). I do not remember which one ;)
16:55hyPiRionI know.
16:55gfrederickshyPiRion: so maybe it's mostly a complaint with the recommendation and not the language itself
16:55technomancylol... falsy empty collections are so weird.
16:55shiranaihitokmicu: hmm.. that would be interesting to see :p
16:57hyPiRiongfredericks: It's the idiomatic thing to do in Swearjure, if you're able to represent it in Swearjure that is.
16:57gfrederickshyPiRion: phew; time to start porting
16:59hyPiRionPerhaps 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:27coventryWhat's the difference and potential advantage of (def f #'ns/g) vs (def f ns/g) when doing interactive development?
17:37llasramcoventry: 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:38llasramSo `f` will point to whatever value `ns/g` held at the time the `(def f ...)` form is evaluated
17:39llasramWhen you use the `#'` reader macro (or the `(var ...)` it expands to), you reference the Var *itself*, which is a Clojure reference type
17:39hyPiRioncoventry: if you redefine ns/g later on, f will point to the newly defined ns/g if you store it as #'ns/g.
17:39hyPiRionif you store f as ns/g, then you'd have to redefine f as well if you've redefined ns/g.
17:39llasramhyPiRion: I was getting there :-p
17:40hyPiRionops, sorry :( I noticed you gave a more detailed response
17:41llasramProbably too detailed though, so all good
17:45coventryThanks, guys. That sounds useful.
18:03Kideehello, i'm long time scheme user, what analogue of synamic-wind i can find in clojure?
18:04bbloomKidee: try/finally
18:04bbloomfinally blocks are dramatically simpler in the absence of continuations
18:05Kideebbloom: thanks
18:05bbloomsee also with-open and friends
18:05Kideeokay, thanks again. :)
18:07chorddo you guys think that clojure will beat scala
18:07RaynesNobody wants it to beat Scala.
18:07RaynesThey're not mutually exclusive.
18:08RaynesI sure hope round doorknobs beat handles!
18:08Raynes:p
18:08bbloomHANDLES4LIFE
18:08chordRaynes: clojure will beat scala
18:09RaynesOkay.
18:09RaynesI appreciate the insight.
18:10chordRaynes why do you think otherwise
18:10RaynesBecause they're not really competing.
18:10chordso you don't know
18:13seangroveThought bbloom was talking about an irc philosophy of permanent nicknames
18:14bbloomseangrove: 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:01coventrykmicu: Thanks a lot for responding to my github pedestal issue.
19:17clj_newb_2345what is the correct way to ensure that a docker container gets a particular ip address?
19:17clj_newb_2345so I have setup a docker image that contains ssh + firefox
19:17clj_newb_2345now, I want to ensure that when I run this container, it get s particular ip address
19:17clj_newb_2345how do I ensure this?
19:18clj_newb_2345damn it
19:18clj_newb_2345wrong chaannel again
19:18clj_newb_2345sorry everyone
19:19Foxboronclj_newb_2345: i was about to ask :)
19:22futileAre there any tools that tell me what vars exist in a given lein project and what file/line they're on?
19:33callenfutile: I'm told text editors do this well.
19:33futileI mean Clojure library.
19:33callenfutile: one could also use cat, grep, sed, and awk.
19:33callengrep -R "def" .
19:34futileOh my.
19:34callenyou don't need a clojure library, just knowledge of the shell.
19:34futile"(definitely a bug)"
19:34futileOh look, a wrong match.
19:34coventryfutile: nrepl can do this. "lein pom && mvn dependency:sources;" in your project directory, then in emacs, M-. on the symbol in question.
19:34callencoventry: that's pretty nifty, thanks.
19:35futilecoventry: thanks, although the idea is to embed this in another text editor so I don't know if nrepl will do the trick.
19:35callenlol.
19:36coventryfutile: 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:36futilethanks coventry
20:13cesparetrying 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:13cespareideas?
20:17hyPiRioncespare: should be sufficient to just to "java -jar target/hello-0.1.0-SNAPSHOT-standalone.jar" Does that work?
20:17whiloi 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:18whilowhat am i doing wrong?
20:18cesparehyPiRion: same thing
20:18cesparehyPiRion: (I also put :main hello.core in my project.clj)
20:19hyPiRioncespare: do `lein upgrade 2.2.0`, `lein uberjar` and you should be set. And then wait for 2.3.1 to come out
20:21hyPiRioncespare: 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:21lazybotBug in provider profile in 2.3.0 -- https://github.com/technomancy/leiningen/issues/1283 is closed
20:22cesparehyPiRion: same thing
20:26cesparehyPiRion: the relevant classfile seems to be in the jar.
20:26cespareit's pretty strange
20:26cespareman, I have such a terrible experience every time I use anything on the jvm
20:26cesparealways leaves a nasty taste in my mouth.
20:39glosolihey 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:43Foxboronglosoli: there is a talk rich gave one touching on the theme
20:44Foxboronglosoli: http://www.youtube.com/watch?v=wASCH_gPnDw
20:44Foxborona tad out in the movie
20:44Foxboronor talk*
20:45kurisumasuglosoli, 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:46glosoliFoxboron, kurisumasu thanks
20:47kurisumasuglosoli, 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:48glosoliI 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:52kurisumasuglosoli, ah, okay :)
21:07qedIf 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:15bbloomqed: using standard java reflection primitives via interop
21:16bbloomqed: 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:24qedbbloom: could you give me an example?
21:24qedbbloom: this is being done in the context of a macro FWIW
21:25bbloom{:to-string (fn [x] (.toString x)) .....}
21:25bbloomoh, if it's in a macro, then you can probably ~(symbol ".toString")
21:29qedbbloom: oh, duh
21:29qedbbloom: thanks
22:01devnhttps://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:02bbloomdevn: is there a particularly reason you're asking me, rather than more generally?
22:03devnno, i just knew you were around and know that you're a really smart dude
22:03devnbbloom: i updated that gist btw, i had something obvious messed up
22:03devnhere's the issue:
22:03devn(meth->pred "isJavaScriptEnabled") returns foo.bar/is-java-script-enabled? as expected
22:04devnwhen I call it though: IllegalArgumentException No matching field found: isJavaScriptEnabled for class clojure.lang.LazySeq clojure.lang.Reflector.getInstanceField (Reflector.java:271)
22:04devnwhy does it think it's a lazyseq?
22:04bbloomhave you tried macro expand?
22:04devnyeah
22:04devn(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:05Raynesdevn: The problem is that your predicates should never do meth.
22:05devnhaha, why did i know someone was going to bring up meth
22:05bts-not even once
22:05RaynesYou should have known who as well.
22:05devnRaynes: to be totally honest with you, i think in the back of my mind i knew it would be you or callen
22:06RaynesDear God, callen, we're getting lumped together in things now.
22:06RaynesI think we need to take some time off.
22:06devnRaynes: any idea on what's up with my macro?
22:06RaynesOh, you wanted me to be helpful. Sorry. One moment.
22:06devnhaha
22:07devni think it's the let
22:08devnbut 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:10Raynesdevn: What is get-client-options?
22:10bts-do you mean to be calling isJavaScriptEnabled on the client options instead of the client?
22:10devnRaynes: (.getOptions client)
22:10devnbts-: yes
22:11RaynesWell.
22:11RaynesThat's what you're telling it to do.
22:11devnheh, well, i found a solution
22:11devneveryone stop what you're doing
22:12devnerr, if you're looking at why this wasn't working
22:12devnit's 100% my fault
22:12devnget-client-options changed and needed to be re-evaled
22:12RaynesI was about to say, this macro does exactly what you've told it to do. :P
22:13xeqitrue of programs in general
22:13devnRaynes: i had changed get-client-options to a thingy which would return a map of all the current options
22:13Raynesxeqi: Especially Chef.
22:13devnwhich is why im writing this macro
22:13devnanyway, gotta run, thanks guys
22:14RaynesYou're welcome.
22:14RaynesI'll happily tell you that your macro works any day!
22:17ambrosebsare there snapshot releases of clojurescript on maven?
22:17ambrosebsor more likely sonatype
22:20Bronsacool. emacs just crashed while opening Compiler.java
22:40axle_512Does anyone know if core.cache has support for "weight". (Guava caches have this feature)
22:41axle_512Guava 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:41axle_512Is there something similar in clojure.cache?
23:31ystaelAnybody know how to make clojail.core/thunk-timeout pass *out* along to the thread it spawns?
23:32ystaelactually, don't answer that
23:32ystaelsorry