#clojure log - Aug 01 2013

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

0:15 rkneufeld: Poo, leiningen's :repl-options {:init-ns user} option doesn't work :(

0:34 chronno: rkneufeld: from an emacs nrepl?

0:34 rkneufeld: chronno: Plain lein repl

0:35 You basically *have* to have a user.clj on your path somewhere for this project.clj

0:36 chronno: rkneufeld: Oh. I asked because I saw an nrepl.el workaround for it

0:36 :-(

0:37 xeqi: rkneufeld: you wanted it to start in a 'user ns with only clojure loaded/

0:37 ?

0:38 rkneufeld: xeqi: Yeah, wanted to launch into user and then (use 'io.pedestal.app-tools.dev)

0:39 xeqi: I'd leave :init-ns out, but :main overrides the launching ns :(, and I'd prefer to leave people in user in case they've done any special stuff

1:15 Raynes: callen: https://github.com/Raynes/reap My contribution to society for today

1:24 bbloom: Raynes: i'd heard of elixer, but hadn't seen it. very ruby-ish. looks far more pleasant than the prolog lineage in erlang

1:24 callen: Raynes: fun.

1:24 Raynes: bbloom: Yeah, the important thing is that it maintains lots of Erlang semantics and such.

1:24 callen: bbloom: it's a Clojure inspired language with Ruby syntax.

1:24 Raynes: Immutability, etc.

1:25 callen: but yeah, also very close to Erlang semantically.

1:25 sdegutis: what about it is clojure-inspired, besides immutability?

1:25 bbloom: does it aim for coffeescript-like 1-to-1-ish "transpiler" output?

1:25 callen: bbloom: no, it's far more useful than that. it compiles directly to bytecode.

1:25 bbloom: ah, interesting

1:26 callen: bbloom: it also has the distinction of being the only non-Lisp with a significant macro system.

1:26 (IMHO)

1:26 sdegutis: but what about ruby!

1:26 bbloom: your opinion is not so humble….

1:26 Raynes: sdegutis: It has protocols, records, macros, a leiningen-like build tool (yay me), etc.

1:26 technomancy: uh, factor?

1:26 callen: bbloom: honest

1:26 not humble. I'm never humble.

1:26 Raynes: He said language, technomancy, not backwards day.

1:27 callen: lol ^^

1:27 technomancy: =P

1:27 sdegutis: Raynes: but he ditched the consistent-syntax part

1:27 * bbloom <3 factor's implementation

1:27 bbloom: http://docs.factorcode.org/content/article-macros.html

1:27 great docs too

1:27 Raynes: Yes, it isn't a Lisp.

1:28 bbloom: everything about factor is awesome, except writing your whole program in postfix. i feel like it would probably make a great compiler IR :-)

1:28 sdegutis: you can have consistent syntax without being a lisp

1:28 maybe

1:28 Raynes: And the fact that they never do releases and stuff shit like reddit API clients in the language itself, bbloom.

1:28 callen: the point isn't to improve syntax, but by and large eliminate it.

1:28 Raynes: They manage the project horribly and it'll never go anywhere because of it.

1:28 technomancy: reddit?!

1:28 bbloom: their BDFL is MIA

1:28 Raynes: technomancy: Yes, factor includes a reddit API client.

1:28 sdegutis: callen: agreed

1:29 callen: Factor has one of the more amusing ratios of "neat language" / "badly managed" I've seen.

1:29 Raynes: bbloom: Slava did all the things above as well.

1:29 callen: Erlang is up there with Factor in that respect.

1:29 technomancy: wow

1:29 bbloom: $ find . -name '*reddit*'

1:29 ./extra/reddit

1:29 ./extra/reddit/reddit.factor

1:29 holy hell

1:29 at least it's in extra, lol

1:29 callen: I'm surprised you didn't know about that

1:29 people raised a fuss over the reddit client.

1:30 bbloom: i'm not interested in fusses

1:30 Raynes: I bitched about it on HN and they said that it's because it's easier to include it with the language than make it a library because Factor doesn't have a package manager or some shit.

1:30 callen: isn't that a sign you should fix the pkg mgr issue?

1:30 Raynes: http://img.photobucket.com/albums/v91/theemily/image-1.gif my thoughts on that.

1:30 callen: Raynes: so I saw a plausible package manager for Golang not too long ago. Integrated fairly cleanly, versioned repeatable builds, doesn't require any real action on behalf of the larger community to work.

1:30 Raynes: http://media.tumblr.com/tumblr_lemzzssOGn1qbroyg.gif better gif :p

1:30 callen: Raynes: community reaction to this compact, nicely designed package manager? crickets.

1:31 sdegutis: callen: which?

1:31 callen: I don't even remember the name, but it's like the third in a series of similar package managers I've seen.

1:31 Raynes: The one with repeatability. :p

1:31 I was pretty amused at Go's approach to package management.

1:31 callen: I don't know if I'm more pissed at the Google devs for not giving a fuck about projects that don't store everything (including deps) in one big p4 tree or at the community for not picking up one of these package managers.

1:32 Raynes: Which seemed to be "lol we're so clever we ain't really be needin' one yo"

1:32 callen: Raynes: run lola run?

1:32 sdegutis: Raynes: sums up their whole attitude

1:32 Raynes: callen: wat?

1:32 callen: Raynes: that's the Golang approach to everything.

1:32 sdegutis: yep

1:32 callen: Raynes: the gif

1:32 Run Lola Run right?

1:32 Raynes: Scott Pilgrim Vs. The World.

1:32 callen: oh

1:32 damn.

1:32 all gingers look alike.

1:32 technomancy: that a good gif

1:32 Raynes: lol

1:33 callen: it's a very expressive gif.

1:33 Raynes: She was a very expressive girl.

1:34 sdegutis: i think the part about the Go community that gets me is how condescending they are about not *needing* anything else.

1:34 callen: sdegutis: they're an off-shoot of the Suckless community which was basically a coven of weirdo Unix ascetics.

1:35 sdegutis: their attitude feels like "yeah we dont need [whatever feature] because we're smart, and if you need them you're not smart". its just kinda off putting

1:35 callen: who basically didn't believe themselves to need anything other than a hatchet, bit of rope, some flint, and a C compiler.

1:35 technomancy: callen: I can see the appeal of that ethos

1:35 callen: I like the suckless community's software but zomg the people are obnoxious.

1:35 technomancy: suckless has some hot shit

1:35 callen: technomancy: compiling their software is nice. you just run a script and it poops out a binary.

1:36 usually takes one second or less.

1:36 technomancy: no autotools <3

1:36 brehaut: technomancy: its sad that that is worthy of a <3

1:36 * sdegutis is unmotivated

1:36 callen: technomancy: precisely.

1:37 bbloom: static linking for deployment == magical awesomeness

1:37 hence the giant p4 trees :-P

1:37 callen: technomancy: I generally use a bash script or scons for my C and C++ builds.

1:37 sdegutis: how do you motivate yourself to work on work when it screams "im too hard" at you?

1:37 technomancy: bbloom: static linking by default is great, but completely disallowing any kind of loading at runtime is terrible

1:37 callen: bbloom: I'm a huge fan of static linking as well which is why I'm not a little bit envious of Golang's toolchain. I'm hoping Rust coalesces into something usable soon.

1:37 bbloom: technomancy: i would agree, except it makes perfect sense in google's case

1:37 callen: bbloom: know any other alternatives on that front? I don't like using C or C++ for my miscellaneous tools and mid-tier stuff anymore.

1:38 bbloom: and go isn't for you, it's for google & companies like google

1:38 sdegutis: bbloom: they sure did try hard to make me believe otherwise

1:38 technomancy: bbloom: it's settled then

1:38 callen: sdegutis: golang is oversold. I agree with bbloom on whom Golang is for.

1:39 sdegutis: i'd agree.

1:39 i just dont think they advertise that properly

1:39 callen: I really would like an option for generating statically linked binaries that wasn't OCaml or Golang :(

1:39 sdegutis: so i wasted a year trying to get something useful out of it.

1:39 and maybe i did.

1:39 callen: I spent a similar amount of time trying not to hate it. no dice.

1:39 technomancy: callen: I'd settle for a library ecosystem and build tool for ocaml =P

1:40 callen: technomancy: I guess, I'm just pissed about concurrency still and would rather just build for the "future" by investing in Rust

1:40 bbloom: technomancy: considering you have experience writing such a system….

1:40 sdegutis: callen: did you write your own generic versions of map/filter/etc in it using pkg/reflect?

1:40 callen: technomancy: my only reservation there would be that Steve Klabnik likes Rust and anything Steve Klabnik likes I am deeply suspicious of.

1:40 technomancy: callen: I already have a good language to use for when I care about concurrency though

1:40 bbloom: i don't really trust mozilla to produce anything cutting edge w/o it being "researchy" in that it never is useful

1:40 callen: sdegutis: who doesn't that's used an FP lang before? :P

1:40 technomancy: I need compact concurrent binaries. :(

1:40 technomancy: I just want something for places the JVM doesn't fit

1:40 bbloom: but rust does look interesting & i'm following it

1:41 technomancy: and concurrency is usually not an issue in constrained cases

1:41 callen: technomancy: makes sense. I'd like something a little more general for JVM-inappropriate stuff.

1:41 sdegutis: now, not to be too agist here, but im starting to think that people over 45 just dont know how to program in anything other than C.

1:41 bbloom: technomancy: bootstrap your own forth! ;-)

1:41 technomancy: bbloom: actually considering that, but just for arduino

1:41 callen: technomancy: well my use-cases extend from small tools to internal microservices (need conc) to bigger tools (need conc)

1:42 sdegutis: yeah, it's ageist.

1:42 sdegutis: i know thats not strictly true, since i know many people who use Clojure are that age or older.

1:42 callen: sdegutis: I've gotten greybeards into all kinds of things.

1:42 including meth

1:42 technomancy: clojurebot: kids these days &c

1:42 clojurebot: Get off my lawn!

1:42 sdegutis: but the vast majority of people i know who prefer writing in C (or Go) turn out to be at least 45.

1:42 callen: sdegutis: I know a lot of aspiring 20-something unix-beards that write Go.

1:43 technomancy: clojurebot: botsnack!

1:43 callen: technomancy: nice pet.

1:43 clojurebot: Thanks! Can I have chocolate next time

1:43 callen: LOL

1:43 technomancy: callen: sometimes I forget that he's not rudybot

1:43 sdegutis: srsly, how do you motivate yourself to work when your day job is way too overwhelming?

1:43 * sdegutis sighs

1:44 callen: Rust package management documentation: https://github.com/mozilla/rust/wiki/Doc-using-cargo-to-manage-packages

1:44 yes, it's a stub.

1:44 sdegutis: I get home at 7:30, errands and gym until 10, code until 11:30 or 12, then sleep.

1:44 sdegutis: you just develop a routine and become consistent.

1:45 sdegutis: google, jerry seinfeld don't break the chain

1:45 of course, I don't have a family like some in this channel, so that's partly how I'm able to get away with that.

1:45 * sdegutis is married with 4 kids

1:46 callen: plenty of successful and prolific people with family and kids. It's no excuse.

1:46 just less breathing room to waste time.

1:46 sdegutis: yeah i had to cut out TV and video games completely from my routine a few years back, just no time

1:47 callen: my Steam queue is absurd. :(

1:47 sdegutis: fix it

1:48 callen: I explicitly do not want to play that many video games.

1:49 sdegutis: you've obviously never played Halo 1 for PC in online multiplayer mode

1:49 callen: I have

1:49 I don't think you understand what I mean by Steam queue

1:49 I have a Steam account with ~300 games of which I've only played 10-15%

1:49 sdegutis: ah, i misread as Stream queue

1:49 whoa.

1:50 callen: I am not going to wrap up that queue in the next 10 years.

6:17 ndunbar: is there some magic to getting midje autotest working with nrepl mode in emacs?

6:17 If I run (autotest) it works, but then doesn't seem to monitor any files

6:17 which change

6:18 ie, and retest the facts governing that stuff

6:19 using (require '[midje.repl :refer :all]) followed by (autotest), btw

6:34 nvm - it looks like a lot of midje-mode is hooked into slime, and I'm using nREPL

6:34 probably means that the integration isn't quite as neat as with clojure-test-mode

6:50 noncom: hi, when i am trying to call (clojure.edn/read), I get CompilerException java.lang.ClassNotFoundException: clojure.edn am I missing a dependancy?

6:50 llasram: noncom: Have you `require`d the `clojure.edn` namespace?

6:51 noncom: nope

6:51 llasram: Well there you go

6:51 noncom: but i thought that it was the fully-qualified name and it doesnot need require...? wrong, yeah/

6:51 ?

6:52 Bronsa: yes, the namespace still needs to be loaded

6:52 llasram: Namespaces need to exist before you can invoke their functions. You can make a fully-qualified reference whether or not you've `require`d it from a *particular* namespace or not, but the referenced namespace still needs to be loaded

6:57 noncom: i see, thanks, guys!

7:39 jtoy: if i had fields = [:a :b] and then a collection, how would I collect all the fields from the collection, my mind is getting stuck ,something like (map #(map (fn[x] (x %) fields) coll) is there a simpler way?

7:40 llasram: ~juxt

7:40 clojurebot: juxt is a little hard to grok but it's the best thing ever

7:40 ro_st: (map (juxt :a :b) coll)

7:40 :b

7:41 : -ing b.

7:41 i really should disable smileys in adium

7:41 Anderkent: obligatory 'use irssi' comment

7:41 llasram: Or just "or use an IRC client" :-)

7:43 jtoy: &(map (juxt :a :b) [[:a 1 :b2][:a 5 :b 7]])

7:43 lazybot: ⇒ ([nil nil] [nil nil])

7:43 jtoy: &(map (juxt :a :b) [[:a 1 :b 2][:a 5 :b 7]])

7:43 lazybot: ⇒ ([nil nil] [nil nil])

7:43 Anderkent: vectors arent indexable by keys like that

7:43 ro_st: {:a 1 :b 2}

7:43 not []

7:43 Anderkent: &(map (juxt :a b:) [{:a 1 :b 2} {:a 5 :b 6}])

7:43 lazybot: java.lang.RuntimeException: Invalid token: b:

7:43 jtoy: &(map (juxt :a :b) [{:a 1 :b 2}{:a 5 :b 7}])

7:43 lazybot: ⇒ ([1 2] [5 7])

7:43 Anderkent: fgagth

7:43 jtoy: &(map (juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])

7:43 lazybot: java.lang.IllegalArgumentException: Key must be integer

7:44 Anderkent: apply juxt

7:44 :)

7:44 jtoy: &(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])

7:44 lazybot: ⇒ ([1 2] [5 7])

7:44 jtoy: hmm, I dont really understand how to use apply

7:44 but cool

7:44 ro_st: yes, you do

7:44 Anderkent: you use apply whenever you want to use a list of args to a function instead of putting the args one by one

7:44 ro_st: (+ 1 2) = (apply + [1 2])

7:45 Anderkent: (apply juxt [:a :b :c :d :e :f]) is equivalent to (juxt :a :b :c :d :e :f)

7:45 jtoy: ah, that is much clear definition than clojrue docs i think

7:45 (doc apply)

7:45 clojurebot: "([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."

7:45 Anderkent: i.e. you're applying a function to a list of args

7:45 ro_st: well, the doc also talks about how you're able to supply individual args before the seq you supply

7:45 Anderkent: well, because it has to handle the case where you're specifying some args manually and putting the rest in a list :P

7:45 ro_st: which is rather critical to making it a swiss army knife

7:46 Anderkent: that's useful because otherwise you'd have to do (apply (partial function first second third) [fourth fifth sixth])

7:46 which is ugly :)

7:53 jtoy: so i am using apply juxt, is there a clean way to do this simple transfomr without 2 maps: (map #(str "[" (clojure.string.join "," %) "]" ) (map (apply juxt fields) data))

7:54 doesnt look like it

7:56 ro_st: (map #(->> % (juxt fields) (string/join ",") (format "[%s]")) data)

7:58 jtoy: ro_st: cool, that is really nice, didnt even know about format

7:58 ro_st: cemerick! interested to see that you're working on 'su' support in friend. i see it's still in progress. is there something to see, yet?

8:00 cemerick: ro_st: no...but "working on" is deceptive. ;-) It really should be ~10 lines to implement, tho.

8:01 ro_st: cool. we have this as 'impersonation' in our system and it's been indispensible to us

8:01 be great to have it in friend, as well.

8:01 i'm surprised that remember-me hasn't been added yet. people must prefer not to do that!

8:04 wunki: when I run `lein deploy` to my S3 repository, Leiningen only deploys jar's including the date. But `lein deps` tries to find them without date.

8:04 E.g, `gibbon-api-0.1.0-20130801.111350-1.jar` is available but lein deps searches for `gibbon-api-SNAPSHOT.jar`

8:05 anyone know what I did wrong in my `project.clj`?

8:08 TEttinger: wunki, did you try lein jar first? I'm not sure what type of deps these are

8:08 Anderkent: wunki: would be easier if we saw the project.clj. It sounds like you're deploying a non-snapshot build, but your dependency is a snapshot

8:11 wunki: Anderkent: I'm deploying with this: https://gist.github.com/wunki/6b5faa5f2ee6fa2f257a

8:11 TEttinger: `lein jar` doesn't change anything for `lein deploy`

8:12 Deploying with `lein deploy "gibbon-snapshots" works btw, this is the output:

8:12 llasram: So how are you trying to depend on it?

8:12 wunki: https://gist.github.com/wunki/29cbb36955aeca958436

8:13 as you can see in the above, it only upload the .jar with the data attached

8:13 in another project, I depend on it like this:

8:14 https://gist.github.com/wunki/4af6b68fcf9f0f39182f

8:14 Anderkent: wunki: is your s3 repository marked as allowing snapshots?

8:15 cemerick: ro_st: remember-me is a dubious feature; there have been some ranty blog posts about it compromising security, which I haven't investigated/thought about hard enough to decide either way. Also, demand for it lessens every day oauth/openid/browserid is available.

8:15 wunki: Anderkent: dunno, how could I check?

8:16 Anderkent: wunki: hm, my bad, seems lein should derive whether that's a snapshot or not based on your version string.. Curious, looking into it

8:18 wunki: can you post output from the deploy run that pushes wrong versions?

8:18 llasram: There's no wrong versions

8:18 wunki: Anderkent: https://gist.github.com/wunki/4af6b68fcf9f0f39182f

8:18 Anderkent: prefferably from DEBUG=1 lein deploy

8:19 llasram: That's how SNAPSHOT dependencies look "for real" -- a timestamp

8:19 Anderkent: llasram: oh, didn't know that

8:19 so it seems the problem is that it's not consulting the private repo for snapshot releases

8:19 right?

8:19 clojurebot: technomancy: you're right I should explain the reason. The reason is I would like to be able to call aether with an extra parameter for introducing my own :transfer-listener.

8:19 jtoy: (map #(->> % (juxt [:a :b]) (string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])

8:19 llasram: thanks, clojurebot !

8:19 jtoy: &(map #(->> % (juxt [:a :b]) (string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])

8:19 lazybot: java.lang.RuntimeException: No such namespace: string

8:20 jtoy: &(map #(->> % (juxt [:a :b]) (clojure.string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])

8:20 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$juxt$fn__4053

8:20 jtoy: &(map #(->> % (apply juxt [:a :b]) (clojure.string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])

8:20 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$juxt$fn__4055

8:20 llasram: jtoy: you're calling `juxt` wrong

8:21 Anderkent wunki: does it help to add an explicit `:snapshots true` to your private repository map in the depending project?

8:21 Anderkent: I'd expect that to help, yeah

8:21 wunki: llasram: let me try

8:21 llasram: Oh, and maybe `:update :always`

8:21 jtoy: llasram: what is wrong? this one works: &(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])

8:21 &(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])

8:22 &(map (apply juxt [:a :b]) [{:a 1 :b 2}{:a 5 :b 7}])

8:22 lazybot: ⇒ ([1 2] [5 7])

8:23 Bronsa: jtoy ##(map #(->> % ((apply juxt [:a :b])) (clojure.string/join ",") (format "[%s]")) [{:a 1 :b 2}{:a 5 :b 7}])

8:23 lazybot: ⇒ ("[1,2]" "[5,7]")

8:23 wunki: llasram Anderkent: `:update :always` did the trick

8:23 llasram: jtoy: Yes, but that's not how you're calling it with `->>`. That's just sticking it as the last arg

8:23 wunki: Awesome!

8:23 wunki: llasram: any idea why I _need_ to set it explicitly?

8:24 Anderkent: wunki: I suppose the default is :daily

8:24 llasram: I think so too

8:24 Anderkent: i.e. it only checks for new snapshots once a day

8:24 llasram: The maven repo format (oddly, for the java-verse) is designed for simplicity over e.g. metadata efficiency

8:24 and checking for new snapshots involves crawling the whole (sub-)directory tree

8:24 Anderkent: (that's because without it if you have a snapshot dependency any command will cause a roundtrip for checking each snapshot dep, thus slowing stuff down)

8:25 jtoy: Bronsa: why is the second parens needed?

8:25 wunki: llasram Anderkent: thanks a lot for your help guys

8:25 Anderkent: jtoy: because (->> something (apply juxt [:a :b])) means (apply juxt [:a :b] something

8:26 whereas what you want is ((apply juxt [:a :b]) something) , or ((juxt [:a :b]) something) - juxt returns a function that you need to call with your 'something'

8:27 jtoy: i see

8:46 ro_st: jonasen: i'm the tirekicker on your datalog thing :-)

8:50 jonasen: ro_st: Thanks for your participation

8:51 ro_st: my pleasure!

8:51 jonasen: keep the suggestions coming :)

8:51 ro_st: thanks for putting this together!

8:51 i totally didn't know about the relations destructring. [[?one ?two]]. that's really handy

8:52 there are a number of typos best dealt with as a PR. so when you decide you can take those, i'd be happy to do a proof edit for you too

8:52 jonasen: yeah, I'm sure there are hundreds

8:53 ro_st: are you planning a Learn Datomic Transactions Today! too?

8:55 jonasen: ro_st: I've been thinking about it... but no concrete plans

8:55 ro_st: it'd be totally worth it. perhaps we can collaborate. there are plenty of useful things to know about transacting

8:56 writing stuff directly to the in-situ transaction entity is a particularly nifty one

8:56 jonasen: ro_st: sure!

8:57 ro_st: query's working now. awesome!

8:57 i'll do all the examples soon

8:57 jonasen: great!

8:58 snake-john: just one diatomic question. when i get a datomic connection with (def db (d/db conn)) and then afterwards update some entity attrib and they query agains this old db var do i get the new attribute?

8:58 ro_st: no

8:58 at that point, db is an immutable value

8:59 you'd have to get a fresh db with (d/db conn)

8:59 snake-john: so i then need to do a (d/db conn) again ?!

8:59 ro_st: :db-after in the map returned by (d/transact) also contains the new db

8:59 snake-john: ok thanks ! I understand ! thanks

9:00 ro_st: you can just use (defn db [] (d/db (conn))) and (db) in all your queries

9:00 to automatically work against the 'now' database

9:00 there's no performance penalty to doing so. it's just a pointer to a transaction in the db

9:00 in the index*

9:01 snake-john: thanks a lot !

9:01 ro_st: this is what makes it awesome, by the way. this means you CAN grab a db reference and work against it without the 'world' changing under you

9:02 tbaldridge: snake-john: that being said, doing what ro_st suggests isn't really the *best* way. As much as possible, deref once and query multiple times

9:03 snake-john: if i use the free edition.. can I store the data somewhere permanently or is it just in memory?

9:03 tbaldridge: For instance, in a ring based REST service I wrote, I dereffed the DB once, inside a middleware, so every query executed by a single REST request will use the same copy of the DB

9:03 snake-john: Free supports disk storage on the local disk

9:03 ro_st: i recommend playing with building transactions up with (for) etc and then using (def try-db (d/with (db) the-tx). this gives you an in memory copy of the database *as though* the transaction had been committed, which you can then query against (d/q '[…] try-db)

9:04 tbaldridge: yup. thanks for mentioning that

9:07 snake-john: just guessing so the disk storage could make it appear faster then going with sql server storage? (since the sql server obviously would add some overhead)

9:07 ro_st: only for initial cache filling. after the cache is warm, it wouldn't matter much

9:08 any new data coming in while the peer is connected receives it directly from the transactor as it's transacted. this would only matter for data that's in storage when the peer starts up

9:09 this is important if you're using continuous deployment and your peers restart all the time. this is why PRO's memcached support is so useful

9:13 snake-john: ro_st: maybe you know? did garbage collection ever hit you when running datomic? I am just guessing that it could be a problem with all that happening in memory?

9:15 ro_st: our databases haven't yet exceeded the available ram :-)

9:15 and we also deploy multiple times a day

9:15 suffice to say, we're going to keep our memcached server(s) well supplied

9:17 snake-john: how much ram?

9:18 ro_st: our databases are just shy of 2gb. we've more than that on the server

9:30 tsdh: I'm just refactoring a project to drop (:use ...) in ns declarations and to use (:require ... :as ...) instead. Is there a (lein) way of just loading all namespaces? Running the tests works, but those take quite some time...

9:31 ro_st: check out bultitude

9:31 tsdh: Ad, even simpler: "lein check" seems to do what I need.

9:31 ro_st: you can glob all the namespaces using a string pattern and then iterate over them doing (require)

9:31 oh, you just wanted to compile everything? yeah, lein check :-)

9:32 tsdh: ro_st: Yeah, that's enough right now.

9:49 bja: can I generate a function or a macro that actually returns two expressions? I think that I cannot, but I want to see if I'm missing something

9:49 nDuff: bja: what are you trying to accomplish?

9:49 bja: simple template replacement with hiccup

9:50 but I think I need to go above

9:50 i.e.

9:50 nDuff: bja: well, you can return a list with two expressions and splice it in.

9:50 ro_st: return a list and use destructuring

9:51 (let [[one two] (your-function args)] …)

9:51 bja: [:body [:label][:input] [:label][:input]] seems like I'm rewriting [:label][:input]

9:52 well, rewriting it a lot

9:52 and it would be nice to say (for [x (range N)] ...[:label] [:input]....)

9:53 ro_st: [:body (for [[label id] [["Name" "name"] ["Email" "email"]]] (list [:label label] [:input {:id id :type "text"}]))]

9:53 bja: ro_st: err, yes. I can do that if those are the only things in the body

9:54 ro_st: you can put more stuff before and after the (for)

9:54 bja: I suppose I'm probably going to have to replace my top level [:body] with something that generates a body for me

9:54 ro_st: last para and code sample on https://github.com/weavejester/hiccup

9:57 atyz: Sup y'all

10:05 bja: ro_st: thanks. I don't know what I was doing last night, but I swear I tried passing hiccup a list of vectors for it to automatically expand (like the docs mention), but I couldn't get it to work. thanks again.

10:11 speedwagon2: Hi! When I nrepl-jack-in or start lein repl from emacs, my JAVA_OPTS are ignored (I need more heap space). When I start from the command line (i'm under windows) they are correct. Where can I find documentation ?

10:12 ro_st: put :jvm-opts ["-Xmx2g"] into ~/.lein/profiles.clj

10:12 use your own value, of course

10:13 speedwagon2: Ok, I will try that out. Thank you

10:14 ro_st: if you don't have such a file yet, your whole file's contents will be: {:jvm-opts ["-Xmx2g"]}

10:14 duck1123: Is there a way, given a symbol representing a namespace, to require that namespace and warn/ignore if the file doesn't exist, but fail on any other error from loading that ns?

10:15 ro_st: bultitude might have a tool for testing for the existence of an ns

10:15 we use it to glob for ns's by string pattern and then iterate over them with require

10:16 duck1123: This looks like it should get me started. thanks

10:16 Anderkent: well, you can just check if 'package/names/namespace.clj' or the respective class files are on the classpath even if bultitude doesnt do it for you. Or if you just need a quick hack, do (try (require symbol) (catch FileNotFoundException (probably-not-available-unless-ns-compilation-throws-file-not-found))

10:17 duck1123: I was looking into tools.namespace and didn't find what I wanted

10:17 ro_st: the FileNotFound exception thing looks promising, too, nice Anderkent

10:17 Anderkent: trying hard for them internet points

10:17 duck1123: Anderkent: problem with that is if the required ns throws a filenotfound on one of it's deps, it won't fail

10:18 Anderkent: duck1123: right, that's true.

10:29 konr: Can't I add metadata to a string? (with-meta "foo" {:bar :baz}) fails

10:33 `fogus: konr: No, strings are out. http://clojure.org/metadata

10:33 duck1123: konr: Strings can't accept metadata. The type has to have support for metadata and strings do not. They're also final, so can't be subclassed

10:33 ro_st: `fogus: how applicable is functional javascript to someone who only ever plans to do clojurescript from now on? :-)

10:34 `fogus: ro_st: You've already achieved enlightenment. No need to go backwards.

10:35 ro_st: thought so. just checking -grin-

10:35 i tried to do JS again the other day. i cut myself on all the underscores and semi-colons

10:37 duck1123`: Don't forget the mandatory commas to separate list items...

10:37 ro_st: yuck

10:37 augustl: functional programming with mutable data, oh joy

10:38 `fogus: It's only mutable if you mutate it. ;-)

10:38 snake-john: fogus: I have the joy of clojure book and also the "2 edition MEAP" : Since I prefer reading books can I read the book and only the chapters of the MEAP not included in the book. Or would you suggest I stick to the MEAP pdf because maybe you have updated a lot?

10:39 ro_st: the structural sharing in clojure's data structures make a biiiiig difference

10:39 ToxicFrog: MEAP?

10:39 clojurebot: Manning missed the opportunity to call it Manning Early Access Trial

10:39 pjstadig: haha that's still in there

10:39 augustl: ro_st: I'm planning on using mori in my next js project. I've found that immutable values is what empowers me the most in Clojure

10:40 `fogus: snake-john: It's not likely to change much from this point (except for the still-in-progress CLJS chapter), so you can read now if you'd like

10:40 ro_st: augustl: that's awesome, but why js?

10:40 whhhhyyyyyy

10:41 augustl: ro_st: mostly just convenience, not having to have a compile step, deal with source maps, etc

10:41 `fogus: ro_st: Absolutely (re: sharing)

10:41 snake-john: focus: thanks for the info!

10:41 ro_st: augustl: we obviously have different ideas about what convenience means -grin-

10:41 augustl: haha, zing :)

10:42 speedwagon2: :ro_st It looks like the ~/.lein/profiles.clj is ignored. At least i see no success and (println (.getInputArguments (ManagementFactory/getRuntimeMXBean))) shows no success either.

10:42 augustl: I also end up with a build step anyway, for deploying minified code to CDNs.. So yeah.

10:42 ro_st: speedwagon2: lein version

10:42 augustl: lein cljsbuild auto dev. boom.

10:42 i've not needed a sourcemap once, yet

10:43 speedwagon2: Leiningen 2.2.0 on Java 1.7.0_21 Java HotSpot(TM) 64-Bit Server VM

10:44 augustl: ro_st: I'm out of reasons, seems my next project will be cljs :)

10:44 ro_st: speedwagon2: hmmm. it should work. i'm not sure what else to suggest

10:44 augustl: my pleasure -grin-

10:45 speedwagon2: I think I will search for an answer later. It is just for one short project.

10:45 `fogus: One advantage of being intimately familiar with the CLJS compiler is that I can debug the generated code and map it back in my head to the CLJS source. I wouldn't wish that one anyone however. Source maps are a "good thing"

10:46 ro_st: i find the :simple output quite readable

10:47 augustl: oh nice, does it magically decomplect your code? :P

10:47 ro_st: in that it maps quite closely to the clj source. you do bash your head a couple times, but you quickly learn what errors mean what

10:48 could not call method 'foo' of undefined usually means a missing require, for example

10:49 i must admit, having hand-coded google closure javascript for 8 months prior does help a little

10:49 ToBeReplaced: is there a tentative release date for core.async?

10:50 ro_st: release in what sense? i thought it was already useable?

10:51 ToBeReplaced: only snapshots so far

10:51 ro_st: ah

10:51 squidz: get in allows to pass an index for array values like (get-in mv [:pets 1 :type]) where 1 is the first map in the array of objects- :pets. Is there a way in clojure to get all the objects values instead of just specific ones specified with indexes?

10:51 tim_: ToBeReplaced: not really...but there's no issue with running the snapshots is there?

10:51 you can grab them from sonatype

10:51 squidz: example is here in line 35 http://clojuredocs.org/clojure_core/clojure.core/get-in

10:53 ro_st: squidz: so you want all the :type values in all the maps in the :pets vector?

10:53 ToBeReplaced: no problem for hacking, but for releasing

10:53 squidz: ro_st: yes

10:53 ro_st: (map :type (:pets thing))

10:54 squidz: oh right duh thanks

10:55 speedwagon2: :ro_st I changed the profiles.clj to {:user {:jvm-opts ["-Xmx2g"]} } and it seems to work in the windows shell, but not in emacs. Still no success under emacs. What is the difference between nrepl-jack-in and M-x shell lein repl anyway?

10:56 ro_st: speedwagon2: what if you lein repl and then jack into the existing process from emacs?

10:56 ie, with M-x nrepl

10:57 speedwagon2: I will try that.

10:57 ro_st: i generally start repls from the terminal so that i can see std-out output there and then jack in

10:58 good luck, speedwagon2!

11:00 functionform: if loop should always be used with recur, why isn't there a loop-recur macro or something similar - or is thatwhat for is?

11:01 speedwagon2: Hooray, everything works.

11:01 functionform: i tried peeking at the for code, but it is tough to follow

11:03 llasram: functionform: No, `for` produces lazy sequences

11:03 duck1123: what would a loop-recur macro do? You don't exactly know where in the form your recur will appear. (aside from in a tail position)

11:04 jtoy: can anyone recommend a simple way to take x from a coll, and if there is not x then take the rest from another collectino, like (take-n 3 [1 2] [11 22 33 44 55]) => (1 2 33)

11:04 llasram: jtoy (take n (concat a b))

11:05 Oh, not quite: (take n (concat a (drop n b)))

11:06 duck1123: ,(let [a [1 2] b [11 22 33 44 55]] (take n (let [ca (count a)] (concat a (drop ca b)))))

11:06 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: n in this context, compiling:(NO_SOURCE_PATH:0:0)>

11:07 duck1123: ,(let [n 3 a [1 2] b [11 22 33 44 55]] (take n (let [ca (count a)] (concat a (drop ca b)))))

11:07 clojurebot: (1 2 33)

11:08 llasram: Yeah, really shouldn't answer questions unless I'm going to pay full attention

11:08 (incn duck1123)

11:08 (inc duck1123)

11:08 lazybot: ⇒ 5

11:08 technomancy: duck1124

11:09 llasram: lol!

11:10 jtoy: &(take 2 (concat [1] (drop 2 [3 4 5])))

11:10 lazybot: ⇒ (1 5)

11:11 jtoy: thanks

11:31 gfredericks: kind of unfortunate that ##(doc partition) doesn't mention partition-all

11:31 lazybot: ⇒ "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complet... https://www.refheap.com/17111

11:32 llasram: gfredericks: Just submit a pull reqjira

11:34 I wonder how much fragmentation would result from a "community fork" of Clojure which focused on documentation improvements, bug fixes, usability, and easy of contribution

11:34 pjstadig: yeah, i'm not sure it would be worth it

11:34 better to keep the community together i guess

11:34 not that I or others haven't considered it

11:34 antares_: llasram: unfortunately, it's unlikely to take off because its authors won't have superior hair

11:35 devn: technomancy: syme is borked. I don't have time to look into it at the moment but it looks like it's blowing up in syme.instance/create-security-group: 2013-08-01T15:11:18.142752+00:00 app[web.2]: java.lang.IllegalArgumentException: No matching field found: getErrorCode for class java.lang.NullPointerException

11:35 llasram: The hair is a definite issue

11:36 tbaldridge: llasram: doc fixes are normally accepted verbatim. At least that's been my experience with JIRA and docs.

11:36 *Clojure's JIRA

11:37 antares_: tbaldridge: from the priviliged developers living in teh USA or Western Europe, that is

11:37 others have to wait for months before they can contribute a trivial one line fix

11:38 tbaldridge: There it is...I was waiting for the obligatory comeback. Can we add that comment to lazybot or clojurebot? It'd save the community a ton of time :-P

11:39 antares_: :)

11:41 svedubois: Hello, I would like to obtain from this input: 7 (0 4 3), the output 7.

11:42 I tried this:

11:42 print "7 (0 4 3)" | awk '{for(i=1;i<=NF;++i) if($i~!/\(*\)/) print $i}'

11:42 but the result is (0

11:42 and not 7

11:42 llasram: svedubois: You may be on the wrong channel

11:42 tbaldridge: svedubois: wrong chat room?

11:42 svedubois: Yes,

11:42 sorry

11:42 tbaldridge: it's ok, it's your first offence

11:43 *offense

11:43 next time we charge you $0.25 USD

11:43 gfredericks: llasram: ha

11:45 tbaldridge: it feels bulky to create an entire ticket for one doc fix -- is that the normal approach?

11:46 bhauman: antares_: are you living in Argentina? I ask because Antares is a beer there.

11:46 tbaldridge: yep. Patch to clojure has to be written by someone with a CA, every change has to be approved by Rich. JIRA is the way all that's tracked

11:46 antares_: bhauman: Moscow, Russia

11:47 bhauman: antares_: well at least you guys have Snowden

11:48 antares_: bhauman: I wish Snowden had a way to let me contribute to Clojure easily, without all this idiocy with mailing pieces of paper to North Carolina

11:48 but alas

11:48 bhauman: antares_: I'm in North Carolina and I can't imagine it would be easier for me :)

11:49 tbaldridge: It all comes down to copyright/patent law. When stupid things in America exist like patents, it's best to err on the side of too much protection. See for instance how Microsoft gets $5 for every Android phone sold.

11:49 antares_: tbaldridge: oh come on, how many OSS projects don't have this kind of bs?

11:49 please don't tell me it's the only way

11:49 lets face it, mr. Hickey is fucking paranoid

11:49 bhauman: tbaldridge: I wish you hadn't let me know that - day ruined

11:49 antares_: and Clojure/core does not care about improving the situation

11:50 tbaldridge: antares_: that doesn't mean that they can't be sued to oblivion if someone cared enough about them

11:50 piranha: because they all have signed already :))

11:50 antares_: piranha: exactly!

11:50 tbaldridge: does that happen in practice?

11:50 tbaldridge: for that matter, what does a stamp cost (weekly wages wise) to send something to NC from Russia, I'm curious, as I've heard tons of people complain about it.

11:51 antares_: tbaldridge: how many cases of OSS language implementators being sued can we name?

11:51 tbaldridge: you have two ways, either a cheap but unreliable and *really* slow regular snail mail (2+ months estimates) or $220 for fedex and such

11:51 piranha: tbaldridge: it's either a lot (if you use FedEx/DHL) or you have a *very* high chance that your mail will never arrive anywhere :)

11:52 antares_: and the situation is very much the same in India and Brazil, I know from friends there

11:52 piranha: antares_: you should just give a mail to somebody going to Europe and get them to send it, hehe :-)

11:52 tbaldridge: interesting. I just remember the old days, sending letters to Turkey (my sister had a pen pal), it was what...$0.70 back in the mid 90's?

11:52 piranha: tbaldridge: but yeah, you see, it's quite cumbersome situation

11:53 Anderkent: Why does it have to be snail mail and not for example a pgp-signed statement, or scanned doc / fax? Doesn't seem like it gives any security improvements

11:54 antares_: Anderkent: some believe lawyers only trust cold hard paper

11:54 tbaldridge: Anderkent: like I said, outdataed US copyright/patent law

11:54 piranha: tbaldridge: well sending a mail from ukraine to netherlands costs around 3 dollars and it arrived in a week or so, but it's a bit better here, russian post is the worst :)

11:54 nDuff: US law gives faxes privileged status.

11:54 tbaldridge: remember, we're the people that consider corporations to be "people"

11:55 nDuff: ...so a PGP-signed statement or an email I can grok being a problem; a fax, not so much.

11:55 Anderkent: well, maybe clojure should run away and get asylum somewhere more reasonable... :P

11:55 tbaldridge: Eh...US copyright law applies most other places as well (or more correctly the less strict laws of other countries don't always apply here)

11:55 Anderkent: to the moon we go!

11:58 antares_: nDuff: I have never used faxes, how do you put a signature on it?

11:58 there are PDF-to-fax kind of services that are really cheap and easy to use, I know as much

11:59 nDuff: antares_: by printing the document, signing the piece of paper it's printed on with a pen, and then putting the signed document in a machine that both scans it and sends the fax.

11:59 Anderkent: you print it out, sign it, then fax it somewhere. Or print, sign, scan, email to someone who has a fax :P

11:59 boodle: Can someone point me to a non-atomic way to mute a map nicely: https://www.refheap.com/17112

11:59 antares_: nDuff: ok, so basically by scanning first

11:59 justin_smith: I think the idea with a "normal" fax you are expected to feed a piece of paper in (that has been signed in this case)

12:00 Anderkent: boodle: did you try update-in ?

12:00 antares_: boodle: assoc, update-in, merge?

12:01 boodle: Anderkent: the trouble is I need to do comparisons before updating.. and continue with the (potentially) updated map onto the next comparison

12:01 CookedGryphon: boodle: that code is gaining nothing from the atom if you use reset instead of swap

12:01 boodle: and there should never ever be a def inside a defn

12:01 boodle: Anderkent: I know if could do it via a bunch of if-lets but would get kludgy too

12:01 antares_: boodle: well, still you should probably use assoc instead of reset! + merge

12:01 justin_smith: boodle: also, def inside defn is almost always wrong - especially if the value of the def is what you are returning; use let

12:02 boodle: Ok, hehe I get it on the def inside defn (borks my vim folds too!)

12:02 antares_: boodle: or swap, if you need to update an atom

12:03 piranha: boodle: https://www.refheap.com/17113 something like this?

12:04 boodle: I'd like to use let but would end up with longer if-lets I think. Case/Cond won't pass updated values along either.. and can't recurse a call because the conditions still hold ("stock" e.g.)

12:04 piranha: thank you!

12:04 piranha: maybe moving condition function to let will make it look nicer...

12:04 boodle: piranha: but (-> is what I need I think

12:05 Anderkent: the first condition doesnt look that well in update-in

12:05 piranha: boodle: sure :)

12:05 Anderkent: indeed, I think extracting it to let or to real function will make it look nicer

12:06 boodle: yep I'll write a "update-in-if" fn to wrap it nicely

12:06 Anderkent: I think I'd prefer https://www.refheap.com/17115

12:07 just to keep it simple

12:07 boodle: Anderkent: I wanted to avoid all the "p"'s in the 'else' portions

12:07 justin_smith: boodle: another approach https://www.refheap.com/17114

12:08 mine is not as good as piranha's actually

12:08 Anderkent: boodle: right, it's a little messy but it's a pretty common thing and at some point it just becomes boilerplate that you gloss over

12:08 boodle: justin_smith: sure. I kind of like pirahna's with a wrapper fn which then gets more to the core logic being clear

12:12 instilled: hi! I have a macro that generates two definitions (def …) where the latter depends on the former. When I invoke the macro I get an exception that (the latter) is unable to resolve the symbol defined in the former. Am I missing the obvious?

12:12 technomancy: clojurebot: gilardi scenario

12:13 clojurebot: The Gilardi Scenario is where you can't compile a form because the form contains definitions needed to compile itself: http://technomancy.us/143

12:13 technomancy: instilled: ^ you're running into that

12:14 instilled: technomancy: cheers, will read through your article!

12:15 hiredman: instilled: before you do that I recommend macro expanding your macro to see if you get what you think you'll get

12:19 clj_newb_2345: are there any online collaborative efforts for newbs to together-read open source clojure projects?

12:24 instilled: technomancy: nice article! that definitely solved my problem.

12:24 thanks.

12:25 technomancy: instilled: it's a tricky one

12:44 daydreamt: r

12:44 kmicu: s

12:50 pjstadig: t

12:50 gfredericks: u

12:51 justin_smith: ,(char 118)

12:51 clojurebot: \v

12:52 squidz: does anybody here that is using the strokes library have an idea why using maps passed to the (.attr {:class "smth"}) doesnt work?

13:09 dnolen: new blog post, CSP is Responsive Design - http://swannodette.github.io/2013/07/31/extracting-processes/

13:10 feel to upvote on HN if you feel so inclined

13:11 tbaldridge: will up vote first, then read

13:11 kmicu: I read it few days ago. Good writing.

13:11 seangrove: Upvoted

13:13 bhauman: upvoted but it didn't take

13:14 squidz: cool. I have been waiting for your next post

13:14 katratxo: dnolen: your CSP link is correct? should i search for the right meaning in wikipedia?

13:17 dnolen: katratxo: thx fixed

13:17 katratxo: dnolen: :)

13:19 bhauman: "It's critical that the currency of event cordonation be at a higher lever than concrete event sources like key presses and mouse movement" … that says zoo much

13:20 r/zoo/so/

13:20 dnolen: ^

13:22 dnolen: bhauman: heh

13:22 kmicu: dnolen: your approach is like a small Pedestal, but for UI - great separation. I look forward to the next post.

13:24 bhauman: kmicu: I think having a bunch of small pedestals like processes is more expressive/responsive than jamming it all into one large event stream

13:25 * nDuff 's ears perk up

13:33 IamDrowsy: dnolen: the last example does not work with firefox for me (22.0 for ubuntu) ... chromium, opera and rekonq are totally fine

13:33 dnolen: IamDrowsy: k thx, will look into it later

13:35 kmicu: The same with 25.0a (xulrunner/conkeror), but Gecko sucks anyway.

13:41 seangrove: dnolen: Good post, looking forward to bigger examples

13:41 dnolen: seangrove: the bigger example don't look much different, just more code

13:41 and thus harder to understand

13:45 bhauman: dnolen: yes very good post. I get that you are stringing reusable components that speak a certain protocol together forwarding all messages to then next component. Might be nice to just show the simple wiring. (-> (keychan) (highlighter name-list) (selector name-list data)) 

13:49 dnolen: bhauman: yes it took me a while to come to that idea actually. Otherwise you need to do a lot of yucky multiplexing

13:50 bhauman: it kind of makes sense and strangely aligns with how people use objects

13:50 bhauman: dnolen: yep, its also like piping atoms together as well

13:51 kmicu: javascript devs who read David's latest CSP posts... http://www.youtube.com/watch?v=vh3tuL_DVsE

13:52 hiredman: ,(doc max-key)

13:52 clojurebot: "([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."

13:52 bhauman: kmicu: freaking funny

13:54 kmicu: bhauman: not funny, it is based on true story

13:54 ;]

13:55 gavri: is there a built-in way for me to find the most frequently occurring element in a list?

13:55 technomancy: (doc frequencies)

13:55 clojurebot: "([coll]); Returns a map from distinct items in coll to the number of times they appear."

13:55 gavri: technomancy: thanks a lot

13:55 technomancy: no problem

13:56 bhauman: kmicu: oh, does something tragic happen at the end?

13:58 juhu_chapa: Hi guys!

13:58 upwardindex: I would like to add a watch to a server-side atom from clojurescript, is that possible?

13:58 juhu_chapa: Why 'a is a symbol? i.e. (symbol? 'a) returns true

13:59 dnolen: bhauman: I never like thed atom watcher pattern

13:59 liked

13:59 gavri: http://clojuredocs.org/clojure_core/clojure.core/frequencies says that frequencies is in clojure.core, but it isn't available from the console. does clojure.core have to be explicitly required?

14:00 technomancy: gavri: are you using an old version of clojure?

14:00 seangrove: gavri: Seems to be available in the repl on my side, clojure 1.5.1

14:00 gavri: 1.1.0

14:00 weird

14:00 technomancy: wow, where did you get that? =)

14:01 gavri: thought I was working with a not-so-old distribution

14:01 seangrove: An archaeology dig, I assume

14:01 gavri: it's my friends linux mint

14:01 lol

14:01 it's not an old linux mint, AFAIK

14:01 kmicu: bhauman: yes - callbacks, very tragic

14:02 seangrove: juhu_chapa: What else would it be?

14:03 juhu_chapa: seangrove: A symbol must resolve to a value. I cannot see that in this example.

14:03 ToxicFrog: juhu_chapa: is this a trick question?

14:04 No resolution is performed, you just get the symbol back.

14:04 seangrove: ,(do (def f) f)

14:04 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

14:04 technomancy: juhu_chapa: an evaluated symbol must resolve to a value

14:04 ToxicFrog: Similarly, '(a b c) is a list of three symbols, not the result of calling a nor a list of the values those symbols evaluate to.

14:04 technomancy: the whole point of quoting is to prevent evaluation

14:07 juhu_chapa: I see, thank you guys.

14:09 kmicu: It turns blue

14:12 llasram: gavri: If you're trying to develop with Clojure, you're best off installing Leiningen (ideally directly from http://leiningen.org/) and letting it pull in a recent version of Clojure

14:13 gavri: llasram: thanks. I'll do that

14:14 * technomancy covertly slides llasram his commission

14:15 squidz: haha

14:15 * llasram tips his had slightly as he passes slips the bill into a pocket

14:15 llasram: Man, need to work on coherence today

14:15 technomancy: nothing to see here; move along

14:15 * seangrove nervously glances away, shuffles along

14:17 squidz: didnt know #clojure was so shady

14:18 gavri: do I uninstall clojure before I use leiningen?

14:18 technomancy: gavri: you don't need to

14:18 gavri: doesn't hurt if I do though, right?

14:18 llasram: Rubber-ducking, if anyone has any thoughts/existing libraries. I want to write a reducer which yields a sequence of reductions of sub-sequences of the original list which are equal according to a provided comparator

14:18 technomancy: right

14:19 llasram: Contrived example: (->> [1 1 1 2 2 2] (reduce-group = +) (r/reduce conj [])) => [3 6]

14:20 Does this match any patterns/functions I'm just not already aware of?

14:23 Actually... I think it can't be done with reducers, because there's nothing to terminate the final group :-/

14:25 hiredman: you can do it via reduce, you just need a sort of extra clean up bit at the end

14:29 piranha: (let [c (chan)] (go (loop ... )) c) pattern seems to happen *very* often

14:29 llasram: hiredman: I think you're right. The reducer object will just need to implement the reduce protocol directly instead of doing the base reducer library direct function composition approach

14:30 ToBeReplaced: llasram: does partition-by help?

14:31 ,(->> [1 1 1 2 2 2] (partition-by identity) (map (partial reduce +)))

14:31 clojurebot: (3 6)

14:32 llasram: ToBeReplaced: I'm trying to stay in reducers vs lazy seqs, but good point

14:33 coventry: Is anyone here using the debugging facilities in ritz-nrepl on a routine basis? I'm finding it very unstable. While playing with it, I frequently have to restart "lein ritz-nrepl", apparently because the debugee clojure process it's communicating with stops responding, at least that's what I'm guessing based on the "--log-level trace" output: I see the requests going in from emacs, but nothing coming back out.

14:34 ToBeReplaced: llasram: so is the issue that it's hard to implement partition-by as a reducer?

14:34 llasram: ToBeReplaced: Definitely not trivial, but may not be that hard. Trying now that you've pointed out what I want is the composition of two more basic operations :-)

14:36 ToxicFrog: There's also group-by

14:36 Which, unlike partition-by, will produce two subsequences for [1 2 1 2 1 2], not six.

14:37 llasram: ToxicFrog: Naw, the semantics of partition-by are definitely what I want

14:37 ToxicFrog: Aah, you only want contiguous subsequences?

14:37 llasram: yah

14:37 ToBeReplaced: llasram: good luck -- my concern would be that the partitioning operation is inherently sequential assuming that [1 1 2 2 2 1 1 1] -> [1 1] [2 2 2] [1 1 1] and not [1 1 1 1 1] [2 2]

14:38 so you might need to just accept that part being sequential, and then you can use reducers for the remaining operations

14:40 technomancy: on clojure-mode, is a pull request acceptable or do you prefer patches?

14:40 technomancy: ToBeReplaced: oh, a pull request is fine

14:40 "patch" is just shorter to type =)

14:41 ToBeReplaced: figured, just making sure

14:41 dnolen: FireFox issues in my blog post resolved, thanks for the feedback people

14:41 protip - prim-seq rocks for array-likes, don't mess w/ anything else

14:43 seangrove: dnolen: You and your cljs dark-magic

14:44 gavri: how do I find out the type of a result in the console?

14:45 kmicu: dnolen: is post updated?

14:45 ToBeReplaced: gavri: *1 for the last result, type for the type... so (type *1)

14:46 gavri: cool, didn't know that types are exposed as part of the language

14:46 dnolen: kmicu: yep

14:46 gavri: can they be manipulated?

14:46 dnolen: kmicu: just tested in FF seems to work

14:46 gavri: and have new instances created from types obtained from other instances?

14:47 technomancy: gavri: usually you don't care about the actual underlying type; just whether it's a map, list, vector, etc.

14:47 gavri: k, makes sense

14:47 technomancy: it's best to think in terms of abstractions

14:47 gavri: was just wondering if it's technically possible

14:47 kmicu: dnolen: it works now, maybe some space time anomaly... nvm

14:48 technomancy: gavri: sure; just not common

14:52 noncom: is there any existing facility that could retreive a projects dependencies just like lein does it, but sources, not their jars?

14:52 aboy021: Does Clojure have a coalescence operator?

14:52 technomancy: noncom: most lein-generated jars have git clone info in them

14:52 edbond: ,(doc fnil)

14:52 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

14:53 technomancy: noncom: in the pom

14:53 aboy021: awesome, tyvm

14:53 noncom: technomancy: looks like a nice place for me to start

14:53 * gfredericks starts singing "nomcom: in the pom"

14:53 noncom: :)

14:54 technomancy: noncom: it's not a standard thing outside lein though

14:54 plus it won't work on subprojects or non-git projects

14:54 but it's a start

14:54 noncom: yeah..

14:54 technomancy: noncom: relevant to your interests: https://github.com/Seajure/melange

14:55 noncom: cool!

14:57 seangrove: technomancy: Not enough dune-related project names

14:57 technomancy: seangrove: my dummy test app at work is called shadout-mapes

14:57 leifw: seangrove: agree

14:58 technomancy: I had a "baliset" once, but that turned out to be a dead end

14:58 seangrove: technomancy: You had mentioned find-usages for clojure. Curious if you think it'd be reasonable to do via tools.reader loading up a source directory and keeping track of all mentions of symbols

14:58 technomancy: seangrove: I think analyze might be a better fit

14:58 IIRC it can handle resolving for you

14:59 gfredericks: I used analyze to do such a thing

14:59 https://github.com/fredericksgary/clj-usage-graph

15:00 technomancy: hey now look at that

15:00 seangrove: gfredericks: That looks like what technomancy was talking about previously

15:00 technomancy: nice and short

15:00 seangrove: With a graph output on the end of it, of course

15:01 noncom: technomancy: could you also please tell me is it true that lein and it's dependencies all use clojure.java.io for talks to filesystem and handling urls?

15:01 technomancy: noncom: lots of URL access happens outside of c.j.io

15:02 gfredericks: seangrove: the usages code is super slow for moderate sized functions

15:02 technomancy: possibly some filesystem stuff goes directly through Java classes too

15:02 gfredericks: I suspect the analyze output has a lot of duplication in its data structure

15:02 technomancy: (lein is older than clojure.java.io)

15:02 noncom: i see

15:02 technomancy: noncom: plus tons of HTTP access from the underlying java Aether lib

15:03 jaley: I just noticed http://clojure.org/runtime_polymorphism has no mention of protocols, reify, etc. Presumably hasn't been updated since 1.2 was released?

15:03 technomancy: jaley: don't trust clojure.org =\

15:03 the essays are good, but the rest is questionable

15:03 stuartsierra: clojure.org has been updated, but there is a separate page for protocols/records

15:04 jaley: technomancy: yeah, well… it's funny, some of the documentation there for core language features is really thorough, i don't know of a better source for certain things

15:04 sdegutis: theres no freenode channel for discussing language-agnostic general program design

15:04 so im giving #generaldesign a shot

15:04 technomancy: jaley: clojure-doc.org is a good place to start

15:04 stuartsierra: Actually that runtime_polymorphism page might be an orphan - it isn't linked from anywhere on the main site.

15:05 jaley: stuartsierra: Features (side bar) -> Runtime Polymorphism

15:05 stuartsierra: oh, ok

15:05 lagging_troll: has anyone connected sqlkorma with sybase?

15:05 stuartsierra: Should probably just link to the separate protocol & multimethod pages.

15:05 jaley: stuartsierra: actually I don't think any of the features pages mention it, and this one cites multi methods as the primary method for runtime polymorphism

15:05 stuartsierra: The 'feature' pages have gotten less attention than the 'documentation' pages.

15:06 technomancy: jaley: multimethods are great

15:06 jaley: yeah cool, i didn't need these docs personally, I'm just preparing some slides so was using them for reference, but I thought it was worth flagging in case it confuses newcomers

15:07 stuartsierra: I'll try to find somebody with access to clojure.org

15:17 technomancy: whoa; patrick stewart played Gurney Halleck in the Lynch adaptation

15:17 Raynes: …………….. acting.

15:17 callen: technomancy: making me wanna rewatch it.

15:17 technomancy: I'm a massive Dune nut.

15:18 technomancy: callen: I've only seen the newer adaptation

15:21 callen: technomancy: that's the better one to see if you care about Dune.

15:26 Fare: hi! Who's in charge of clojure-conj, these days?

15:27 stuartsierra: Fare: conj-info@thinkrelevance.com

15:31 Raynes: It's stuartsierra. Storm the castle!

15:31 stuartsierra: I have little involvement with organizing clojure-conj these day.s

15:32 edw: Anyone else here see Calca, think that maybe this is what LightTable should have been, but using Clojure?

15:33 seangrove: calca?

15:33 edw: Calca.io.

15:34 It hurts that I can't write Clojure a literately as I can do basic arithmetic. Or even not so basic arithmetic.

15:36 Fare: stuartsierra, thanks!

15:48 jweiss: (defrecord Foo [a b c d e]) (Foo. "asdf" "foo" 12343 1 2) -> ClassCastException java.lang.Long cannot be cast to clojure.lang.IPersistentMap

15:48 what gives here? ^ it seems to only fail trying to pr the value, the constructor works fine.

15:48 Bronsa: jweiss: works to me

15:48 jweiss: Bronsa: in nrepl?

15:49 Bronsa: no, I'm not using nrepl

15:49 tim: jweiss: shouldn't you be using (->Foo ) instead of Foo.?

15:49 jweiss: tim: what's the difference

15:49 llasram: jweiss: works fine in nrepl.el

15:49 tim: one's a constructor, the other is a function

15:50 tbaldridge: for records, I don't know if it makes a difference or not.

15:50 hiredman: my guess is jweiss is omiting relevant bits

15:50 jweiss: yeah the example i gave works for me too, but the record i'm using doesn't work

15:50 but i can't see what difference there is here

15:51 tbaldridge: metadata is a IPersistentMap...is it trying to set metadata to a int?

15:51 stuartsierra: The difference is that ->Foo is a first-class function: you can refer it from other namespaces and use it in higher-order functions.

15:51 jweiss: ok this fails: (defrecord InstanceDefinition [name template-name memory sockets cores]) (InstanceDefinition. "foo" "baa" 12343 1 2)

15:51 tbaldridge: jweiss: works for me via a repl

15:52 jweiss: hrm.

15:52 stuartsierra: me too

15:52 jweiss: for me it prints this- ovirt.client.InstanceDefinition

15:52 ClassCastException java.lang.Long cannot be cast to clojure.lang.IPersistentMap ovirt.client.InstanceDefinition (client.clj:12)

15:52 hiredman: my guess is jweiss is using some broken weird repl

15:52 Bronsa: the only way I can think you could get a ClassCastException java.lang.Long cannot be cast to clojure.lang.IPersistentMap from a record ctor is if you were trying to use the n+2 ctor

15:52 ToBeReplaced: isn't there some kind of weirdness that occurs when you try to redefine a protocol? maybe fresh repl?

15:52 `fogus: Records have a secret 2 extra parameter ctors

15:52 jweiss: ah that would do it

15:52 `fogus: (inc Bronsa)

15:52 lazybot: ⇒ 7

15:53 jweiss: so.. why does it work for others?

15:53 Bronsa: eg (defrecord x []) (x. 1 nil) would throw that error

15:53 jweiss: but it seems to fail printing the value, not in the ctor

15:53 `fogus: It's not checked in the ctor

15:53 tbaldridge: jweiss: your repl is probably using some old version of the record or something

15:53 jweiss: ->InstanceDefinition works, guess i know to use that now.

15:54 Bronsa: there may be some funny things happening with dynamic classloaders

15:54 jweiss: the stacktrace is in pr.

15:54 tbaldridge: That's why I never boot a repl...to dangerous.

15:54 jweiss: in meta, in fact

15:55 tbaldridge: (j/k)

15:55 stuartsierra: tbaldridge does all his coding with a magnetized needle.

15:55 tbaldridge: nah, I use butterflies and cosmic rays: http://xkcd.com/378/

15:56 Bronsa: jweiss: http://sprunge.us/hhQH does this match your stacktrace?

15:58 jweiss: Bronsa: yup

15:58 mccraig: anyone know of a good user-agent string parser in clojure ?

15:58 hiredman: I've seen older versions of nrepl + nrepl.el do weird things (seemingly insert extra round trips thourhg prn, etc)

15:59 * konr used core.logic for the first time in real code ♥

16:01 dnolen: konr: whoa

16:03 gfredericks: I was thinking about using it the other day for some tests; I think even .nominal might have been appropriate

16:03 mgaare: I'm running into a problem with enlive, and I"m not sure what I'm doing wrong. Anyone able to take a look at this? https://gist.github.com/mgaare/0ab86563ecacc76a7ab9

16:03 gfredericks: then I instead opted to iterate over all permutations of a sequence because it was easier :)

