#clojure log - Apr 07 2012

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

0:14 yoklov: hobbyist: evaluate "*ns*"

0:14 or

0:15 really the solution is just to do "(in-ns 'your.ns.here)"

0:17 hobbyist: yoklov: It's my first less of clojure

0:17 yoklov: that's okay

0:17 at the top of your file is there a "(ns foo.bar)" or something?

0:18 hobbyist: (ns edu.clojure.HelperClojure ;(:gen-class :as HelperClojure))

0:19 I tried to add the root source file path to the repl startup with -i; no avail

0:19 yoklov: okay then in your repl try "(in-ns 'edu.clojure.HelperClojure)"

0:21 hobbyist: Perfect. I was not prefixing the \' to the FQN

0:21 The file runs first time when loaded in repl. Surprisingly the namespace does not persist

0:22 yoklov: thanks

0:25 logaan1: in clojure for lisp programmers part one. at about 59 minutes rich hickey mentions a picture was made of the heirachy of abstractions in clojure. does anyone here know where i could find that picture?

0:37 arohner: logaan1: https://github.com/Chouser/clojure-classes/blob/master/graph-w-legend.png

0:39 logaan1: thanks dude

0:59 devn: hobbyist: not trying to nitpick but: HelperClojure => helper-clojure

1:06 yoklov: hobbyist: you probably also don't want the gen-class.

1:06 unless you're sure you need it.

1:07 hobbyist: I used :gen to see if it helped wit the classpath; in-ns did it.

1:08 helper-class is nitpick; capital offense. No more clojure.

1:09 tonight

1:12 what is the difference between "require" and "in-ns"?

1:13 laurus: How do I uninstall Clojure 1.2 version from Maven?

1:15 yoklov: hobbyist: in-ns changes your namespace, require loads libraries (namespace does not change)

1:57 doctor88: hi

1:59 hi

3:17 jhickner: Is it bad form to do things like this? https://gist.github.com/2326125

3:18 the lock is for an object being manipulated by multiple people over websockets

3:18 a clojurescript project

3:22 I like just needing to import one function instead of all 3

3:53 amalloy: well, that approach is very scheme-y

3:55 jhickner: the closure approach is very scheme-y, and probably wouldn't be popular with clojure programmers

3:55 perhaps more importantly, your set! looks weird/broken

3:57 if you really loved closures, it would be acceptable to pick the second form; doing so because you don't like importing multiple functions seems like a silly reason. if that bugs you, you can do something like (:require [my.api :as lock]) (lock/owns? some-lock some-id)

