#clojure logs

2012-04-07

00:14yoklovhobbyist: evaluate "*ns*"
00:14yoklovor
00:15yoklovreally the solution is just to do "(in-ns 'your.ns.here)"
00:17hobbyistyoklov: It's my first less of clojure
00:17yoklovthat's okay
00:17yoklovat the top of your file is there a "(ns foo.bar)" or something?
00:18hobbyist(ns edu.clojure.HelperClojure ;(:gen-class :as HelperClojure))
00:19hobbyistI tried to add the root source file path to the repl startup with -i; no avail
00:19yoklovokay then in your repl try "(in-ns 'edu.clojure.HelperClojure)"
00:21hobbyistPerfect. I was not prefixing the \' to the FQN
00:21hobbyistThe file runs first time when loaded in repl. Surprisingly the namespace does not persist
00:22hobbyistyoklov: thanks
00:25logaan1in 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?
00:37arohnerlogaan1: https://github.com/Chouser/clojure-classes/blob/master/graph-w-legend.png
00:39logaan1thanks dude
00:59devnhobbyist: not trying to nitpick but: HelperClojure => helper-clojure
01:06yoklovhobbyist: you probably also don't want the gen-class.
01:06yoklovunless you're sure you need it.
01:07hobbyistI used :gen to see if it helped wit the classpath; in-ns did it.
01:08hobbyisthelper-class is nitpick; capital offense. No more clojure.
01:09hobbyisttonight
01:12hobbyistwhat is the difference between "require" and "in-ns"?
01:13laurusHow do I uninstall Clojure 1.2 version from Maven?
01:15yoklovhobbyist: in-ns changes your namespace, require loads libraries (namespace does not change)
01:57doctor88hi
01:59doctor88hi
03:17jhicknerIs it bad form to do things like this? https://gist.github.com/2326125
03:18jhicknerthe lock is for an object being manipulated by multiple people over websockets
03:18jhicknera clojurescript project
03:22jhicknerI like just needing to import one function instead of all 3
03:53amalloywell, that approach is very scheme-y
03:55amalloyjhickner: the closure approach is very scheme-y, and probably wouldn't be popular with clojure programmers
03:55amalloyperhaps more importantly, your set! looks weird/broken
03:57amalloyif 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)
03:59amalloy(i'll amend that to "if you really loved message-passing")
03:59amalloy(because, really, everyone loves closures)
04:09jhicknerthanks amalloy
04:11jhicknerthere's just something about encapsulating everything in one nice package. but thats probably just my OO sensibilities.
04:24dlejaHey, 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?
05:23Cr8anyone using vimclojure or nailgun with lein2?
06:38fmnWill jetty / ring use one thread per connection? I want to expose an expensive operation over http.
06:38clojurebotI don't understand.
07:40RaynesI just edited an AppleScript file. Someone kill me.
08:36andyfingerhutAnyone 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.
08:37mega`theres a *print-length*
08:38andyfingerhutI'll test that with my local REPL rather than clojurebot :)
08:38samaaronRaynes: consider yourself spared - death isn't something you should be encouraging so readily
08:39Raynessamaaron: But man, it's applescript.
08:39samaaronRaynes: But man, it's DEATH
08:39RaynesYou do know I was joking, right? Surely.
08:39samaaronhaha
08:39samaaronof course i do
08:39Raynes:p
08:39mega`Raynes: i want to hear about your pains :D
08:40mega`Raynes: you need to program in applescript?
08:40samaaronRaynes: you should be hacking Quil for the ART-WIN instead
08:40Raynesmega`: I was mostly exaggerating. I deleted a few lines so that my /np IRC client command doesn't print such long now playing messages.
08:41Raynes /inp
08:41Raynes<3
08:44oakwisesamaaron: did you ever figure out that chrome thing?
08:45hcumberdalehi there! Is there a better way to write this: (map #(if (= "Welcome" (:name %1)) (assoc %1 :selected true) %1) (find-maps "categories"))
08:45RaynesTIL samaaron is Dr. Sam Aaron.
08:46andyfingerhutAh, *print-length* and *print-level* are my friends.
08:46andyfingerhutTaking over the world, one bit of functionality at a time.
08:47mega`andyfingerhut: you know your suposed to use them with (binding ..) right?
08:47andyfingerhutyep. Thanks for the heads up, though.
08:48Raynesandyfingerhut is a lean mean (binding machine).
08:48mega`im going to pretend i dident smile abit from that :P
08:49andyfingerhutLately 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.
08:51mega`hcumberdale: you can write this (for [m (find-maps)]
08:51mega` (if (= (:name m) "Welcome")
08:51mega` (assoc m :selected true)
08:51mega` m))
08:51mega`hcumberdale: not shorter but nicer
08:52hcumberdalethx mega`
09:44jondot1hi 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
09:45jondot1specifically, 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
09:47mega`the last expression in the function is returned
09:47mega`use let if you need to do the calculation before the file thing
09:49mega`(let [calc-result (calculation)] (file-thing calc-result) calc-result)
09:49jondot1ah. i see. is there a 'with-' construct?
09:50mega`with-file?
09:50jondot1that deletes a file at the end?
09:50mega`http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/with-open
09:51jondot1i see, thanks
09:58AimHereFrom the repl, '(apropos with)' might have clued you in as to all the with-foo commands
10:35jondot1so, it is acceptable to call a 'heavy' function in a letrec body?
10:36jondot1sorry, in a let body
10:36jondot1that is (let [my-result (heavy-stuff ...params)]
10:41progoI do it all the time.
10:41progoperhaps using -> would be more idiomatic but what the heck.
10:51devnAimHere: only if you have '
10:51devnAimHere: (use 'clojure.repl)
10:56gavilancomun#overtone
10:59gavilancomunHi, 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:01groovemonkeyhi 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:02sattvikgavilancomun: try vector
11:04AimHere,(zipmap (list :a1 :a2 :a3) (repeat (hash-map))
11:04clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
11:04AimHereMaybe one more bracket
11:04AimHere,(zipmap (list :a1 :a2 :a3) (repeat (hash-map)))
11:04clojurebot{:a3 {}, :a2 {}, :a1 {}}
11:04groovemonkeyawesome! Thanks AimHere.
12:18dotemacsHey guys, if you're into Emacs, you might like this potential Emacs Conf: http://emacsconf.herokuapp.com/
12:36wysinwygquestion: 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:36wysinwygfor a single one, this seems to work:
12:37wysinwyg(dosync (assoc-in @cities [:city1 :streets] "street1"))
12:37wysinwygbut 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:38wysinwygI just get a IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Symbol clojure.lang.RT.seqFrom (RT.java:487)
12:49offby1Any 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:20Cyrikhey, could someone point me to a resource on how to left-associative expressions with fnpars?
13:26unlinkIn upgrading to lein2, how do I enable lein-ring for my project?
13:33fliebelunlink: Enable? Is lein-ring compatible with lein2?
13:33weavejesterfliebel: It is
13:33fliebelcool
13:34unlinkit 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:39mindbender1when I need to specify more than one state for gen-class, how do I write that?
13:40unlinkoh, it turns out that the problem was that I had both lein-1.7.x installed and lein 2.0.0 installed (as lein2)
14:12mega`dnolen: what is the type inference for?
14:18jonasen,(defprotocol IMarker "Empty marker protocol")
14:18clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
14:18jonasen^ works in cljs but not in clj. Is that correct?
14:19dnolenjonasen: yes
14:20jonasendnolen: Is there a reason for that?
14:20dnolenmega`: CLJS takes a huge performance hit from truth testing, it's my current mission to eliminate them wherever possible.
14:20dnolenjonasen: not that I'm aware of, I recall seeing a CLJ ticket for it.
14:21VinzentHi. 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:22dnolenmega`: I've already succeeded at eliminating just about all of them from PersistentVector
14:24mega`dnolen: so you remove the truth test when theres a (= ..) case and things like that?
14:25Vinzentok, I think I'd just leave things as they are now...
14:26mega`Vinzent: post a gist or something
14:27mega`Vinzent: i dont realy get the problem... you shuld probebly not use global state with macros
14:27mega`Vinzent: what is it you are doing?
14:29unlinkgetting this NPE from lein ring war: http://dpaste.com/728236/
14:30dnolenmega`: yes, for all boolean predicates, but that's not enough for common tests
14:30Vinzentum, is cljbin down?
14:31dnolenmega`: so I added simple type inference for the if test expressions
14:31Vinzentmega`, https://refheap.com/paste/1905
14:32mega`Vinzent: you can put meta data on the symbols
14:32RaynesAwww, refheap was your second choice? :p
14:33RaynesBut no, cljbin is not down.
14:33RaynesI lose a chest hair every time you render the page though. Keep it in mind.
14:34Vinzentmega`, I'm not sure how this'd help in this case, can you explain?
14:34mega`Vinzent: and the binding will not work .. the stack unroles when the macro returns but i ges you know that
14:35y3dihas anyone done any extensive game dev in clojure?
14:35mega`Vinzent: whell in this example i wuld youst put the string "foo" as adition argement to foo
14:35VinzentRaynes, haha, sorry! cljbin has so attractive design, I want to see its main page again and again - I just can't help it! :)
14:36RaynesHeh.
14:36mega`Vinzent: https://gist.github.com/2331195
14:36RaynesI guess if you like a big white box and various shades of purple. :P
14:37mega`Vinzent: but i suspect that it dosent end there right?
14:37Vinzentmega`, yeah, the whole thing is to avoid explicit argument passing
14:38mega`Vinzent: why is that a requierment?
14:38mega`Vinzent: what is it you are trying to do?
14:39Vinzentmega`, 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:40mega`Vinzent: what is x in the code is it something you can put metadata on? like a list or vector
14:40JesdiscipleI'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:40mega`Vinzent: or can it be annything
14:41Vinzentmega`, I think it can be a strin
14:41Vinzent*string
14:42Jesdisciplenever mind, fixedc
14:42Vinzentanyway, 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:43Vinzentmega`, thanks for support :)
14:45sjlIf I have a plugin defined in :plugins [...] of a project.clj for Leiningen2, where does that plugin actually get downloaded to?
14:47sjlBasically I'm trying to fix lein-generative to work, but I can't seem to get my version in checkouts/ to be seen.
14:47mega`sjl: its probebly in ~/.lein somwhere
14:48sjlAnd when I just delete it entirely somehow the (broken) generative task is still being found
14:48RaynesPlugins are just maven artifacts. They're stored in the same place as everything else is in ~/.m2
14:49sjlRaynes: Hmm, the only thing in .m2 on the classpath according to lein2 classpath is the clojure jar
14:50mega` ls .lein/plugins/
14:50mega`clojurescript-0.0-1011.jar lein-cljsbuild-0.1.5.jar lein-clojurescript-1.1.0.jar swank-clojure-1.4.2.jar
14:50mega`jonase-kibit-0.0.3.jar lein-clojars-0.8.0.jar lein-noir-1.2.1.jar
14:50RaynesThat's your project classpath.
14:50sjlRaynes: aha, you're right, it is there
14:50mega`theres stuff in .lein/pluggin
14:50Raynesmega`: That's for lein 1.x.
14:50Rayneslein2 doesn't use that.
14:50mega`kk
14:51sjlRaynes: 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:52RaynesI don't actually know anything about checkouts or how they work, unfortunately.
14:52sjlRaynes: is checkouts/ just for non-lein-plugin deps?
14:52sjlah
14:52Raynessjl: Probably want to ask in #leiningen or on the mailing list.
14:53sjlRaynes: I guess my question is really "how does one develop a leiningen plugin?"
14:53samaarontell person "Raynes" activate
14:54Raynessamaaron: I've been awake for 24 hours. Do not applescript me.
14:54samaaronhahahaha
14:55Raynessjl: You're wondering how to develop a leiningen plugin and test it in another project locally, right?
14:55sjlRaynes: in a nutshell, yeah
14:55Raynessjl: What I do is just 'lein install' my plugin whenever I make a change. It is tedious, but it works.
14:55sjlbasically "there's a bug in lein-generative, how can I quickly shave that yak and move on"
14:55mega`make a emacs macro
14:55sjlewww
14:56sjlI mean, AI can use kicker, but still... :\
14:58sjloh god it works but feels so dirty: kicker -e 'lein2 install' **/*.clj
14:59Raynessjl: 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:59mega`sjl: also write normal unit tests
15:00sjlRaynes: checkouts don't seem to work all all for plugins, unless I'm just doing something entirely wrong
15:25dgrnbrgtechnomancy: you there?
15:48jaenwhat would be the solution for parsing in clojure?
15:49mega`jaen: parsing what
15:49mega`jaen: theres regex :P
15:49jaensay parsing assembly
15:50sjljaen: if you're familiar with parser combinators and don't mind a complete lack of docs, parsatron is pretty neat
15:50dgrnbrgjaen: are you parsing binary or strings?
15:50dgrnbrgdoes it have lots of structure or mostly lists?
15:51sjljaen: making a 0x10c assembler in clojure? heh
15:51dgrnbrgAlso, has anyone used lazy test?
15:51jaensjl: right on the money
15:51jaendgrnbrg: strings; just the usual assembly stuff
15:52sjljaen: I'd be way more excited if you implemented a backend that compiled clojurescript to dcpu-16, actually
15:52dgrnbrgjaen: you can probably get away w/ regex
15:52mega`jaen: if you split the bits into parts u can use pathern matching :P
15:52sjljaen: there are already a bunch of assemblers/emulators out there, but writing code for its cpu in a lisp would be fun
15:52dnolenCLJS 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:53dnolensjl: would be super cool - and hard - would need to think of GC.
15:53jaensjl: yeah, could be, but I don't know my way around cljs compiler source to pull that off probably
15:53sjldgrnbrg: I think test.generative is the successor to lazytest, though don't quote me on that
15:53sjldnolen: yep, not easy at all but the result would be pretty sweet
15:54dgrnbrgdo you know if there's a lib that automatically reruns my tests when a file changes on disk?
15:54yoklovcljs seems like it might be too high-level of a compiler to be readily adaptable to something like that
15:54jaenheh, writing a gc inassembly would be somewhat challenging probably ; d
15:55dnolenjaen: I think you'd could write the gc in CLJS
15:55dgrnbrgdnolen: 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:55dnolenyoklov: I'm not so sure - but the CLJS code for that target would be heavily oriented around mutation I think.
15:55jaenactually 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:56yoklovat the very least you'd have to be extremely conservative with the output code, as you don't have much space
15:56jaenalso 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:57jaendnolen: gc in cljs? I may be dumb, but how would you bootstrap that then?
15:57sjljaen: heh, probably not a good first project then
15:57yoklovwhat is it, 128kb total?
15:57dgrnbrgcould 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:57dnolenjaen: I'm thinking just repurpose the compiler - leave out the standard lib - create a new one oriented around assembly.
15:58sjljaen: 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:58sjlthough I think the new world format basically means I get to rewrite that godawful chunk parsing code
15:59jaensjl: challenging is good, I think; way more interesting than yet another noir blog for sure ; D
15:59yoklovjaen: 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:59jaenyeah, got printed sicp on me, remember that part
16:00pandeirojaen: what's wrong with noir blogs ? ;)
16:00ibdknoxyeah srsly.
16:00weavejesterDoes anyone know the recommended route for managing local dependencies in Lein2?
16:01weavejesterI note there's the localrepo plugin, but I'm not sure if there's something in Lein2 that would be better.
16:01jaenWell, 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:02dgrnbrgIf 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:03pandeirojaen: i know, webdev (even with noir) still involves too much boilerplate... not sure there's any solution tho
16:03yoklovheh, my roommate has been working for about a week trying to write the processor from 0x10c in VHDL. apparently it's quite hard.
16:03jaenHahaha, gotta love nerds : D
16:04yoklovhaha yup. I guess the "multiplication happens in 2 cycles" is what makes it tough
16:04pipelineyoklov: go figure man with no experinece in hardware designs hardware and it sucks to implement in hardware :P
16:05yoklovhahaha, yeah
16:05ibdknoxpandeiro: example?
16:06pandeiroibdknox: 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:06pandeiromaybe that is not automatable
16:06pandeironot a criticism at all of what noir offers btw, just thinking out loud
16:06sjlpandeiro: you might find this interesting: http://www.screenr.com/ysd8
16:06pandeiroas someone relatively new to webdev but starting to feel beginner fatigue at writing the sos all the time
16:07mega`dnolen: your creating a testsym https://github.com/clojure/clojurescript/compare/master...optimize-truth#L0R343
16:07ibdknoxpandeiro: yeah, it's something I've thought a lot about, but fundamentally I think that's just how programming is
16:07ibdknoxI don't think that's an artifact of it being on the web
16:07dnolenibdknox: on an optimization kick today, looking into fn arity dispatch optimization.
16:07ibdknoxdnolen: oo
16:08ibdknoxdnolen: awesome :D
16:08ibdknoxdnolen: I created a version of the compiler that gives me column/line meta on all symbols that get read
16:08ibdknoxnow I'm trying to use that through the analyzer :)
16:09pandeiroibdknox: 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:09dnolenibdknox: 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:09ibdknoxpandeiro: yeah, unfortunately few things are generalizable even at the view level
16:09dnolenibdknox: cool, I'm assuming you're using that for something fun :)
16:10ibdknoxdnolen: that's very exciting!
16:11ibdknoxdnolen: I might have a real-time debugger cooler than bret's binary search demo ;)
16:11ibdknoxpandeiro: 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:12ibdknoxpandeiro: unfortunately programming has its fair share of boring lol
16:12ibdknoxpandeiro: we might be able to do better though, just gotta think about it more :D
16:14ibdknoxpandeiro: I actually tried the generalization route btw, in a php framework once upon a time ago
16:14ibdknoxbuilt some cool websites with it
16:14dnolenibdknox: haha cool! like a high level interactive thing? not like a stepping debugger for inspecting locals and such.
16:15ibdknoxdnolen: type some code, see a ghosted version with all the values filled in for their variables :)
16:15ibdknoxbasically a repl on crack
16:16pandeiroibdknox: 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:16ibdknoxdefinitely
16:17ibdknoxthings like defremote are nice though
16:17ibdknoxthey help make organization seem more natural and less boiler-platey
16:18pandeiroyeah, 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:18pandeiroi am wondering right now if porting that CRUD generator to a couchdb version is a worthwhile endeavor or not
16:19ibdknoxfwiw, I'm definitely not convinced we've really figured it out
16:19ibdknoxI think there's a better abstraction waiting out there
16:19pandeirowe will keep banging out apps and it will appear, hopefully :)
16:20pandeiroi also wonder if there is such a thing as 'backend-agnostic', in this context... my initial intuition is no
16:21ibdknoxin the context of crud?
16:21pandeiroyeah, basic database-centric webapps
16:21ibdknoxonly if someone created the magical set of über semantics
16:21pandeiroright
16:21ibdknoxfor datastore interaction
16:21ibdknoxwhich is theoretically possible
16:21ibdknoxjimduey sent me a paper on it after I built korma
16:21ibdknoxit's a GSOC project ;)
16:22ibdknoxno one has talked to me about that one though
16:22pandeirowell if you're still doing this when my 4-year-old has started coding, maybe he'll hit you up ;)
16:22ibdknoxhaha
16:23yoklovhaha, the "abstract away data-store semantics" gsoc proposal sounded impossible
16:24yoklovor that you would need to be insanely smart to come up with a reasonable abstraction
16:25ibdknoxI actually don't think it's that hard
16:25ibdknoxto be honest
16:25ibdknoxat least not to build the first parts of it
16:25pandeirowell 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:25pandeiro(assuming maybe some config specification i guess)
16:26ibdknoxpandeiro: you'll need to create notions of uniqueness, the idea that fields exist and can be queries against, etc
16:26ibdknoxtake the user case as an example
16:26ibdknoxselect a user by name
16:27ibdknoxhm, I guess ID's could be an implementation detail..
16:27pandeiroyeah i have a tough time thinking through these things until i'm trying to implement them, i admit
16:28yoklovhm, 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:28ibdknoxyeah, not something I'm currently interested in tackling :)
16:28ibdknoxyoklov: shouldn't be
16:28pandeiroand then there's couchdb having no adhoc querying to begin with...
16:28ibdknoxthough each backend will have tradeoffs
16:29ibdknoxI had a simple proof of concept of korma over objects
16:29ibdknoxwhich is basically the "worst" (or best, depending on how you think of it) backend
16:29ibdknoxit provides you the least
16:30ibdknoxbut meh, maybe core.logic is the future ;)
16:31pandeirowhat about rich hickey's new database? have you looked at it?
16:31ibdknoxdatomic
16:31ibdknoxyeah
16:31pipelinedatabase-as-a-service, isn't it
16:31pandeiroi'm completely ignorant but i assumed it would be pretty congruent to clojure's semantics
16:31ibdknoxmhm
16:32pandeirois it only available as a service?
16:32ibdknoxYou can run something locally
16:32ibdknoxI don't think you can host the whole thing yourself though
16:32ibdknoxbut I didn't look into it too deeply
16:33pandeiroibdknox: what are you using at the startup you work for, if i can ask?
16:33ibdknoxI actually just left to start my own
16:33ibdknoxbut RFZ we used Clojure + postgres
16:33ibdknoxand mongo for random things
16:33ibdknoxat RFZ*
16:33pandeirowhat was the thinking behind using mongo for random things?
16:34ibdknoxfast writes, schemaless
16:34pandeiroeasier than doing all the DDL?
16:34pandeirok
16:34ibdknoxI like mongo
16:34ibdknoxit's nice for certain things
16:34ibdknoxI actually really liked redis when I used it for typewire
16:35pandeirowhy use postgres at all then?
16:35ibdknoxbecause NoSQL is terrible at relational data
16:35ibdknoxwe also started with a django site
16:36ibdknoxthat used postgres
16:36pandeiroand some data really is relational by nature?
16:36ibdknoxI think a fair number of things are more easily expressed relationally
16:37pandeiroi 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:37weavejesterDoes 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:37oskarththis is turning into an interview; but may I ask why you left RFZ? Seems like you just recently started working there
16:38pandeirooskarth: he's a worthy subject :) i'll hand it off to you
16:39pandeiroone 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:39weavejesterAh, nevermind. Problem resovled by deleting the .m2/project directory
16:39ibdknoxI 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:39oskarthI see :)
16:39ibdknoxthey're hiring!
16:39weavejesteribdknox: Have you set off to do your own thing, then?
16:40ibdknoxand they're really a great team, and working on something that actually matters
16:40weavejesterI ask because I've been considering doing the same.
16:40ibdknoxweavejester: yessir :)
16:40mega`RFZ stands for?
16:40ibdknoxReadyForZero
16:40ibdknoxhttps://www.readyforzero.com
16:40weavejesteribdknox: Do you have anything specific in mind to do, or is that a secret? :)
16:41ibdknoxweavejester: working on some thinge for the medical industry :) Hopefully to help curb some of the waste happening in healthcare
16:41ibdknoxFigured I worked on helping people out of debt, time to save some lives ;)
16:42weavejesteribdknox: Ah. Anything to do with the pharma industry / clinical trials by any chance?
16:43ibdknoxweavejester: 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:44ibdknoxweavejester: any sense what you'd be interested in doing?
16:45ibdknoxa 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:46weavejesteribdknox: 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:46ibdknoxah very interesting
16:46weavejesteribdknox: My goal is to actually start speaking ;) - I've yet to do a Clojure talk, but I'm putting one together for Ring.
16:46ibdknoxawesome!
16:46ibdknoxI did it a ton for MSFT
16:47ibdknoxhaven't as much since I've left
16:47ibdknoxbut I've got a couple things lined up for this year I think
16:47weavejesteribdknox: I've done quite a few internal talks, but never any external ones.
16:47ibdknoxYou've gotta make it state side so I can actually meet you. :)
16:49weavejesteribdknox: Are you west or east coast?
16:49ibdknoxSan Francisco these days
16:50ibdknoxAlternatively maybe I can find an excuse to end up in the UK :D
16:50oskartheuroclojure.com/2012/ !
16:51ibdknoxunforunately the timing doesn't work out for me on that one
16:51weavejesteribdknox: San Francisco is one of my "to-visit" places. Maybe I'll try to make next Clojure West.
16:51ibdknox:)
16:52ibdknoxor you could come to the conj
16:52ibdknoxI'll find my way there somehow
16:52weavejesteribdknox: I'm going to the Euro conj
16:53weavejesteribdknox: Are there any US conjs left?
16:53ibdknoxthe official one should be toward the end of the year
16:53ibdknoxhttp://clojure-conj.org/
16:54ibdknoxin NY it looks like by that picture
16:54ibdknoxweavejester: it'd be an opportunity to speak ;)
16:54weavejesteribdknox: Ah, I should be able to make that one.
16:55weavejesterYou have a good point… I missed the deadline for the EuroClojure talks.
16:55ibdknoxI'm doing a couple talks in Sweden toward the end of the year
16:55weavejesterI was planning on doing something for the ldnclj group
16:55weavejesteribdknox: Any particular reason you'll be over there? Aside from the talks?
16:56ibdknoxThey asked me to come speak at Oredev: http://oredev.org/
16:56weavejesterAh, awesome :)
16:59ibdknoxalright folks, gotta run
17:01weavejesterbye
17:05konrCan I easily serialize a function for later retrieval with something like `(spit "/tmp/foo" (serialize #(+ 3 %)))`?
17:11arohnerkonr: not really. anonymous fns aren't serializable
17:12arohneryou can serialize the name of a fn, and call it later, by name
17:15beffbernardkonr: you can also use pr-str
17:15beffbernardAs long as your functions are pure
17:16arohnerbeffbernard: how would that work?
17:16ibdknoxand capture no free vars :p
17:16arohner,(pr-str #(+ 3 %))
17:16clojurebot"#<sandbox$eval28$fn__29 sandbox$eval28$fn__29@18b41da>"
17:16ibdknox= a uesless function
17:16ibdknox,(pr-str '#(+ 3 %))
17:16clojurebot"(fn* [p1__56#] (+ 3 p1__56#))"
17:16ibdknox;)
17:18beffbernardI've used this before.. (defn serialize-bytes [x] (binding [*print-dup* true] (let [s (pr-str x)] (.getBytes s "UTF-8"))))
17:19ibdknoxbetter is to think about the problem differently
17:19ibdknoxcreate a function that based on some straightforward input returns you the function you need
17:19beffbernardibdknox: yeah you don't want to mess around with closures
17:20ibdknoxgenerate the function at the time it's needed
17:24technomancyclojurebot: serializable-fn?
17:24clojurebotserializable-fn is a hack for preserving source of a compiled function: https://github.com/technomancy/serializable-fn
17:33autodidakto,(doc pmap)
17:33clojurebot"([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:03unlinkI'm having difficulty debugging a NullPointerException raised from within Leiningen.
18:07unlinkHow do I bootstrap and debug leiningen? e.g. http://dpaste.com/728236
18:22emezesketechnomancy: Should I expect "trampoline" to work with lein2 at this point?
18:37emezesketechnomancy: 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:42danielwhen i try this in the repl it outputs correctly (properly escaped string): (pprint-json (:body (client/get "https://graph.facebook.com/19292868552&quot;)))]]))
18:42danielsorry, few too many brackets there
18:43danielbut i try it in a [:code {:class "prettyprint"} here] and i get nothing (noir)
18:43danieljust get <code class="prettyprint"></code>
18:44emezeskedaniel: pprint-json does not return a string, it prints it to *out* (which is usually stdout)
18:45emezeskedaniel: Looks like you want json-str
18:47danielaah, thanks
18:48danielthat has indeed done the trick
18:48Bronsaor wrap it with with-out-str
18:49danieli actually want something else entirely
18:50danielim trying to get it to pretty print in the browser (nice colours / indentation)
18:50emezeskedaniel: I don't think clojure.data.json is meant for that.
18:50danieli think i just want (:body (client/get .... and then format it with javascript
18:53TimMcEw, 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:53danielim not sure how to get the formatting, i've got the syntax highlighting
18:53danieli thought pprint-json might get me the formatting
18:55TimMcHere's an example of this fail: https://gist.github.com/2332669
18:57BronsaTimMc: shouldn't the hint go before the function name?
18:57TimMcI think it goes on the arglist.
18:59TimMcBronsa: From experimentation, look slike it can go either place.
19:00amalloyhinting the arglist is intended for (or at least related to) primitive typehints
19:00Bronsaoh, ok
19:00TimMchum
19:00amalloyand is a newer option; hinting the name is an older method
19:02Bronsahttp://sprunge.us/UdNV
19:02Bronsaam i missing something?
19:03amalloyi guess you're missing what i just said about primitive typehints?
19:03Bronsathat may be it.
19:04amalloyarglist typehinting uses a different mechanism entirely from :tag meta
19:06TimMcOK, interesting -- the problem I'm seeing only occurs with arglist hinting.
19:14amalloyTimMc: is it okay if i smugly note that File isn't a primitive?
19:24Bronsaamalloy http://clojure.org/java_interop type hinting section
19:25Bronsa"For function return values, the type hint can be placed before the arguments vector" and it type hints the argvector with String
19:26Bronsathis is not true anymore, right?
19:31dlejaHey, 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:38emezeskeAnyone 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:43dnolenhmm is "lein kibit" not working for other people?
19:48dnolenmulti-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:53emezeskednolen: That is awesome.
19:57technomancydleja: set :jvm-opts ["-Djava.library.path=/whatever"] in project.clj
19:58technomancyemezeske: I had to roll my own version comparator, but you can steal it from leiningen.core.main
20:01emezesketechnomancy: I ended up using org.apache.maven.artifact.versioning.DefaultArtifactVersion
20:02technomancyemezeske: that works as long as versions are always three-segmented
20:02technomancyit applies different logic for non-three-segmented version numbers
20:02technomancy1.6.1.1 is lower than 1.6.1 according to DefaultArtifactVersion, for instance
20:02technomancyjust FYI
20:05emezesketechnomancy: argg
20:10TimMcamalloy: Can I smugly point out that the docs are wrong?
20:10amalloywelcome to clojure, TimMc :P
20:10TimMcyup
20:11TimMcAlthough... it works *sometimes*.
21:00konrWhat was again that function to alter just part of a structure, like the :X in {:a 3 {:b [11 22 33 {:X 4}]}}?
21:01amalloyupdate-in
21:01konryes, thanks!
21:01amalloy&(update-in {:a 3 {:b [11 22 33 {:X 4}]}} [:a :b 3 :X] inc)
21:01lazybotjava.lang.RuntimeException: Map literal must contain an even number of forms
21:01amalloy&(update-in {:a {:b [11 22 33 {:X 4}]}} [:a :b 3 :X] inc)
21:01lazybot⇒ {:a {:b [11 22 33 {:X 5}]}}
21:39muhoohow would i get lein to include java sources in a jar?
21:40muhooit includes the .clj sources by default, even though it's aot compiled. but it doesn't seem to be including the java sources.
21:52emezeskemuhoo: Can't you just put the java sources in the :resource-path ?
21:56muhooif i can have multiple resource-paths, then sure, i could add project/srcj to that
21:56muhooi only get one resource-path in lein 1.7 tho
21:56emezeskemuhoo: Ah, lein2 supports multiple
21:57emezeskemuhoo: Might be something you can do with symlinks or some such
21:58muhoook
21:59bbloomdo sorted-sets have any functions similar to those in redis? http://redis.io/commands#sorted_set
21:59bbloomi'd really like to have a sorted-set-by and then get a range of values
22:00bbloomi've got some hash-maps representing "events" with :timestamp keys & i'd like to efficiently slice and dice a set of events
22:00hobbyistclojurebot: Is there any change a brief description would accompany clojars.org posts?
22:00clojurebotGabh mo leithscéal?
22:07hobbyistclojurebot: Sint total de acord.
22:07clojurebotIt's greek to me.
22:08hobbyistclojurebot: you first: Gabh mo leithscéal?
22:08clojurebotIt's greek to me.
22:12gfredericksbbloom: I expect finger trees can give you what you want
22:14bbloomthis one: https://github.com/clojure/data.finger-tree ?
22:15gfredericksI guess so
22:16gfredericksI thought it was in the core distribution but I guess it got moved out
22:16muhoogfredericks: i meant hooke, not hack
22:17amalloybbloom: sorted sets have that feature
22:17amalloy&(doc subseq)
22:17lazybot⇒ "([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:18amalloy&(subseq (sorted-set 5 9 1 6 3 2) > 3 < 8)
22:18lazybot⇒ (5 6)
22:18gfredericksamalloy: I learn so much from you by answering poorly
22:18bbloomoh! perfect! thanks!
22:18bbloomgfredericks: thank you too :-)
22:19amalloysubseq is a hidden little gem
22:19bbloomyeah, that's awesome
22:20bbloomi see the return type is KeySe1q
22:20amalloysee also rsubseq for going the other way
22:20bbloomso i assume it's lazy, so i can easily do:
22:20amalloyindeed, it is
22:20bbloom&(take 10 (subseq (sorted-set 5 7 1 2 4 4) > 3))
22:20lazybot⇒ (4 5 7)
22:20amalloybut it's not obvious to me why that would matter
22:20bbloomand expect that to be fast? :-)
22:21bbloomi'm gonna have a pretty large sorted set & might be reading it across the network
22:21amalloythe set itself isn't lazy, so...
22:21bbloomright, but the set is persistent
22:21amalloyi mean, you definitely can get a gain from the laziness of subseq in some circumstances
22:24bbloomso the reason i asked about laziness was b/c i plan to use only a start point on the subseq
22:24bbloomi don't necessarily want time0 to time1
22:24bbloomi want time0 + 10 items
22:25amalloyright, pagination. so it does what you probably want
22:25bbloombut 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:25bbloomkinda like reading from a file system in blocks
22:25bbloom1 other question: is there a constant time way to get the reverse of a sorted set?
22:26amalloy*cough* see above
22:26amalloyrsubseq (and rseq)
22:26bbloomhaha ok perfect
22:26bbloomthanks for your help
22:26bbloomclojure's core libs continue to impress :-)
22:27amalloybe aware that all these give you a seq back, not a set
22:27bbloomyup, that's what i expected
22:38unlinkis there a shorthand for (difference #{:some :set} (set (keys {:some :map}))) ?
22:40bbloomunlink: other than defn? ;-)
22:46gfredericksunlink: (apply disj #{:some :set} (keys {:some :map})) maybe?
22:50unlinkhmm
22:50gfredericksthat at least avoids creating a new set just for fun
22:51amalloythat's not the same as what he asked for though
22:51gfredericksit ain't?
22:51amalloyi guess maybe it is. i was thinking of symmetric-difference; does difference not do that?
22:52gfredericks,(doc symmetric-difference)
22:52clojurebotexcusez-moi
22:52amalloywell it's not a builtin afaik
22:52amalloy&(clojure.set/difference #{1 2} #{2 3})
22:52lazybot⇒ #{1}
22:52amalloyi was thinking he wanted #{1 3}
22:52gfredericksah just wikipedia'd it
22:53gfredericksyeah I think whenever I want sym-diff I combine diff and intersection
22:53hobbyistScuze. I figured it was Irish.
22:55hobbyist@Greek: I don't understand, but I agree.
23:23blakesmithAnyone know how to enable request logging when using the ring jetty adapter?
23:51blakesmithAh, figured it out. My log4j.properties was misconfigured.