16:04 konr: dnolen: some simple pattern matching, but cool, nonetheless :)

16:08 justin_smith: I just tried searching for a clojure based implementation of logo (the language that was basically mexps connected to a geometry lib for children) but the google search just gives me a bunch of hits for THE clojure logo

16:08 `fogus: Try "turtle"

16:09 http://nakkaya.com/2010/01/09/a-simple-turtle-graphics-implementation-in-clojure/

16:09 justin_smith: cool, thanks

16:09 technomancy: join us next time, on "languages named before google"

16:10 stuartsierra: Yeah, like "Dart" and "Go."

16:10 justin_smith: I was reading about the original logo and its use of a robotic turtle with actual retractable pen, and thinking "3D VERSION WITH IR DRONE"

16:10 `fogus: The languages named after Google (and by Google) are way wrose

16:10 worse

16:10 arohner: yeah, go is just the worst to google for

16:11 technomancy: scala -> https://encrypted.google.com/search?tbm=isch&q=staircase

16:11 justin_smith: my next project and/or child (whichever comes first) is going to be named One Weird Trick Free Ipad

16:11 technomancy: hahah

16:11 justin_smith: privacy in a post google world

16:12 rboyd_: Work From Home Mom

16:12 justin_smith: that's a catchy one

16:12 technomancy: Paying Way too much Car Insurance, Esq.