3:59 (i'll amend that to "if you really loved message-passing")

3:59 (because, really, everyone loves closures)

4:09 jhickner: thanks amalloy

4:11 there's just something about encapsulating everything in one nice package. but thats probably just my OO sensibilities.

4:24 dleja: Hey, if someone wouldn't mind helping me, I can't find this on google... How do i add a java library path in swank clojure mode (for emacs)? i can access the library through the lein repl after i added $LD_LIBRARY_PATH to the bash environment, but the swank server still can't find the library. What's equivalent procedure for adding the library path to swank?

5:23 Cr8: anyone using vimclojure or nailgun with lein2?

6:38 fmn: Will jetty / ring use one thread per connection? I want to expose an expensive operation over http.

6:38 clojurebot: I don't understand.

7:40 Raynes: I just edited an AppleScript file. Someone kill me.

8:36 andyfingerhut: Anyone know off-hand of any already-implemented way to print a collection up to a maximum depth and maximum number of elements? I'm guessing clojure.pprint/pprint can do it with the proper variable settings, but not sure which ones yet.

8:37 mega`: theres a *print-length*

8:38 andyfingerhut: I'll test that with my local REPL rather than clojurebot :)

8:38 samaaron: Raynes: consider yourself spared - death isn't something you should be encouraging so readily

8:39 Raynes: samaaron: But man, it's applescript.

8:39 samaaron: Raynes: But man, it's DEATH

8:39 Raynes: You do know I was joking, right? Surely.

8:39 samaaron: haha

8:39 of course i do

8:39 Raynes: :p

8:39 mega`: Raynes: i want to hear about your pains :D

8:40 Raynes: you need to program in applescript?

8:40 samaaron: Raynes: you should be hacking Quil for the ART-WIN instead

8:40 Raynes: mega`: I was mostly exaggerating. I deleted a few lines so that my /np IRC client command doesn't print such long now playing messages.

8:41 /inp

8:41 <3

8:44 oakwise: samaaron: did you ever figure out that chrome thing?

8:45 hcumberdale: hi there! Is there a better way to write this: (map #(if (= "Welcome" (:name %1)) (assoc %1 :selected true) %1) (find-maps "categories"))

8:45 Raynes: TIL samaaron is Dr. Sam Aaron.

8:45 * Raynes is impressed.

8:46 andyfingerhut: Ah, *print-length* and *print-level* are my friends.

8:46 Taking over the world, one bit of functionality at a time.

8:47 mega`: andyfingerhut: you know your suposed to use them with (binding ..) right?

8:47 andyfingerhut: yep. Thanks for the heads up, though.

8:48 Raynes: andyfingerhut is a lean mean (binding machine).

8:48 mega`: im going to pretend i dident smile abit from that :P

8:49 andyfingerhut: Lately I've been fired up adding little enhancements to Frank Siebenlist's clj-ns-browser. It's always impressive what can be done in not many lines of Clojure.

8:51 mega`: hcumberdale: you can write this (for [m (find-maps)]

8:51 (if (= (:name m) "Welcome")

8:51 (assoc m :selected true)

8:51 m))

8:51 hcumberdale: not shorter but nicer

8:52 hcumberdale: thx mega`

9:44 jondot1: hi all, what is the common construct to use, when I want the last thing in my func to run but that the func's return value won't be that thing

9:45 specifically, i'd like to delete a file when i'm done calculations in the function, at the end. however i want to return the calculation result and not file deletion status

9:47 mega`: the last expression in the function is returned

9:47 use let if you need to do the calculation before the file thing

9:49 (let [calc-result (calculation)] (file-thing calc-result) calc-result)

9:49 jondot1: ah. i see. is there a 'with-' construct?

9:50 mega`: with-file?

9:50 jondot1: that deletes a file at the end?

9:50 mega`: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/with-open

9:51 jondot1: i see, thanks

9:58 AimHere: From the repl, '(apropos with)' might have clued you in as to all the with-foo commands

10:35 jondot1: so, it is acceptable to call a 'heavy' function in a letrec body?

10:36 sorry, in a let body

10:36 that is (let [my-result (heavy-stuff ...params)]

10:41 progo: I do it all the time.

10:41 perhaps using -> would be more idiomatic but what the heck.

10:51 devn: AimHere: only if you have '

10:51 AimHere: (use 'clojure.repl)

10:56 gavilancomun: #overtone

10:59 Hi, I would like a function to take 2 parameters and return a vector of them. I know #(vector % %2) and #(-> [% %2]). Is there a better way please?

11:01 groovemonkey: hi guys, I'm looking to turn a list (:a1 :a2 :a3) into a hashmap where each value from the list becomes a key associated with an empty hashmap, i.e. {:a1 {} :a2 {} :a3 {}}. Anyone have a clever way to do that?

11:02 sattvik: gavilancomun: try vector

11:04 AimHere: ,(zipmap (list :a1 :a2 :a3) (repeat (hash-map))

11:04 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

11:04 AimHere: Maybe one more bracket

11:04 ,(zipmap (list :a1 :a2 :a3) (repeat (hash-map)))

11:04 clojurebot: {:a3 {}, :a2 {}, :a1 {}}

11:04 groovemonkey: awesome! Thanks AimHere.

11:46 * devn gives up on building scsh from source

12:18 dotemacs: Hey guys, if you're into Emacs, you might like this potential Emacs Conf: http://emacsconf.herokuapp.com/

12:36 wysinwyg: question: I need to place a key-value pair (:streets ["street1"]) into EACH hashmap that already exists, nested a few levels down inside another hashmap {:city1 {} :city2 {}}. I've been beating my head against the wall for half an hour...how do I accomplish this? The hashmap I want to end up with is {:city1 {:streets ["street1"]} :city2 {:streets ["street1"]}}

12:36 for a single one, this seems to work:

12:37 (dosync (assoc-in @cities [:city1 :streets] "street1"))

12:37 but for the life of me, I can't seem to get a (doseq) loop around it to apply this action to EACH :city hashmap

12:38 I just get a IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Symbol clojure.lang.RT.seqFrom (RT.java:487)

12:49 offby1: Any suggestions for profiling for a newbie? I tried clojure.contrib.profile, but that seems to not work with current clojure, and I suspect I'm too green to debug it

13:20 Cyrik: hey, could someone point me to a resource on how to left-associative expressions with fnpars?

13:26 unlink: In upgrading to lein2, how do I enable lein-ring for my project?

13:33 fliebel: unlink: Enable? Is lein-ring compatible with lein2?

13:33 weavejester: fliebel: It is

13:33 fliebel: cool

13:34 unlink: it works if I install it as a user plugin, but as my project is not meaningfully useful without lein ring, I think it makes sense to put it in project.clj.

13:36 * fliebel thinks you should just add it as a dep, but does not know shit about lein

13:39 mindbender1: when I need to specify more than one state for gen-class, how do I write that?

13:40 unlink: oh, it turns out that the problem was that I had both lein-1.7.x installed and lein 2.0.0 installed (as lein2)

13:43 * devn wonders about a clojure-scheme shell

14:01 * dnolen is adding a tiny bit of type inference to CLJS

14:12 mega`: dnolen: what is the type inference for?

14:18 jonasen: ,(defprotocol IMarker "Empty marker protocol")

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

14:18 jonasen: ^ works in cljs but not in clj. Is that correct?

14:19 dnolen: jonasen: yes

14:20 jonasen: dnolen: Is there a reason for that?

14:20 dnolen: mega`: CLJS takes a huge performance hit from truth testing, it's my current mission to eliminate them wherever possible.

14:20 jonasen: not that I'm aware of, I recall seeing a CLJ ticket for it.

14:21 Vinzent: Hi. I have a macros which expands to another macros, and in the second macro I want to have access to the var which is dynamically rebound in the first macro (in compile time). Is it clear enough, heh? :) The thing is, expansion of the second macro happens outside of scope of binding. What's the right way do to this? Currently I'm just altering-var-root in the first macro (would it be clearer to take an atom?)

14:22 dnolen: mega`: I've already succeeded at eliminating just about all of them from PersistentVector

14:24 mega`: dnolen: so you remove the truth test when theres a (= ..) case and things like that?

14:25 Vinzent: ok, I think I'd just leave things as they are now...

14:26 mega`: Vinzent: post a gist or something

14:27 Vinzent: i dont realy get the problem... you shuld probebly not use global state with macros

14:27 Vinzent: what is it you are doing?

14:29 unlink: getting this NPE from lein ring war: http://dpaste.com/728236/

14:30 dnolen: mega`: yes, for all boolean predicates, but that's not enough for common tests

14:30 Vinzent: um, is cljbin down?

14:31 dnolen: mega`: so I added simple type inference for the if test expressions

14:31 Vinzent: mega`, https://refheap.com/paste/1905

14:32 mega`: Vinzent: you can put meta data on the symbols

14:32 Raynes: Awww, refheap was your second choice? :p

14:33 But no, cljbin is not down.

14:33 I lose a chest hair every time you render the page though. Keep it in mind.

14:34 Vinzent: mega`, I'm not sure how this'd help in this case, can you explain?

14:34 mega`: Vinzent: and the binding will not work .. the stack unroles when the macro returns but i ges you know that

14:35 y3di: has anyone done any extensive game dev in clojure?

14:35 mega`: Vinzent: whell in this example i wuld youst put the string "foo" as adition argement to foo

14:35 Vinzent: Raynes, haha, sorry! cljbin has so attractive design, I want to see its main page again and again - I just can't help it! :)

14:36 Raynes: Heh.

14:36 mega`: Vinzent: https://gist.github.com/2331195

14:36 Raynes: I guess if you like a big white box and various shades of purple. :P

14:37 mega`: Vinzent: but i suspect that it dosent end there right?

14:37 Vinzent: mega`, yeah, the whole thing is to avoid explicit argument passing

14:38 mega`: Vinzent: why is that a requierment?

14:38 Vinzent: what is it you are trying to do?

14:39 Vinzent: mega`, the first macro expands to the other macro which is a part of public api, and the *a-var* is kinda implementation detail which I don't want to be present in api

14:40 mega`: Vinzent: what is x in the code is it something you can put metadata on? like a list or vector

14:40 Jesdisciple: I'm trying to use Clooj but the REPL won't evaluate anything... I've made a new project and Clojure itself is installed, anything else I need to do?

14:40 mega`: Vinzent: or can it be annything

14:41 Vinzent: mega`, I think it can be a strin

14:41 *string

14:42 Jesdisciple: never mind, fixedc

14:42 Vinzent: anyway, I think I could live with plain atom - as far as I can see it doesn't really needed to clear the var's value after macros, or to have that stack behaviour

14:43 mega`, thanks for support :)

14:45 sjl: If I have a plugin defined in :plugins [...] of a project.clj for Leiningen2, where does that plugin actually get downloaded to?

14:47 Basically I'm trying to fix lein-generative to work, but I can't seem to get my version in checkouts/ to be seen.

14:47 mega`: sjl: its probebly in ~/.lein somwhere

14:48 sjl: And when I just delete it entirely somehow the (broken) generative task is still being found

14:48 Raynes: Plugins are just maven artifacts. They're stored in the same place as everything else is in ~/.m2

14:49 sjl: Raynes: Hmm, the only thing in .m2 on the classpath according to lein2 classpath is the clojure jar

14:50 mega`: ls .lein/plugins/

14:50 clojurescript-0.0-1011.jar lein-cljsbuild-0.1.5.jar lein-clojurescript-1.1.0.jar swank-clojure-1.4.2.jar

14:50 jonase-kibit-0.0.3.jar lein-clojars-0.8.0.jar lein-noir-1.2.1.jar

14:50 Raynes: That's your project classpath.

14:50 sjl: Raynes: aha, you're right, it is there

14:50 mega`: theres stuff in .lein/pluggin

14:50 Raynes: mega`: That's for lein 1.x.

14:50 lein2 doesn't use that.

14:50 mega`: kk

14:51 sjl: Raynes: okay, I can rm that dir in m2 but now it redownloads the artifact every time, even through I checked it out into checkouts

14:52 Raynes: I don't actually know anything about checkouts or how they work, unfortunately.

14:52 sjl: Raynes: is checkouts/ just for non-lein-plugin deps?

14:52 ah

14:52 Raynes: sjl: Probably want to ask in #leiningen or on the mailing list.

14:53 sjl: Raynes: I guess my question is really "how does one develop a leiningen plugin?"

14:53 samaaron: tell person "Raynes" activate

14:54 Raynes: samaaron: I've been awake for 24 hours. Do not applescript me.

14:54 samaaron: hahahaha

14:55 Raynes: sjl: You're wondering how to develop a leiningen plugin and test it in another project locally, right?

14:55 sjl: Raynes: in a nutshell, yeah

14:55 Raynes: sjl: What I do is just 'lein install' my plugin whenever I make a change. It is tedious, but it works.

14:55 sjl: basically "there's a bug in lein-generative, how can I quickly shave that yak and move on"

14:55 mega`: make a emacs macro

14:55 sjl: ewww

14:56 I mean, AI can use kicker, but still... :\

14:58 oh god it works but feels so dirty: kicker -e 'lein2 install' **/*.clj

14:59 Raynes: sjl: If I *have* to test in a project separate from the plugin project, that's about the best way I know to do it. Unless, of course, checkouts actually do work the way you want and I just don't know it.

14:59 mega`: sjl: also write normal unit tests

15:00 sjl: Raynes: checkouts don't seem to work all all for plugins, unless I'm just doing something entirely wrong

15:25 dgrnbrg: technomancy: you there?

15:48 jaen: what would be the solution for parsing in clojure?

15:49 mega`: jaen: parsing what

15:49 jaen: theres regex :P

15:49 jaen: say parsing assembly

15:50 sjl: jaen: if you're familiar with parser combinators and don't mind a complete lack of docs, parsatron is pretty neat

15:50 dgrnbrg: jaen: are you parsing binary or strings?

15:50 does it have lots of structure or mostly lists?

15:51 sjl: jaen: making a 0x10c assembler in clojure? heh

15:51 dgrnbrg: Also, has anyone used lazy test?

15:51 jaen: sjl: right on the money

15:51 dgrnbrg: strings; just the usual assembly stuff

15:52 sjl: jaen: I'd be way more excited if you implemented a backend that compiled clojurescript to dcpu-16, actually

15:52 dgrnbrg: jaen: you can probably get away w/ regex

15:52 mega`: jaen: if you split the bits into parts u can use pathern matching :P

15:52 sjl: jaen: there are already a bunch of assemblers/emulators out there, but writing code for its cpu in a lisp would be fun

15:52 dnolen: CLJS truth optimizations, http://github.com/clojure/clojurescript/compare/master...optimize-truth, and CLJS protocol dispatch optimizations, http://github.com/clojure/clojurescript/compare/master...optimize-protocol-dispatch, feedback appreciated.

15:53 sjl: would be super cool - and hard - would need to think of GC.

15:53 jaen: sjl: yeah, could be, but I don't know my way around cljs compiler source to pull that off probably

15:53 sjl: dgrnbrg: I think test.generative is the successor to lazytest, though don't quote me on that

15:53 dnolen: yep, not easy at all but the result would be pretty sweet

15:54 dgrnbrg: do you know if there's a lib that automatically reruns my tests when a file changes on disk?

15:54 yoklov: cljs seems like it might be too high-level of a compiler to be readily adaptable to something like that

15:54 jaen: heh, writing a gc inassembly would be somewhat challenging probably ; d

15:55 dnolen: jaen: I think you'd could write the gc in CLJS

15:55 dgrnbrg: dnolen: a really cool avenue that few environments do (afaik) for improving gc on constrained devices is to allocate pools for specific kinds of objects (to enable fast tracing gc b/c there's no dispatch storage overhead) and then have a meta-gc for those pools

15:55 dnolen: yoklov: I'm not so sure - but the CLJS code for that target would be heavily oriented around mutation I think.

15:55 jaen: actually I wanted to write the emulator and assembler first and then maybe some sort of simple extensible language with macros just for the kicks of it

15:56 yoklov: at the very least you'd have to be extremely conservative with the output code, as you don't have much space

15:56 jaen: also this would be my first serious program in clojure, I've dabbled in lisps and haskell before, but didn't code anything remotely big

15:57 dnolen: gc in cljs? I may be dumb, but how would you bootstrap that then?

15:57 sjl: jaen: heh, probably not a good first project then

15:57 yoklov: what is it, 128kb total?

15:57 dgrnbrg: could anyone help me debug my first library on clojars and corresponding lein plugin? I keep getting a really weird error in the lein plugin, but once it's done, everyone can have branch coverage analysis for their tests 

15:57 dnolen: jaen: I'm thinking just repurpose the compiler - leave out the standard lib - create a new one oriented around assembly.

15:58 sjl: jaen: if you want something fun in clojure that's still Mojang-related you could fix whatever the last couple of Minecraft updates broken in https://github.com/sjl/clojurecraft

15:58 though I think the new world format basically means I get to rewrite that godawful chunk parsing code

15:59 jaen: sjl: challenging is good, I think; way more interesting than yet another noir blog for sure ; D

15:59 yoklov: jaen: if you get stuck, take a look at the end of the 5th chapter of SICP, which covers writing a scheme compiler to (a fake) assembly.

15:59 jaen: yeah, got printed sicp on me, remember that part

16:00 pandeiro: jaen: what's wrong with noir blogs ? ;)

16:00 ibdknox: yeah srsly.

16:00 weavejester: Does anyone know the recommended route for managing local dependencies in Lein2?

16:01 I note there's the localrepo plugin, but I'm not sure if there's something in Lein2 that would be better.

16:01 jaen: Well, nothing much except it's webdev I for some reason do not like and having to do Rails at work didn't help ; f

16:02 dgrnbrg: If I have a string, and I am evaluating a macro in some namespace, how can I get a symbol whose namespace is the ns that the macro is called in, and whose symbol-name is the string?

16:03 pandeiro: jaen: i know, webdev (even with noir) still involves too much boilerplate... not sure there's any solution tho

16:03 yoklov: heh, my roommate has been working for about a week trying to write the processor from 0x10c in VHDL. apparently it's quite hard.

16:03 jaen: Hahaha, gotta love nerds : D

16:04 yoklov: haha yup. I guess the "multiplication happens in 2 cycles" is what makes it tough

16:04 pipeline: yoklov: go figure man with no experinece in hardware designs hardware and it sucks to implement in hardware :P

16:05 yoklov: hahaha, yeah

16:05 ibdknox: pandeiro: example?

16:06 pandeiro: ibdknox: just looking at the CRUD gen that was on the mailing list... i use couchdb so it's not applicable... lotta scaffolding to set up for basic ops

16:06 maybe that is not automatable

16:06 not a criticism at all of what noir offers btw, just thinking out loud

16:06 sjl: pandeiro: you might find this interesting: http://www.screenr.com/ysd8

16:06 pandeiro: as someone relatively new to webdev but starting to feel beginner fatigue at writing the sos all the time

16:07 mega`: dnolen: your creating a testsym https://github.com/clojure/clojurescript/compare/master...optimize-truth#L0R343

16:07 ibdknox: pandeiro: yeah, it's something I've thought a lot about, but fundamentally I think that's just how programming is

16:07 I don't think that's an artifact of it being on the web

16:07 dnolen: ibdknox: on an optimization kick today, looking into fn arity dispatch optimization.

16:07 ibdknox: dnolen: oo

16:08 dnolen: awesome :D

16:08 dnolen: I created a version of the compiler that gives me column/line meta on all symbols that get read

16:08 now I'm trying to use that through the analyzer :)

16:09 pandeiro: ibdknox: it's probably not a problem that should be solved at the app framework level, more of a bash thing... and models are not 'generalizable' from app to app i'm finding

16:09 dnolen: ibdknox: between those two branches and this one I'm about to start I think, this works covers most of the possible low level optimizations. Moving forward, optimizations will be data structure related.

16:09 ibdknox: pandeiro: yeah, unfortunately few things are generalizable even at the view level

16:09 dnolen: ibdknox: cool, I'm assuming you're using that for something fun :)

16:10 ibdknox: dnolen: that's very exciting!

16:11 dnolen: I might have a real-time debugger cooler than bret's binary search demo ;)

16:11 pandeiro: websites are weird in that way. But in terms of models, I've never found them to be generalizable regardless of what platform you're building for. Business logic is always specific :)

16:12 pandeiro: unfortunately programming has its fair share of boring lol

16:12 pandeiro: we might be able to do better though, just gotta think about it more :D

16:14 pandeiro: I actually tried the generalization route btw, in a php framework once upon a time ago

16:14 built some cool websites with it

16:14 dnolen: ibdknox: haha cool! like a high level interactive thing? not like a stepping debugger for inspecting locals and such.

16:15 ibdknox: dnolen: type some code, see a ghosted version with all the values filled in for their variables :)

16:15 basically a repl on crack

16:16 pandeiro: ibdknox: yeah in my short webapp building career i've found that over-eager generalization is 100x worse down the road than having to type out boilerplaty stuff

16:16 ibdknox: definitely

16:17 things like defremote are nice though

16:17 they help make organization seem more natural and less boiler-platey

16:18 pandeiro: yeah, part of it is definitely psychological... i am not the most anal organization type but i have been trained to think something's wrong if i am typing the same shit over and over

16:18 i am wondering right now if porting that CRUD generator to a couchdb version is a worthwhile endeavor or not

16:19 ibdknox: fwiw, I'm definitely not convinced we've really figured it out

16:19 I think there's a better abstraction waiting out there

16:19 pandeiro: we will keep banging out apps and it will appear, hopefully :)

16:20 i also wonder if there is such a thing as 'backend-agnostic', in this context... my initial intuition is no

16:21 ibdknox: in the context of crud?

16:21 pandeiro: yeah, basic database-centric webapps

16:21 ibdknox: only if someone created the magical set of über semantics

16:21 pandeiro: right

16:21 ibdknox: for datastore interaction

16:21 which is theoretically possible

16:21 jimduey sent me a paper on it after I built korma

16:21 it's a GSOC project ;)

16:22 no one has talked to me about that one though

16:22 pandeiro: well if you're still doing this when my 4-year-old has started coding, maybe he'll hit you up ;)

16:22 ibdknox: haha

16:23 yoklov: haha, the "abstract away data-store semantics" gsoc proposal sounded impossible

16:24 or that you would need to be insanely smart to come up with a reasonable abstraction

16:25 ibdknox: I actually don't think it's that hard

16:25 to be honest

16:25 at least not to build the first parts of it

16:25 pandeiro: well in a very over simplified sense, isn't 'CRUD' already the abstraction? what if you could do (read db-name "by-timestamp-column") and it would just work, regardless of backend? is that impossible?

16:25 (assuming maybe some config specification i guess)

16:26 ibdknox: pandeiro: you'll need to create notions of uniqueness, the idea that fields exist and can be queries against, etc

16:26 take the user case as an example

16:26 select a user by name

16:27 hm, I guess ID's could be an implementation detail..

16:27 pandeiro: yeah i have a tough time thinking through these things until i'm trying to implement them, i admit

16:28 yoklov: hm, i probably don't know enough about non-relational databases, i thought that abstracting both their semantics and the semantics of relational db's would… end up in one of them being favored.

16:28 ibdknox: yeah, not something I'm currently interested in tackling :)

16:28 yoklov: shouldn't be

16:28 pandeiro: and then there's couchdb having no adhoc querying to begin with...

16:28 ibdknox: though each backend will have tradeoffs

16:29 I had a simple proof of concept of korma over objects

16:29 which is basically the "worst" (or best, depending on how you think of it) backend

16:29 it provides you the least

16:30 but meh, maybe core.logic is the future ;)

16:31 pandeiro: what about rich hickey's new database? have you looked at it?

16:31 ibdknox: datomic

16:31 yeah

16:31 pipeline: database-as-a-service, isn't it

16:31 pandeiro: i'm completely ignorant but i assumed it would be pretty congruent to clojure's semantics

16:31 ibdknox: mhm

16:32 pandeiro: is it only available as a service?

16:32 ibdknox: You can run something locally

16:32 I don't think you can host the whole thing yourself though

16:32 but I didn't look into it too deeply

16:33 pandeiro: ibdknox: what are you using at the startup you work for, if i can ask?

16:33 ibdknox: I actually just left to start my own

16:33 but RFZ we used Clojure + postgres

16:33 and mongo for random things

16:33 at RFZ*

16:33 pandeiro: what was the thinking behind using mongo for random things?

16:34 ibdknox: fast writes, schemaless

16:34 pandeiro: easier than doing all the DDL?

16:34 k

16:34 ibdknox: I like mongo

16:34 it's nice for certain things

16:34 I actually really liked redis when I used it for typewire

16:35 pandeiro: why use postgres at all then?

16:35 ibdknox: because NoSQL is terrible at relational data

16:35 we also started with a django site

16:36 that used postgres

16:36 pandeiro: and some data really is relational by nature?

16:36 ibdknox: I think a fair number of things are more easily expressed relationally

16:37 pandeiro: i notice that i am witnessing that with the way i use couchdb, so much so that i am beginning to wonder why not use a relational db

16:37 weavejester: Does anyone know where Leiningen keeps its record of snapshot libs? It seems to be stuck, thinking a dependency isn't there when it is.

16:37 oskarth: this is turning into an interview; but may I ask why you left RFZ? Seems like you just recently started working there

16:38 pandeiro: oskarth: he's a worthy subject :) i'll hand it off to you

16:39 one thing that is awesome about clojure is the patience and generosity of the more advanced members of the community; awesome for those of us still at the bottom of the learning curve

16:39 weavejester: Ah, nevermind. Problem resovled by deleting the .m2/project directory

16:39 ibdknox: I was always hired with the knowledge that I'd want to do my own thing at some point and we left on very good terms

16:39 oskarth: I see :)

16:39 ibdknox: they're hiring!

16:39 weavejester: ibdknox: Have you set off to do your own thing, then?

16:40 ibdknox: and they're really a great team, and working on something that actually matters

16:40 weavejester: I ask because I've been considering doing the same.

16:40 ibdknox: weavejester: yessir :)

16:40 mega`: RFZ stands for?

16:40 ibdknox: ReadyForZero

16:40 https://www.readyforzero.com

16:40 weavejester: ibdknox: Do you have anything specific in mind to do, or is that a secret? :)

16:41 ibdknox: weavejester: working on some thinge for the medical industry :) Hopefully to help curb some of the waste happening in healthcare

16:41 Figured I worked on helping people out of debt, time to save some lives ;)

16:42 weavejester: ibdknox: Ah. Anything to do with the pharma industry / clinical trials by any chance?

16:43 ibdknox: weavejester: it definitely has applications there, though likely in a slightly different sense than you might be asking about. A lot of it is around teasing out best practices when it comes to medicine

16:44 weavejester: any sense what you'd be interested in doing?

16:45 a definite goal of mine this year is to get speaking again. Spreading the word about the awesome stuff you can do with clj(s)

16:46 weavejester: ibdknox: I'm currently employed by Medidata, who are one of the big players in clinical trial and drug testing software. Just in case you need a contact in that area, though it looks like you'll probably be in a slightly different area.

16:46 ibdknox: ah very interesting

16:46 weavejester: ibdknox: My goal is to actually start speaking ;) - I've yet to do a Clojure talk, but I'm putting one together for Ring.