16:12 justin_smith: lol

16:20 Raynes: `fogus: Did you ever end up doing anything with Elixir?

16:21 `fogus: Raynes: Not yet. Once this book is done I'll check it out.

16:22 tbaldridge: I like the fact that Elixir give a better syntax...I just wish it was sexprs. But it looks cool

16:22 edbond: are there any core.logic cheatsheet?

16:22 dnolen: edbond: somebody put one together on the Clojure mailing list recently

16:22 anybody encounter issues w/ multimethods where you use Object to match defaults?

16:23 in a complex match

16:23 [Foo Object], [Object Foo] etc

16:23 hiredman: you can't do that, as far as I recall

16:23 there is no way to have "wildcards" inside collections like that

16:24 dnolen: hiredman: so there just no way to do wildcards with multimethods?

16:24 kmicu: edbond: first entry in google https://rawgithub.com/dedeibel/clojure-core-logic-cheatsheets/master/out/cheatsheet-use-title-attribute-no-cdocs-summary.html

16:24 dnolen: hiredman: so bizarre that it works normally, but fails at compile time ...

16:24 well "normally"

16:24 edbond: kmicu, thanks

16:24 hiredman: hmmm, does it work normally?

16:24 dnolen: hiredman: yes this is the source of the AOT problems in core.match, everything seems to work fine interactively, but AOT fails

16:25 hiredman: ,(isa? [Object] [:a])

16:25 clojurebot: false

16:25 amalloy: dnolen, hiredman: Object is fine as a wildcard as long as what you're matching is a class

16:25 hiredman: ,(isa? [:a] [Object])

16:25 clojurebot: false

16:25 amalloy: Object won't match other objects like [:foo]

16:25 technomancy: isa? is terrible

16:25 hiredman: ,(isa? [String] [Object])

16:25 clojurebot: true

16:25 hiredman: huh

16:25 dnolen: amalloy: yeah, this doesn't seem to be true in the presence of AOT

16:25 technomancy: I mean, terribly named

16:26 amalloy: dnolen: could be because classes don't have the same hashcodes across jvm instances?

16:26 but then i guess i'd expect it to fail for lots of classes, not just Object

16:29 noncom: i have a fun where i pass a map of optional params, and i want to make an action on each of them, if it is present, so i have a (when) for each possible params key. is there an idiomatic way to shorten that, avoid having a handful of whens?

16:29 stuartsierra: Anybody feel up to debugging some issues with type erasure?

16:29 http://dev.clojure.org/jira/browse/CLJ-1243

16:32 hiredman: actually I just ran in to that

16:32 https://github.com/jfager/functional-critbit/ has a private abstract class with public methods