16:46 ibdknox: awesome!

16:46 I did it a ton for MSFT

16:47 haven't as much since I've left

16:47 but I've got a couple things lined up for this year I think

16:47 weavejester: ibdknox: I've done quite a few internal talks, but never any external ones.

16:47 ibdknox: You've gotta make it state side so I can actually meet you. :)

16:49 weavejester: ibdknox: Are you west or east coast?

16:49 ibdknox: San Francisco these days

16:50 Alternatively maybe I can find an excuse to end up in the UK :D

16:50 oskarth: euroclojure.com/2012/ !

16:51 ibdknox: unforunately the timing doesn't work out for me on that one

16:51 weavejester: ibdknox: San Francisco is one of my "to-visit" places. Maybe I'll try to make next Clojure West.

16:51 ibdknox: :)

16:52 or you could come to the conj

16:52 I'll find my way there somehow

16:52 weavejester: ibdknox: I'm going to the Euro conj

16:53 ibdknox: Are there any US conjs left?

16:53 ibdknox: the official one should be toward the end of the year

16:53 http://clojure-conj.org/

16:54 in NY it looks like by that picture

16:54 weavejester: it'd be an opportunity to speak ;)

16:54 weavejester: ibdknox: Ah, I should be able to make that one.

16:55 You have a good point… I missed the deadline for the EuroClojure talks.