16:33 atyz: Hey all. I have config value that needs to be present in several namespaces - would creating a config.clj and having defs defined within that and requiring within those namespaces be a bad idea? Is there a more correct approach to this?

16:33 ystael: noncom: i don't know about 'idiomatic', but sometimes i map options onto functions that consume their value, and reduce the result by comp

16:34 atyz: Essentially something like a singleton in an OO approach would be what I'm looking for

16:34 noncom: aha...

16:34 atyz: But I'm unsure of the correct way to do this functionally

16:35 justin_smith: atyz: better to have a config function that returns a config object (probably a nested map) that way you can seamlessly get re-entrancy by having multiple config objects

16:37 the config object can just be a value defined in a namespace (on a user level rather than library, preferably)

16:38 having a special var or a with-* binding form are popular functional ways of handling this

16:38 atyz: justin_smith: so something similar to {:configs {:someapikey {:somestuff "dkfjdkfj"} {:someotherapikey {:secret "sdkfjsdf"}}}

16:38 justin_smith: yeah

16:39 for example see how clojure.java.sql does it

16:39 you pass in a db config, or use a with-config block

16:39 that way you can have multiple dbs, but still not have to give a config/auth arg to every function

16:41 someone on this channel had a nice article with an argument against using with-* macros

16:41 stuartsierra: hiredman: Got the specific class/method?

16:42 justin_smith: That was me. http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope

16:42 justin_smith: cool, thanks stuartsierra, bookmarking this time

16:43 cmajor7: is there any built in seq/sort function, or this needs to be written out => need to sort a list of lists in this way: input "[[2 4 6] [1 3 6] [1 2] [1 3 5] [2 5] [3 4]]", output "[[1 2] [1 3 5] [1 3 6] [2 4 6] [2 5] [3 4]]" (sorted by first, second… all the values)

16:44 hiredman: stuartsierra: I am not 100% sure, I think it was https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/AbstractCritBitTree.java#L394 the size method with the implementing class being https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/CritBitTree.java#L172

16:45 llasram: cmajor7: For some reason unclear to me, Clojure's default sorting rules compare by length first, so you'd need to write your own comparator function which returns {-,0,+} based purely on sequence content

16:45 hiredman: I just forked it, made the abstract class public, and rolled on

16:45 atyz: Heh: This brings me to one of my top anti-patterns in Clojure: the Dynamically-Scoped Singleton Resource (DSSR).

16:45 amalloy: llasram: for vectors. seqs don't sort at all

16:45 stuartsierra: hiredman: I've been looking at Netty 4, which uses this pattern all over the place.

16:46 llasram: amalloy: Right -- thanks for the clarification

16:46 pbostrom: I want to do a simple xy-plot, is incanter the best bet? It seems kinda heavyweight, the uberjar is 42MB to plot a cosine function

16:47 cmajor7: llasram: right, that is what I am in the middle of (writing a comparator to plugin to sort-by), but then when I do these things, later I stumble upon that same functionality built in, so wanted to see if anyone knows it is..

16:48 llasram: cmajor7: Isn't builtin AFAIK. In Clojure 1.5 `reduced` should make it pretty compact though

16:50 hiredman: stuartsierra: have you looked at the compiler? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L1424 seems to be the problem

16:50 stuartsierra: hiredman: I've been digging at this all day, haven't found it yet.

16:51 llasram: pbostrom: Until lynaghk finishes https://github.com/keminglabs/c2po-clojure, I think Incanter is about the best you get in JVM Clojure

16:51 stuartsierra: hiredman: But yes, it's somewhere around that line.

16:51 llasram: pbostrom: Or you can call JFreeChart directly. Or you can just use R

16:51 hiredman: so the issue is clojure tries to find the public class the method is delcared on, and there is none, so boom

16:52 stuartsierra: It's more subtle than that, I think. It only happens on generic methods.

16:52 hiredman: when it can find the method on that line it falls back to reflection, and the reflector uses the same logic

16:52 stuartsierra: not in my experience

16:53 stuartsierra: hiredman: Really? Do you have a test case? I can't reproduce it without generics.

16:54 hiredman: stuartsierra: the method for the critbit stuff I linked don't have generics

16:54 you may have two issues going on, one with generics, one with private base classes

16:55 justin_smith: I have an answer for cmajor7, but he appears to be gone. (fn [[X x] [Y y]] (let [c (compare X Y)] (if (= c 0) (compare x y) c)))

16:57 hiredman: stuartsierra: thinking about it, I'm not sure it was the size method that I had the problem on, it could have been get(), which is generic, let me try and check

16:58 stuartsierra: hiredman: ok thanks, if you can show me the code that causes the error that would be helpful

16:59 pbostrom: llasram: thanks, I'll stick with incanter I think, learning jfreechart or R is too much work I think, I exhausted my mental energy reading the incanter docs

17:00 hiredman: ah, it was .get()

17:01 mgaare: solved the earlier enlive problem... needed to call as-nodes in the nested transform

17:02 hiredman: stuartsierra: so https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/AbstractCritBitTree.java#L305-316 is the method of the abstract class, https://github.com/jfager/functional-critbit/blob/master/src/main/java/io/prelink/critbit/CritBitTree.java is the concrete class, and to get the error all I have to do is call .get (it is a map) on an instance of io.prelink.critbit.CritBitTree

17:03 stuartsierra: hiredman: OK, thanks, will add to the ticket as another example.

17:10 What's really weird is when I disassemble compiled Java code calling one of these methods, it appears to be calling it on the public derived class, even though no such method exists.

17:18 amalloy: stuartsierra: it's not declared in the derived class, but it exists there

17:19 so it should be perfectly valid to call it on that class

17:19 stuartsierra: amalloy: It's definitely valid, because javac allows it.

17:19 But darned if I can make sense of the bytecode generated by my test case.

17:20 Some weird stuff happening there with type erasure and synthetic methods.

17:42 I can't even invoke the method using the reflection API.

17:45 Java throws an IllegalAccessException.

17:49 hiredman: stuartsierra: how are you getting the method object with reflection? from the implementing class via getDeclaredMethod(s) or from the private base class?

17:50 (via getMethod or whatever)

17:50 stuartsierra: From Class.getMethod

17:50 On the public derived class.

17:52 hiredman: have you tried replacing your getMethod call with getDeclaredMethod?

17:53 stuartsierra: hiredman: That gives me NoSuchMethodException

17:53 hiredman: huh

17:54 stuartsierra: OK, the best part: in *Java* code, using the reflection API, I cannot call the method.

18:04 For the compiled Java bytecode, the disassembly shows a call to a method which I cannot find via the reflection API.

18:08 hiredman: on my critbit example I can find the method (on the implementing class, via both getMethod and getDeclaredMethod) and if I setAccessible it, I can invoke it via reflection

18:10 ooh, so .getDeclaredMethod and .getMethod will return an arbitrary choice of methods if they have more than one to choose from, so maybe there is more than one and we are getting the wrong one

18:11 http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getMethod%28java.lang.String,%20java.lang.Class...%29

18:11 stuartsierra: Yes, .setAccessible(true) will allow me to call it.

18:11 But I don't think we want the Clojure compiler running around changing access permission on Java methods!

18:11 hiredman: nope

18:12 well, actually, I wouldn't mind

18:12 but I hate all things private and protected

18:12 stuartsierra: Me too.

18:13 But I really want to know why, even in Java, I can't call the method reflectively without changing its access permissions.

18:16 amalloy: stuartsierra: i think hiredman was right in saying that getMethod can return methods from the derived or the base class, and when there are two matches it chooses arbitrarily. so you're getting the (private) method from the base class, rather than the (public) method from the derived class

18:17 if you called getMethods instead and iterated through them, you'd find one that matches and is callable

18:17 stuartsierra: Nope. Even if I enumerate everything returned by getMethods, only the base class method is there.

18:19 hiredman: yeah, ditto

18:19 that was disappointing

18:19 stuartsierra: Holy crap, this might be a JDK bug.

18:19 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4283544

18:20 dnolen: submit date 1999

18:21 hiredman: so if you have some heuristic to find this situation, to at least let the clojure compiler generate non-reflective calls like this then you can work around it

18:23 stuartsierra: yeah

18:28 OK, that can wait until tomorrow.

18:28 Thanks, hiredman & amalloy.

18:33 ToBeReplaced: is org.clojure/java.data still the preferred way to go from a java object into a clojure map?

18:37 mthvedt: friend is baffling

18:38 callen: mthvedt: don't use it.

18:38 mthvedt: callen: suggested alternative?

18:39 Raynes: Not using it.

18:39 callen: mthvedt: what Raynes said.

18:39 Raynes: Friend makes very little sense to me as well, fwiw.

18:39 callen: mthvedt: very rarely do you need an uber magick tool and in the darkness bind them to do that sort of thing.

18:39 Raynes: I imagine it's wonderful and awesome. I've just never really been able to get it, I suppose.

18:39 mthvedt: i can't help but think if gandalf had to use 'friend', he'd still be stuck outside that one door

18:39 Raynes: Anyways, you can simply roll your own authentication if you want.

18:39 callen: it only makes sense if you're doing an absurdly complicated auth flow as part of an existing enterprise system. Outside that, no.

18:40 Raynes: Or use Personas like refheap.

18:40 In fact, look how refheap does it. It's insanely simple, which is why I like Personas so much.

18:40 callen: people seem to like Persona. I just roll my own auth.

18:40 Raynes: I only like it because it's simple.

18:40 * technomancy glares at Raynes

18:40 callen: technomancy: what?

18:40 Raynes: technomancy: Stop using shitty browsers. -.-

18:40 mthvedt: raynes: i have to replace an existing auth flow depending on google app engine

18:40 Raynes: callen: He uses conkeror or whatever and it can't handle the personas. :p

18:40 technomancy: Raynes: says the guy whose browser doesn't even have dotfiles

18:40 callen: Raynes: LOL

18:41 I forgot he used a ghetto browser.

18:41 gtrak: friend works fine for simple stuff, you can jack in some credentials easily

18:41 callen: "works"

18:41 "fine"

18:41 gtrak: https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L57

18:41 technomancy: I rolled my own oauth in syme and it took like 20 lines

18:41 gtrak: simple back-door, avoid all the workflow stuff

18:41 Raynes: https://oauth.io/#/home

18:42 akurilin: Quick question, does it make sense to use a sorted map when I need to eventually encode it to json and pass it to another non-clj system that might not care much about ordering? Seems like it might be just simpler to go with a vector.

18:42 callen: akurilin: use whatever.

18:42 tkd: json objects are generally order independent.

18:43 Raynes: akurilin: If a sorted map is easier for you to work with in Clojure then sure.

18:43 If your non-clj client doesn't care, then you should care about what helps you.

18:44 tkd: Which is the point sir here was making by saying "what's the point"

18:44 akurilin: Cool, thanks for the tips.

18:44 Raynes: I assume anyways.

18:49 dnolen: core.async needs something like this http://www.kickstarter.com/projects/noflo/noflo-development-environment

18:57 gtrak: the inevitability of spaghetti code is the result of one thing, text :-)..mmhmm.