16:55 ibdknox: I'm doing a couple talks in Sweden toward the end of the year

16:55 weavejester: I was planning on doing something for the ldnclj group

16:55 ibdknox: Any particular reason you'll be over there? Aside from the talks?

16:56 ibdknox: They asked me to come speak at Oredev: http://oredev.org/

16:56 weavejester: Ah, awesome :)

16:59 ibdknox: alright folks, gotta run

17:01 weavejester: bye

17:05 konr: Can I easily serialize a function for later retrieval with something like `(spit "/tmp/foo" (serialize #(+ 3 %)))`?

17:11 arohner: konr: not really. anonymous fns aren't serializable

17:12 you can serialize the name of a fn, and call it later, by name

17:15 beffbernard: konr: you can also use pr-str

17:15 As long as your functions are pure

17:16 arohner: beffbernard: how would that work?

17:16 ibdknox: and capture no free vars :p

17:16 arohner: ,(pr-str #(+ 3 %))

17:16 clojurebot: "#<sandbox$eval28$fn__29 sandbox$eval28$fn__29@18b41da>"

17:16 ibdknox: = a uesless function

17:16 ,(pr-str '#(+ 3 %))

17:16 clojurebot: "(fn* [p1__56#] (+ 3 p1__56#))"

17:16 ibdknox: ;)

17:18 beffbernard: I've used this before.. (defn serialize-bytes [x] (binding [*print-dup* true] (let [s (pr-str x)] (.getBytes s "UTF-8"))))

17:19 ibdknox: better is to think about the problem differently

17:19 create a function that based on some straightforward input returns you the function you need

17:19 beffbernard: ibdknox: yeah you don't want to mess around with closures

17:20 ibdknox: generate the function at the time it's needed

17:24 technomancy: clojurebot: serializable-fn?

17:24 clojurebot: serializable-fn is a hack for preserving source of a compiled function: https://github.com/technomancy/serializable-fn

17:33 autodidakto: ,(doc pmap)

17:33 clojurebot: "([f coll] [f coll & colls]); Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahead of the consumption, but doesn't realize the entire result unless required. Only useful for computationally intensive functions where the time of f dominates the coordination overhead."

18:03 unlink: I'm having difficulty debugging a NullPointerException raised from within Leiningen.

18:07 How do I bootstrap and debug leiningen? e.g. http://dpaste.com/728236

18:22 emezeske: technomancy: Should I expect "trampoline" to work with lein2 at this point?

18:37 technomancy: Nevermind my question, my problem has something to do with the subtleties of :eval-in and :trampoline-promise (and my lack of understanding thereof).

18:42 daniel: when i try this in the repl it outputs correctly (properly escaped string): (pprint-json (:body (client/get "https://graph.facebook.com/19292868552")))]]))