18:57 callen: #SomebodyGetTheMenInWhiteCoats

18:57 justin_smith: in my experience in visual programming spaghetti code literally looks like spaghetti

18:58 callen: In my experience, non-programmers shouldn't be programming.

18:58 gtrak: I'll write text and generate diagrams from it, thankya...

18:58 justin_smith: heh, there is that too

18:58 callen: been there, MS Access and Excel'd that.

18:58 justin_smith: also, the tooling for text is far superior

18:58 callen: vastly.

18:59 Raynes: As a programmer, I can confirm callen's claims.

18:59 justin_smith: as soon as I found myself writing code to manipulate and investigate the save files of puredata, I was done with puredata

18:59 dnolen: As a programmer I still think it's useful

18:59 the Quartz Composer model was quite nice

18:59 write your OpenGL logic as a component then wire it up at higher level

18:59 callen: Storyboard I think is pretty indicative how impotent the medium is for expressing intent.

19:00 declaratively or otherwise.

19:00 eventually the graphical medium would become inundated with either context-specific glyphs or they'd end up resorting to text decorations on top of the graphical medium

19:00 dnolen: in serious asynchronous work flows it's pretty damn hard to see the wires, text doesn't help worth shit

19:01 justin_smith: also, you don't notice how many dimensions of transformation your code has until you are stuck with only two of them being readable

19:01 callen: you can't express information you haven't expressed and graphical media are less information dense for code than text.

19:01 * dnolen continues to ignore everything callen says

19:02 justin_smith: dnolen: how much visual programming have you done?

19:02 Raynes: dnolen: What did he say that was incorrect here?

19:02 dnolen: justin_smith: at one point quite a lot

19:02 justin_smith: what language?

19:03 dnolen: Raynes: "less information dense then text"

19:03 justin_smith: C, Obj-C, C++, Java, JavaScript

19:03 justin_smith: also played with Quartz Composer, and I fooled around with Max MSP and Pure Data

19:04 and I've quite liked the Cocoa tools for what they're good for.

19:05 justin_smith: ok, I was thinking in terms of puredata where text code isn't even an option, and that got clunky for me - it worked at a macro level but beyond a certain level of size/complexity it was incredibly brittle

19:05 dnolen: justin_smith: yeah I'm not suggesting an all or nothing here

19:05 callen: the Russians tried a very progressive form of visual programming

19:06 dnolen: justin_smith: that's why I said specifically I liked the options of writing the code as a component, and using the a tool for wiring. this really isn't conceptually different than Interface Buildern

19:06 the problem w/ IB is that it really isn't oriented around event streams

19:06 callen: http://upload.wikimedia.org/wikipedia/commons/2/26/Quicksort_DRAKON.png

19:06 justin_smith: dnolen: ok, yeah, at a high level of abstraction that makes sense, I misunderstood you

19:06 dnolen: justin_smith: yes

19:06 justin_smith: I mean "yes" that's what I was trying to say.

19:08 justin_smith: a good reflective tool could probably draw the connections between your go communicators automatically (maybe with a little help from judicious annotations)

19:09 callen: incidentally, that sort of thing is possible because we have such good tooling around processing text.

19:09 karvus: is there an incantation I can make at the lein repl in order to "re-evaluate" the project.clj? or some way to load a new dependency without restarting my instance?

19:09 justin_smith: I once hooked up the find-callers functionality from swank to graphiz to make a big flowchart style call tree that taught me a lot about a new (to me) code base - it was ugly and took forever to run, but it was informative

19:10 callen: yes, I was the one who brought up how much better text tooling was, yes? :)

19:11 callen: justin_smith: reinforcing the point against what you said about reflection.

19:39 chord: why did lisp fail to take off?

19:40 xybre: chord: parentheses are heavy and not very aerodynamic.