18:42 sorry, few too many brackets there

18:43 but i try it in a [:code {:class "prettyprint"} here] and i get nothing (noir)

18:43 just get <code class="prettyprint"></code>

18:44 emezeske: daniel: pprint-json does not return a string, it prints it to *out* (which is usually stdout)

18:45 daniel: Looks like you want json-str

18:47 daniel: aah, thanks

18:48 that has indeed done the trick

18:48 Bronsa: or wrap it with with-out-str

18:49 daniel: i actually want something else entirely

18:50 im trying to get it to pretty print in the browser (nice colours / indentation)

18:50 emezeske: daniel: I don't think clojure.data.json is meant for that.

18:50 daniel: i think i just want (:body (client/get .... and then format it with javascript

18:53 TimMc: Ew, is this right? If I hint the return value of a function in one namespace as ^File (with (:import (java.io File)) in ns) and then call that fn from another namespace that has no such import, there's a classname resolution error.

18:53 daniel: im not sure how to get the formatting, i've got the syntax highlighting

18:53 i thought pprint-json might get me the formatting

18:55 TimMc: Here's an example of this fail: https://gist.github.com/2332669

18:57 Bronsa: TimMc: shouldn't the hint go before the function name?

18:57 TimMc: I think it goes on the arglist.

18:59 Bronsa: From experimentation, look slike it can go either place.

19:00 amalloy: hinting the arglist is intended for (or at least related to) primitive typehints

19:00 Bronsa: oh, ok

19:00 TimMc: hum

19:00 amalloy: and is a newer option; hinting the name is an older method

19:02 Bronsa: http://sprunge.us/UdNV

19:02 am i missing something?

19:03 amalloy: i guess you're missing what i just said about primitive typehints?

19:03 Bronsa: that may be it.

19:04 amalloy: arglist typehinting uses a different mechanism entirely from :tag meta

19:06 TimMc: OK, interesting -- the problem I'm seeing only occurs with arglist hinting.

19:14 amalloy: TimMc: is it okay if i smugly note that File isn't a primitive?

19:24 Bronsa: amalloy http://clojure.org/java_interop type hinting section

19:25 "For function return values, the type hint can be placed before the arguments vector" and it type hints the argvector with String

19:26 this is not true anymore, right?

19:31 dleja: Hey, if someone wouldn't mind helping me, I can't find this on google... How do i add a java library path in swank clojure mode (for emacs)? i can access the library through the lein repl after i added $LD_LIBRARY_PATH to the bash environment, but the swank server still can't find the library. What's equivalent procedure for adding the library path to swank? bump

19:38 emezeske: Anyone know if there's a handy way to compare JAR versions from clojure? E.g. (compare-version "1.2.1-SNAPSHOT" "1.3.0") => 1

19:43 dnolen: hmm is "lein kibit" not working for other people?

19:48 multi-arity fns will get a lot cheaper in CLJS, http://github.com/clojure/clojurescript/compare/master...optimize-fn-arity, working now on making the optimization work all the way through to deftype protocol fn implementations.

19:53 emezeske: dnolen: That is awesome.

19:57 technomancy: dleja: set :jvm-opts ["-Djava.library.path=/whatever"] in project.clj

19:58 emezeske: I had to roll my own version comparator, but you can steal it from leiningen.core.main

20:01 emezeske: technomancy: I ended up using org.apache.maven.artifact.versioning.DefaultArtifactVersion

20:02 technomancy: emezeske: that works as long as versions are always three-segmented

20:02 it applies different logic for non-three-segmented version numbers

20:02 1.6.1.1 is lower than 1.6.1 according to DefaultArtifactVersion, for instance

20:02 just FYI

20:05 emezeske: technomancy: argg

20:10 TimMc: amalloy: Can I smugly point out that the docs are wrong?

20:10 amalloy: welcome to clojure, TimMc :P

20:10 TimMc: yup

20:11 Although... it works *sometimes*.

21:00 konr: What was again that function to alter just part of a structure, like the :X in {:a 3 {:b [11 22 33 {:X 4}]}}?

21:01 amalloy: update-in

21:01 konr: yes, thanks!

21:01 amalloy: &(update-in {:a 3 {:b [11 22 33 {:X 4}]}} [:a :b 3 :X] inc)

21:01 lazybot: java.lang.RuntimeException: Map literal must contain an even number of forms

21:01 amalloy: &(update-in {:a {:b [11 22 33 {:X 4}]}} [:a :b 3 :X] inc)

21:01 lazybot: ⇒ {:a {:b [11 22 33 {:X 5}]}}

21:39 muhoo: how would i get lein to include java sources in a jar?

21:40 it includes the .clj sources by default, even though it's aot compiled. but it doesn't seem to be including the java sources.

21:50 * muhoo thinks he may be writing his first lein hack

21:51 * gfredericks imagines a plugin called lein-hack such that you can `lein hack ...`

21:52 emezeske: muhoo: Can't you just put the java sources in the :resource-path ?

21:56 muhoo: if i can have multiple resource-paths, then sure, i could add project/srcj to that

21:56 i only get one resource-path in lein 1.7 tho

21:56 emezeske: muhoo: Ah, lein2 supports multiple

21:57 muhoo: Might be something you can do with symlinks or some such

21:57 * emezeske out.

21:58 muhoo: ok

21:59 bbloom: do sorted-sets have any functions similar to those in redis? http://redis.io/commands#sorted_set

21:59 i'd really like to have a sorted-set-by and then get a range of values

22:00 i've got some hash-maps representing "events" with :timestamp keys & i'd like to efficiently slice and dice a set of events

22:00 hobbyist: clojurebot: Is there any change a brief description would accompany clojars.org posts?

22:00 clojurebot: Gabh mo leithscéal?

22:07 hobbyist: clojurebot: Sint total de acord.

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

22:08 hobbyist: clojurebot: you first: Gabh mo leithscéal?

22:08 clojurebot: It's greek to me.

22:12 gfredericks: bbloom: I expect finger trees can give you what you want

22:14 bbloom: this one: https://github.com/clojure/data.finger-tree ?

22:15 gfredericks: I guess so

22:16 I thought it was in the core distribution but I guess it got moved out

22:16 muhoo: gfredericks: i meant hooke, not hack

22:17 amalloy: bbloom: sorted sets have that feature

22:17 &(doc subseq)

22:17 lazybot: ⇒ "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"

22:18 amalloy: &(subseq (sorted-set 5 9 1 6 3 2) > 3 < 8)

22:18 lazybot: ⇒ (5 6)

22:18 gfredericks: amalloy: I learn so much from you by answering poorly

22:18 bbloom: oh! perfect! thanks!

22:18 gfredericks: thank you too :-)

22:19 amalloy: subseq is a hidden little gem

22:19 bbloom: yeah, that's awesome

22:20 i see the return type is KeySe1q

22:20 amalloy: see also rsubseq for going the other way

22:20 bbloom: so i assume it's lazy, so i can easily do:

22:20 amalloy: indeed, it is

22:20 bbloom: &(take 10 (subseq (sorted-set 5 7 1 2 4 4) > 3))

22:20 lazybot: ⇒ (4 5 7)

22:20 amalloy: but it's not obvious to me why that would matter

22:20 bbloom: and expect that to be fast? :-)

22:21 i'm gonna have a pretty large sorted set & might be reading it across the network

22:21 amalloy: the set itself isn't lazy, so...

22:21 bbloom: right, but the set is persistent

22:21 amalloy: i mean, you definitely can get a gain from the laziness of subseq in some circumstances

22:24 bbloom: so the reason i asked about laziness was b/c i plan to use only a start point on the subseq

22:24 i don't necessarily want time0 to time1

22:24 i want time0 + 10 items

22:25 amalloy: right, pagination. so it does what you probably want

22:25 bbloom: but in reality, i need to filter the items further, so it might be step 1) fetch 100 items, step 2) filter them, step 3) possibly load another page

22:25 kinda like reading from a file system in blocks

22:25 1 other question: is there a constant time way to get the reverse of a sorted set?

22:26 amalloy: *cough* see above

22:26 rsubseq (and rseq)

22:26 bbloom: haha ok perfect

22:26 thanks for your help

22:26 clojure's core libs continue to impress :-)

22:27 amalloy: be aware that all these give you a seq back, not a set

22:27 bbloom: yup, that's what i expected

22:38 unlink: is there a shorthand for (difference #{:some :set} (set (keys {:some :map}))) ?

22:40 bbloom: unlink: other than defn? ;-)

22:46 gfredericks: unlink: (apply disj #{:some :set} (keys {:some :map})) maybe?

22:50 unlink: hmm

22:50 gfredericks: that at least avoids creating a new set just for fun

22:51 amalloy: that's not the same as what he asked for though

22:51 gfredericks: it ain't?

22:51 amalloy: i guess maybe it is. i was thinking of symmetric-difference; does difference not do that?

22:52 gfredericks: ,(doc symmetric-difference)

22:52 clojurebot: excusez-moi

22:52 amalloy: well it's not a builtin afaik

22:52 &(clojure.set/difference #{1 2} #{2 3})

22:52 lazybot: ⇒ #{1}

22:52 amalloy: i was thinking he wanted #{1 3}

22:52 gfredericks: ah just wikipedia'd it

22:53 yeah I think whenever I want sym-diff I combine diff and intersection

22:53 hobbyist: Scuze. I figured it was Irish.

22:55 @Greek: I don't understand, but I agree.

23:23 blakesmith: Anyone know how to enable request logging when using the ring jetty adapter?

23:51 Ah, figured it out. My log4j.properties was misconfigured.

Logging service provided by n01se.net