19:41 chord: if the outermost parentheses could be removed would that have helped lisp a lot?

19:41 justin_smith: mexps were never popular

19:44 chord: what do you mean?

19:44 callen: jrecursive: "Software begins as diagrams on a whiteboard, NoFlo keeps it that way" i suspect they will find this to be true

19:46 xybre: callen: keeps it on the whiteboard?

19:47 justin_smith: chord: m-expressions were a thing in the original lisp that had less parens, sexps (what we use today) were designed to be an internal representation http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/m-expression/m-expression.lisp

19:47 ztellman: xybre: http://i2.kym-cdn.com/entries/icons/original/000/012/132/thatsthejoke.jpg

19:47 callen: xybre: yep

19:50 justin_smith: chord: example of a session in a repl using m-expressions http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/m-expression/

19:52 clj_newb_2345: dumb question: how do I debug code with trampolines?

19:52 it's rather annoying that I have no idea what the call stack looks like

19:56 justin_smith: clj_newb_2345: problem is implicit in trampolining, debugging tail recursive code has the same problem - the point is removing the call stack

19:56 soulman__: is it possible to unroll a seq one level only? not flatten the whole seq

19:56 justin_smith: one option is to use an atom as an artificual call stack

19:56 soulman__: (apply concat s)

19:57 soulman__: [[a][b]] -> [a][b]

19:57 justin_smith: ok, concat returns the wrong part of the nesting

19:57 is that in order to provide [a] [b] as an arg to a function? if so (apply f s)

19:58 xybre: I-Expressions look extra fun. http://srfi.schemers.org/srfi-49/srfi-49.html

19:58 amalloy: soulman__: it is not possible for anything to return [a][b], because that is not a value

19:58 justin_smith: yeah, I should have specified "as separate args" above

19:59 soulman__: it will go into a function eventually

19:59 justin_smith: also you can map to get each element individually

20:00 soulman__: (apply f (filter (complement nil?) [['a] nil ['a]]))

20:00 that should to the trick, hopefully

20:01 justin_smith: looks right, if (f ['a] ['a]) is what you want to happen

20:03 (apply f (remove nil? [['a] nil ['a]]))

20:03 slightly more readable

20:04 soulman__: justin_smith, yes, the f would choke on the nil

20:04 seangrove: The Carmack quakecon talk was pretty good, seems to be a very coherent guy

20:04 Advocates Haskell's static typing over lisp, interestingly

20:07 callen: Not really that surprising.

20:07 the weaker parts of C and C++'s type system and legacy crap has bitten him over and over for decades.

20:11 brehaut: he's also a huge fan of static analysis, which haskell is pretty good at

20:13 justin_smith: yeah, games are about optimizing everything, and the best optimizations are the ones that are fully applied before the executable is even linked

20:17 clj_newb_2345: alright

20:17 I now need to be able to spit out HTML files

20:17 what library should I learn?

20:17 bhauman: hiccups

20:18 clj_newb_2345: ^

20:18 clj_newb_2345: bhauman: hmm, was just about to start on enlive

20:19 bhauman: clj_newb_2345: haven't used it, although it's really popular as far as I can tall

20:20 clj_newb_2345: guess it depends on your task, hiccups is very simple

20:29 akurilin: Environ question: I open a repl in my ring app, the profile is dev. I run lein test, the profile switches to test, now I have to reboot the repl or reset the env manually.

20:29 Is there any way of having lein test not affect existing repls?

20:31 justin_smith: akurilin: so you are running the tests in the same process as the repl?

20:32 akurilin: I'm not sure, I guess. I have the repl open in one tmux pane, vim with fireplace connected to it. In another tmux pane I run lein repl. I'm assuming it starts a separate process.

20:33 er

20:33 *lein test

20:33 justin_smith: why would it even affect the other process? I don't even understand how that would happen

20:33 callen: http://golang.org/doc/faq#nil_error lol

20:37 bhauman: akurilin: do you know if you have two repls running? one for 'lein test' and one for 'lein repl' ?

20:39 hiredman: akurilin: it looks like environ works by just writing to .lein-env, and there is one .lein-env per checkout

20:40 akurilin: Here's a printout from a repl: http://pastebin.com/2bL5cSp3

20:40 the DB address changes after running lein test, from within the same repl

20:41 oops, back.

20:41 It only happens when you do :reload-all

20:41 hiredman: I don't like environ (keeping configuration information for your app in your build tool's configuration file is weird)

20:41 sure

20:42 because :reload-all causes environ to rebuild it's config map by slurp in the file it writes config info to

20:42 akurilin: hiredman, I use it only for dev/test modes, I use envdir (from within runit) in production, which environ works well with.

20:42 hiredman: I suppose that makes sense

20:43 akurilin: I guess this issue doesn't bite you unless you get pretty reload-all happy, which I do sometimes.

20:44 hiredman, thanks for looking into it though, that was awesome.

20:59 technomancy: hiredman: I use environ such that all the dev settings live in the codebase and only defer to prod settings if they're actually in the environment

20:59 because otherwise you get into crazy situations due to not being able to change env vars on the jvm

21:00 hiredman: (because you work at heroku where they use ENV vars instead of config files)

21:00 technomancy: hiredman: also because I don't work on large codebases that need more than a handful of config entries

21:00 or nesting

21:02 schaefer: hi folks - i have a question about dynamic vars. https://gist.github.com/anonymous/6136672 returns an unexpected result

21:02 hiredman: ~map

21:02 clojurebot: map is lazy

21:02 schaefer: ah ha

21:03 got it. wrapping in a doall returns the right result. thanks

21:03 hiredman: you know you can just bind *F* to a function and leave out the condp, yes?

21:04 (binding [*F* count] ...) (binding [*F* identity] ...)

21:04 schaefer: yeah. i uber-simplified the real problem

21:04 hiredman: ok, just making sure

21:05 schaefer: appreciated

21:05 amalloy: schaefer: also consider using case instead of condp =

21:06 but i guess that might not be part of the real problem anyway

21:06 schaefer: amalloy: actually, it is. i was wondering about that. i'm a bit surprised that the condp macro doesn't allow for :else

21:07 amalloy: schaefer: sure it does. just supply an odd number of cases

21:07 hiredman: it does, read the doc string

21:07 schaefer: i guess i missed that

21:07 then, what's the advantage of using cond over (condp = ...) ?

21:08 hiredman: case, he said case

21:08 ,(doc case)

21:08 clojurebot: "([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can foll...

21:08 Raynes: Well, condp is an entirely different thing for starters

21:08 schaefer: ha. now you know why i missed the :else in the condp docstring ;)

21:08 cool. i didn't know about case

21:46 how do i force a deep evaluation? https://gist.github.com/anonymous/c328a0c06fcb3aa872d3

21:47 i could walk the data structure with prewalk... i'm wondering if there is a better approach

21:49 nevermind. i see that pre/postwalk force evaluation by themselves.

22:00 johann: hey guys i saw that SICP was on the front page of hackernews today and started reading through it

22:00 did some googling and found a version of it put in terms of clojure

22:00 thought i'd share even though it may be common knowledge http://ecmendenhall.github.io/sicpclojure/

22:20 cmajor7: johann: interesting. I read it as "SICP did not help 'personally' Rich with Clojure", but it will help many of us Earthy humans

22:24 johann: cmajor7: what do you mean?

22:25 cmajor7: johann: SICP is not _about_ Clojure, it's just about problems and computers and how to marry those two via a human medium: us.

22:27 clj_newb_2345: clojure sets are unordered right? therefore, in https://github.com/swannodette/enlive-tutorial how is it possible that the orders are preserved in tutorial/scrape2.clj since the selectors are put in a _set_

22:27 cmajor7: johann: so, while SICP may not help you with understanding Clojure's hash array mapped tries (wikipedia will help you though), it will definitely help you understand how to solve problems with Clojure or any other language

22:28 johann: cmajor7: i just started so far so maybe i have yet to experience your point first hand. but i think a lot of my blocks in learning are me 'overthinking' and finding resources that lay out big pictures first actually help me learn technically faster (so i theorize)

22:29 cmajor7: johann: started in SICP or Clojure?

22:30 johann: cmajor7: i have been doing clojure koans kinda passively the past month because i was focusing on getting a grip on coffeescript--so it's safe to say both

22:31 cmajor7: i found the lighttable ide last night and it really helped me get through that anxiety of the new syntax and see ideas translated to clojure *work*

22:31 cmajor7: johann: I would say just come up with a little project and complete it fully in Clojure, you'll hit a lot of things to google, but that'll be useful googling.. with the real goal

22:31 bhauman: clj_newb_2345: i think it's due to the order of appearance on the page

22:32 clj_newb_2345: err, can't selectors end up selecting "interleaved" components?

22:34 mgaare: clj_newb_2345: when you have a set in a selector, that specifies "or" logic

22:35 clj_newb_2345: the order of the nodes returned from selectors is determined by the input tree - ie the original html

22:35 clj_newb_2345: ah, I see, thus the need for partition

22:35 gfredericks: is it messy to make a protocol in a lib, give an impl for nil, but expect that a user might want to give a different impl for nil?

22:35 clj_newb_2345: okay, so it's not returning for me two stremas

22:35 it's returnig for me one interleaved stream

22:35 then we use the partition function to "split it into groups of 2"

22:35 and then okay; this makes sense, thanks

22:46 gfredericks: can anybody else login to jira?

22:50 coventry: Do you need to do anything special to a lein project to have it compile properly under Intellij/La-Clojure? Invoking "Run -> Run 'core'" results in a strange error message "Clojure Compiler: java.io.IOException: No such file or directory, compiling: /path/to/core.clj". /path/to/core.clj definitely exists, though!

23:14 ubikation: hey why does clojure make a big deal about tail call optimization being impossible if kawa scheme can do it?

23:15 futile: ubikation: it doesnt make a big deal about it.

23:16 ubikation: I don't know I just remember reading a few big blog posts about recur.

23:16 I'm probably the fool then since I can't seem to find those blog posts...

23:16 futile: ubikation: aint no fool, worry not.

23:16 brehaut: ubikation: its not impossible; its impossible while maintaining clean interop with java

23:16 futile: it just needs recur, thats all

23:16 yeah, that

23:17 brehaut: ubikation: im pretty sure you could go find some discussion about the tradeoffs scala made to implement true tail calls

23:18 ubikation: thanks!

23:30 soulman__: i'm trying to parse an eclipse .classpath file with a xml zipper

23:30 (zx/xml-> zip1 :classpath)

23:30 gets me an empty list

23:31 while (zx/xml-> zip1) returns the complete xml

23:32 the root element is classpath, so it should be selected by :classpath

23:32 strange...

23:34 sandwichmaker: Clojure array of maps (from db+extra calculations) + Incanter... Am I the only one that feels like a cheater? It is too damn easy to get things done!

23:35 brehaut: actually an array?

23:35 (in comparison with a vector or list)

23:38 technomancy: ubikation: TCO isn't impossible; just impossible to do well on the JVM

23:38 kawa makes it really slow; everyone who uses kawa turns off TCO

23:38 callen: loop/recur is better.

23:39 twoflower: hey everyone, is it possible to run http-kit from a .war?

23:40 brehaut: hopefully guy steele gets his way

23:42 sandwichmaker: *sorry, s/array/sequence

23:50 clj_newb_2345: correct me if I'm wrong, the mental model for enlive for generating HTML is as follows: (1) I have some clojure datastructure, which is tagged, but has no HTML/CSS code (2) I have a sample HTML document. Then, (3) I select (in a jquery style) snipplets of the HTML code, and (4) using the sepected template, I attach my existing data into it, thus generating HTML

23:55 callen: twoflower: that doesn't remotely make sense. no.

Logging service provided by n01se.net