#clojure logs

2012-07-18

00:05ppppaulpeople using clojure for shell scripting?
00:06augustlthe launch time of clojure apps is pretty long, so probably not :)
00:07LajlaI am the finest programmer in the world, second only to the microsoft chief software architect
00:07tomojyou might say pallet does shell scripting
00:08tomoj.. by generating shell scripts
00:21bsbppppaul: startup time could be a problem for shell script use...
00:58wingyhttp://angularjs.org/ seems very nice
00:58wingyi wonder if it's possible to use it with cljs
00:59mybuddymichaelwingy: But if a user has Javascript turned off, the page will looks {{like}} {{this}} {{everywhere}}.
01:00wingymybuddymichael: yeah but my app will be a single page app
01:00wingydoing my research .. i think it will either be angularjs or emberjs
01:01mybuddymichaelwingy: Definitely worth a try, but placing curly braces into the text of the page that will be removed by Javascript is kind of a buzz kill, in my opinion.
01:01wingyright, forgot that emberjs is having a statechart
01:01wingyyeah
01:01wingyperhaps you can have it all invisible
01:01wingyif js is on it will make it visible
01:01wingythe whole page
01:02wingyso a text You must have JS enable will only be displayed if there is no js
01:02mybuddymichaelLike have a "Oops, you need to enable Javascript!" element as the default, then replace that?
01:02wingyperhaps using CSS
01:02wingyso the JS will just make a DIV visible
01:03wingyhave you looked at it?
01:03wingyi watched the intro video .. seems that you have to use a lot of "functions" in JS
01:03mybuddymichaelwingy: Yes. It was fun, but the non-standard DOM querying made me wary.
01:04wingyi wonder if I with cljs could write thos fns
01:04wingythose
01:07wingygreat a cljs fn is returning a unmodfied js fn
01:07wingythen it should be no problem
01:18merkourisI have a problem, can anyone help me? I'm using clojure with emacs and with clojure-jack-in there are A LOT of popup frames that are distracting. How do you deal with this?
01:19pipelinethat is abnormal
01:19pipelinenot supposed to happen
01:19pipelinedo you suppose you have regular swank and clojure-swank loading in the same emacs instance?
01:19pipelinejust grasaping at straws
01:22merkouristhe repl loads just fine. the problem is with compilation, description, & error popup frames. I can control it by having 4 frames: repl, clj file, code description, compilation ... but then when there is an error the other error popup randomly shows up in one of the slots. It seems distracting
01:26wingyit's quite visible that different JS frameworks are gearing up due to competition
01:26wingygood for users :)
01:46samrat1does clojurescript work with lein2?
01:48wingysamrat1: yes
01:48wingyim using lein-cljsbuild
01:50samrat1wingy: ah, but lein-clojurescript doesn't work right? i got an error
01:50wingyis that a plugin?
01:50wingynever heard of it im using [lein-cljsbuild "0.2.4"]
01:50wingyread the github doc
01:51wingyits very simple to get started
01:51wingyhave a look at the simple sample project they have thre
01:51wingythere
01:51samrat1wingy: ok, thank, installing it
02:12augustlso, this didn't work https://www.refheap.com/paste/3665
02:12augustlhow do I make a "fn" with multiple signatures that calls itself?
02:13augustlI suppose I could use a macro
02:15noidiyou're creating an anonymous function, and using let to get a named handle to it
02:16noiditry (fn request-fn [...) instead of (fn [...)
02:16augustlthis seems to work https://www.refheap.com/paste/3666
02:16noidior better yet, use (letfn [(request-fn [...] ...)])
02:16augustlnoidi: ah, thanks :) Was reading docs so I didn't notice your answer until now
02:17noidiyes, your second version works, because you're passing the function name to `fn`
02:18augustldoes that create a public function in the namespace?
02:18augustlor is the name local to the fn body?
02:18augustllooking up letfn
02:18noidiit's local to the fn
02:19noidigenerally only `def...` forms create new vars
03:30ro_stemezeske: is there a way to build just one of the builds listed under :builds?
03:30ro_stsay, dev?
03:30ro_sti used your advanced example project.clj as my template
03:31ro_stthis is with reference to cljsbuild, of course :-)
03:33ro_stah, just add the build name after auto
03:45ro_stis there a way to make my PersistentArrayMaps Comparable?
03:45clojurebotllahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example
04:02stainhow do I ignore joins and quits..? seems to be a lot in this channel
04:03ro_styour irc client should have an option for it
04:03stainI'm trying /ignore #clojure JOINS LEAVES
04:05clgvstain: most clients can suppress them.
04:06stain/ignore #clojure JOINS PARTS QUITS
04:07stainhopefully will do the trick
04:07clgvstain: is there something for ignoring renaming messages?
04:09stainI think CRAP will do almost all of those..
04:09stainNICKS - Someone changes nick
04:31Turururis there any function like filter that stops in the frist element it finds?
04:33mduerksenTururur: filter is lazy, so if you have something like this, it won't consume the whole sequence: ##(first (filter even? (range))
04:34clgvTururur: you can mange that with `some` as well in case you do not like first+filter
04:35clgv&(some #(when (and (even? %) (> % 5)) %) (range 10))
04:35lazybot⇒ 6
04:36Turururgreat, thank you!
04:36mduerksenclgv: that's what i don't like about some: if you just use a predicate, you won't get the value that passed the test, but rather the truthy return value of the predicate
04:36mduerksen&(some even? [1 2 3 4])
04:36lazybot⇒ true
04:37clgvmduerksen: yeah. thats annoying
04:38clgvmduerksen: it's probably due to the fact that they wanted to solve two problems at once. sequence predicate and retrieval of the match
04:39mduerksenclgv: may well be. but i would like a "decomplected" version of this ;)
04:40clgvmduerksen: I wonder if that was discussed already. since it's pretty easy to implement
04:47mduerksenclgv: i guess we're not the first ones, right. implementation is really easy: (comp first filter) i think the problem would be to find a appropriate name. ffilter (combination of first and filter)? fpred (first element which satisfies pred)? or even a new version of first itself, with a new parameter for the predicate? the normal 1-ary first can be seen as first with the (constantly true) predicate.
04:49clgvmduerksen: no, I would implement it like some but with value retrieval
04:51mduerksenwhat would be the advantage?
04:51clgvless lazy overhead ;)
04:52clgvsince retrieving the first value is pretty eager ;)
04:52mduerksenclgv: that's true
04:54mduerksenclgv: i actually like the thought of extending 'first'. you would have (first coll) and (first pred coll)
04:55clgvmduerksen: hmm right. but thats a semantic conflict with first on vectors
04:57mduerksenclgv: why?
04:59clgvI think a different name would be better. first, second and nth are supposed to get the exact element at the position
04:59clgvthe element at the exact position
05:04mduerksenclgv: 'first' without the pred argument would still do exactly the same as before. but i see what you mean: adding the pred argument would suddenly turn 'first' from a pure positional function into a searching function
05:06clgvmduerksen: that's what I meant. maybe find-first, find-nth would be a good name
05:13mduerksenclgv: 'find-first' would possibly be associated with 'find', which checks a map entry. well, the naming game ^^
05:21clgvmduerksen: there is a find function? ##(doc find)
05:21lazybot⇒ ------------------------- clojure.core/find ([map key]) Returns the map entry for key, or nil if key not present. nil
05:22clgvoh, I thought that was what `get` was for
05:23mduerksenclgv: yeah, i never ever had to use 'find' so far, 'get' always sufficed. but 'find' gives the [k v] vector, whereas get only gives you the value
05:23clgvoh ok
05:24clgvits probably pretty useless^^
05:24mduerksenclgv: could be. which would be a pity, because the name is now taken :(
05:24clgvI can only think of value equality of the keys and you want the exact datastructure of that key. otherwise it has no use at all
05:25mduerksenit would be interesting to scrape all clojure projects on github and check whether or not this function has even been used
05:28clgvif there i no use case than the above. it's a very special case and probably shouldnt bei in core
05:29clgvwell, maybe I should sign that CA and submit a patch ^^
05:52malcolmsparks(just testing - please ignore)
05:53malcolmsparksanyone using lein2 for serious projects? wondering if we should migrate from Maven today...
05:54Raynesmalcolmsparks: Well, everyone uses leiningen. Most people use lein2, and people are certainly using it and lein1 for serious projects.
05:56alexyakushevmalcolmsparks: Lein2 is fairly stable if you don't use some fancy stuff like middleware
06:16alexyakushevDoes anyone have an idea why AOT-compiling Clojure namespaces with lein doesn't yield any class files? My own project and dependencies are perfectly compiled into classes but Clojure is not
06:18vijaykiranmay be you can try with :aot [clojure.core ... ] ?
06:20alexyakushevvijaykiran: I have all Clojure namespaces in the :aot list. Lein actually says that it compiles every Clojure namespace, I just don't see .class files in target/
06:22vijaykiranAren't they supposed to be just jars ?
06:23alexyakushevvijaykiran: Unfortunately, I need them as class-files :(
06:24ro_stif i have file ./test/app/test/foo.clj and i want to require code from a file ./test/app/test/test_util.clj, what does the require statement look like?
06:24ro_stapp.test.test-util isn't working
06:25vijaykiranalexyakushev: any specific reason ?
06:26alexyakushevvijaykiran: Android
06:27alexyakushevvijaykiran: I only recently spotted that I used class files bundled inside clojure.jar
06:29vijaykiranro_st: (:require [app.test-util :as util])
06:30vijaykiranro_st: my app has test/app/test_util.clj
06:31vijaykiranalexyakushev: manually unjarring and adding works ?
06:32alexyakushevvijaykiran: Yes, kind of. But I'd like to have more flexibility, for example, not include the namespaces the application doesn't use
06:32ro_stit's because my tests are in a test-clj folder and test-clj isn't on the classpath
06:32ro_stjust checked the output of (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) and filtered for test-clj
06:33alexyakushevCould it be because clojure.jar already contains class-files, so Lein doesn't create them anew in target/ folder?
06:33ro_stit ain't there. what's the easiest way to add something to the class path? some setting in project.clj?
06:34alexyakushevro_st: have you set up custom :test-paths in project.clj?
06:34ro_styes
06:34vijaykiranro_st: in your case the appropriate would be :test-paths
06:35ro_stdespite it already being in there, it's not finding it
06:35stainro_st: would not (ns app.test.foo (:use [app.test.test_util])) work?
06:35stainhow are you calling things from test_util?
06:35stainrequire just loads it, it does not mingle it into your namespace
06:35ro_sti'm requiring it with an alias
06:36stainand then you use alias/blah right?
06:36ro_stargh i have to afk for 5 mins. more soon
06:42msappler.(+ 3 3)
06:44msapplerwhy is my code returning this?
06:44msappler(println "CLASS " (class (int 3)))
06:44msappler; CLASS java.lang.Long
06:47alexyakushev,(class (int 3))
06:47clojurebotjava.lang.Integer
06:47clgvmsappler: because since clojure 1.3 ints are converted to longs. in this case this happens before class
06:47alexyakushev,*clojure-version*
06:47clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
06:47clgvoh, it changed in 1.4?
06:47alexyakushevLooks like
06:48clgvmaybe class excepts primitives in 1.4
06:48clgvargs *accepts
06:48hyPiRion,(class 3)
06:48clojurebotjava.lang.Long
06:49clgvmsappler: why do you care which class it has? are you doing interop? for interop (int 3) should work.
06:50hyPiRion,(class Integer/MAX_VALUE)
06:50clojurebotjava.lang.Integer
06:50ro_stso although project.clj has :test-paths ["test-clj"], my classpaths as enumerated by (.getURLs (java.lang.ClassLoader/getSystemClassLoader)) only includes /test and /test_resources
06:51ro_stthis is from within my slime repl in emacs
06:52ro_stcould it be because my slime repl is using lein1?
06:52alexyakushevro_st: I wonder why test/ is still there. Have you tried reswanking your project after changing :test-paths?
06:52ro_styup. rebooting the slime repl has no effect
06:52alexyakushevDoes it work when you do 'lein test' from the terminal?
06:53ro_sti'm using midje with lein2
06:53ro_stand that does work
06:53alexyakushevWhat do you mean by Slime REPL using lein1?
06:53ro_stinteresting, my project.clj includes :source-paths ["src-clj"] and src-clj is in the classpath list i'm checking
06:54alexyakushevSLIME can't use lein, SLIME connects itself to Swank-server. The question is who fires up swank in your case
06:54ro_stClojure Swank Command as set in M-x customize-group clojure-mode: lein jack-in %s
06:55alexyakushevDoes 'lein' refer to lein1 or lein2?
06:55ro_stlein1
06:55clgvro_st: in lein1 there were different keywords and value semantics for these configurations. check the sample
06:55ro_sti'm trying lein2 for my clojure jack in...
06:57ro_stthat works
06:58ro_stinspecting the class path now reflects the values in project.clj
06:58clgvro_st: well keyword names and value semantics changed and you gave lein2 configuration ;)
06:59ro_streally looking forward to lein1 going away. distinguishing between v1 and v2 stuff has been a great source of confusion and struggle
06:59ro_stwhy do we still have lein1, again?
06:59ro_stplugins that need updating?
07:00clgvro_st: you for yourself can just deinstall lein1 and only use version 2
07:02ro_sti guess what i'm asking is what's keeping lein2 from becoming the default?
07:03clgvro_st: there is a thread on the mailing list about that. in short: they want to change organization in clojars with the release of lein2 - signed releases and such
07:04clgvro_st: the question is why did you install lein1? ;)
07:04ro_stsome stuff i use doesn't work with lein2
07:04ro_stfor eg, crossovers in cljsbuild
07:04clgvso there is the not-yet-converted-plugin reason ;)
07:06ro_stsorry, had to reconnect my adsl
07:09ro_sti'd love to just stick to lein2. the other thing i use, ring-serve from weavejester, also has problems with lein2 - org.mortbay.util.logger classnotfound exception
07:44michaelr525hello
07:53ro_stbonjour
07:54samaarondoes anyone know how i might call into a Java method that looks as follows: https://www.refheap.com/paste/3667
07:55samaaronI see: No matching method found: render
07:56samaaronI believe it must be due to the vargarg 'sources'
07:56samaaronhaha - vargarg!
07:57cmiles74You can do (into-array seq-of-sources), that should give you the array of IndexSource objects.
07:57cmiles74&(class (into-array ["ab" "cd" "ef"]))
07:57lazybot⇒ [Ljava.lang.String;
07:57samaaroncmiles74: do I need to do anything about the parameterised type V?
07:58cmiles74I don't believe that you do... It's early for me and I'm having trouble remembering why I believe this.
07:59samaaron:-)
08:00samaaronooh, i seem to be getting different errors now, which suggests I've passed this blockage
08:00samaaroncmiles74: thank-you muchingly
08:01cmiles74You're welcome. :) I think the typing on collection is useful to the compiler, but in compiled code it doesn't really matter.
09:16XPheriorCan someone explain why my usage of with-redefs-fn blows up? https://gist.github.com/21ed0ef9e97f1e81da46
09:17XPheriorTrying to override the select statement on Korma so I can test some of the query functions in my codebase.
09:18gfredericksXPherior: don't you have to pass it a function?
09:19XPheriorgfredericks: Didn't I? (fn [query & more]...)
09:21XPheriorgfredericks: Oh.. #'korma.core/select isn't a function, is it?
09:21XPherior(class #'korma.core/select) ; => var
09:21gfredericksno that part is fine
09:22gfredericksI mean the body
09:22gfredericks(with-redefs-fn [...] (fn [] ...))
09:22duck1123,(doc with-redefs-fn)
09:22clojurebot"([binding-map func]); Temporarily redefines Vars during a call to func. Each val of binding-map will replace the root value of its key which must be a Var. After func is called with no args, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mocking out functions during testing."
09:22XPheriorHuh. Now it compiles.
09:23XPheriorIt didn't override the function, but it compiles.
09:23gfredericksXPherior: it's not a macro, so it can't delay the evaluation
09:23XPheriorWhy's it have to be wrapped in a function? That seems pretty bizzarre
09:23XPheriorAhh
09:23gfredericksXPherior: use with-redefs instead
09:24XPherior,(doc with-redefs)
09:24clojurebot"([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin...
09:25XPheriorgfredericks: I tried a few different things. Doesn't compile and still a little confused. Can you fork the gist and point me in the right direction?
09:29XPheriorWhy would I want to use with-redefs instead of with-redefs-fn anyway?
09:30duck1123because you don't want to have to wrap your body in a fn
09:32XPheriorAhh. Thanks duck1123
09:33XPheriorUpdated the Gist. I get a different stack trace. Not sure what this one means. https://gist.github.com/21ed0ef9e97f1e81da46
09:37pyrhey, for those that are interested, i made a simple jenkins plugin for leiningen: https://github.com/pyr/leiningen-jenkins
09:38vijaykiranyou mean https://github.com/pyr/jenkins-leiningen :) ?
09:38rabblerHey blakewatters, is there a bug that you know of that RKResponse is showing me a status code of 200 for a server that isn't even responding?
09:39rabblerI'm using RKClient to post something, shut down my server but eventually a timeout hits and I am getting a status code of 200 in the repsonse.
09:39rabblerresponse.
09:39clgvpyr: the link does 404
09:40vijaykiranclgv: https://github.com/pyr/jenkins-leiningen
09:40pyrheh
09:40pyrsorry
09:40rabblerDoh! I'm in the wrong channel!
09:40clgvlol hehe
09:40rabblerOdd, that my other channel is highlighted in colloquy. Doh! Sorry peeps.
09:41rabblerKeep clojuring, nothing to see here. ;-)
09:44dorote-liWhat's the difference between (defn name []) and (defn -name [])
09:45duck1123there's a little dash before the second name
09:45duck1123(defn- name []) is a private function
09:46duck1123(defn -name []) is probably being used for gen-class
09:49dorote-lihm, so it is, thank you
09:50ohpauleezdorote-li: Are you looking at ClojureScript code?
09:53dorote-liyes
09:54ohpauleezdorote-li: Protocol methods start with - by convention, so as you read, you know it's from a protocol. It also allows for a conveinence function (name) to be made that doesn't collide with the protocol function
09:55ohpauleezAnywhere you see (-name) you can call (name) for the general form or (-name) to force the protocol def call
09:55gtrakohpauleez: I did not know that was a convention, is it written somewhere?
09:55gtrakit makes sense though
09:56ohpauleezgtrak: I'm not sure if it's written down, but it should be if it isn't
09:57gtrakwe just use protocol methods as api most of the time
09:57ro_stis there a way to unit test private fns from outside the ns they're in?
09:58gtrakro_st: you can get at them by going through the var, #'
09:58ohpauleezro_st: You can use reflection of the var
09:58ohpauleezor*
09:58ro_st(let [fn #'some/private-fn] (fn args) => expected) ?
09:59gtrakyea
09:59gtrakb/c var implements IFn by delegating to its value
09:59ro_stnope. still complains
09:59gtrakwhat's the error?
10:00ro_stIllegalStateException: var #'the/var is not public
10:00ro_stusing the let form described above
10:00gtrakinteresting
10:00ro_stclj1.4
10:01ro_sthey ohpauleez :-)
10:01ohpauleezHi ro_st
10:01ohpauleezNo Shoreleave updates :(
10:01ro_stboohoo :-)
10:01ohpauleezhahaha, but soon. For real
10:02ro_sti was hoping you might be willing to provide a canonical shoreleave-remote example? just showing both the clj and the cljs sides
10:02ro_sti've scoured your demo code and your docs but i'm just not getting it. i'm probably missing the forest for the trees
10:02gtrakro_st: works for me
10:02gtrak(clojure.core/load-data-readers)
10:02gtrak,(clojure.core/load-data-readers)
10:02clojurebot#<CompilerException java.lang.IllegalStateException: var: #'clojure.core/load-data-readers is not public, compiling:(NO_SOURCE_PATH:0)>
10:02gtrak,(#'clojure.core/load-data-readers)
10:02clojurebot{}
10:03ohpauleezro_st: That's definitely something I can do
10:04ro_stgtrak: interesting. it works for me in the repl, but not from within my midje fact ns
10:04gtrakhuh
10:05ro_stawesome ohpauleez. a gist or a refheap is totally ok
10:05gtrakwhy would that be the case?
10:05ro_stah
10:05ro_stoutside a fact: no problem. inside: problem. macroexpansion might be smushing #' ?
10:05gtrak#' is a reader thing
10:06gtraktry (var x)
10:06gtrakshould be the same result
10:06ro_stsame
10:06ro_stfact is a macro
10:06gtraktry binding it in a let outside, then referencing it inside the macro
10:07ro_stnope! haha weeiirdd
10:07gtraklol fun
10:08ro_stoh man. i'm an imbecile
10:08gtraktry binding a anon function that calls the var
10:08gtrakdid you figure it out?
10:08ro_styes. it wasn't that fn that was the problem. i had forgot to deprivateise the copy-paste-renamed fn that i was busy tdding
10:09gtrakhaaa
10:09ro_stok it's working
10:09ro_stsimply prepending #' does the job
10:09ro_stha i can even use the ns's alias
10:09ro_stawesome
10:09gtrakI was trying to imagine what kind of macro could break that
10:10ro_sti'm really starting to understand what PG meant when he said that you code simple layers of abstraction and compose them
10:10gtrakseems like it would have to be deliberate...
10:10ro_stso much better this way
10:11gtrakro_st: I find it terrifying and nice
10:13ro_sthaha why terrifying?
10:14gtrakwhen reading other people's code, it kinda all mushes together, there sometimes isn't clear conceptual boundaries like what you get with a java interface
10:14gtrakso even though there's less code, it's harder to avoid looking at all of it I think
10:15duck1123gtrak: so did you manage to actually get the repl working in tomcat for your app?
10:15ro_styeah, it can be a bit daunting
10:15gtrakduck1123: yea it works, next step is to proxy every spring bean with AOP and wrap it in clojure :-). don't know when I'll get around to that
10:17gtrakduck1123: but you just gen-class, initialize it with a servletcontextlistener (proxy it), then run (swank/start-server :port x)
10:19duck1123gtrak: I think I'll probably give it a try today. I have to interface with this big, enterprisey, closed-source java application
10:19gtrakI guess you could use a proxy but I ended up just using gen-class with implements
10:19gtrakduck1123: I put it up in a gist somewhere
10:20gtrakhttps://gist.github.com/3122677
10:22gtrakduck1123: project.clj https://gist.github.com/3136468 I lein installed it and added it as a dep to the java maven project
10:23ro_stohpauleez: awesome. lookin' forward to it :-)
10:24gtrakduck1123: comment out the spring thing, otherwise you need to add the deps
10:30gtrakduck11231: if it's closed source you might need https://github.com/wirde/swank-inject instead
10:37achengis there a way to run clojure.test tests and have the repl be a part of the same thread without being blocked by (run-tests 'some.name-space) ?
10:39ro_stif that thread is running the tests, i don't see how you won't be blocked
10:39gtrakgetting some craziness with lein 2 repl, I just have a blocking thread printing to the screen, but cpu is going crazy with nrepl code
10:39gtrakanyone every see that?
10:40clgvgtrak: no, not yet. what's the IP and the ssh credentials? ;)
10:41gtrakclgv: hold on, let me open a port for you ;-)
10:41ro_stdon't forget to wear a tinfoil hat
10:41clgvro_st: wait, that's the opposite direction
10:41gtrakhttp://i.imgur.com/geec4.png
10:42clgvgtrak: which tools is that?
10:42gtrakjvisualvm
10:42clgvoh. havent looked at it in a while
10:42ro_stshiny
10:42gtrakyea!
10:42ro_sthard to get working?
10:42gtraknope
10:42ro_sti'd love to profile code
10:42gtrakjust run it
10:42gtrakcomes with the jdk
10:43clgvwell if its printing to screen nrepl has to sent you the strings that are printed
10:43achengok thanks ro_st.
10:43gtrakyes, but I'm only printing once per second
10:43XPheriorIs it possible to substitute a MySQL database defined by Korma to be an in memory database during testing?
10:44ro_stit uses jdbc, so if you can find an in mem db for jdbc, then yes
10:44gtraklein 1 doesn't have this problem
10:44XPheriorro_st: I found one. H2. The problem is directing the Clojure code to use that DB instead of the MySQL one at test time
10:46ro_stXPherior: i'm not sure how to tell pre-declared entities to use a new defdb, i'm afraid
10:46XPheriorMaybe something like with-redefs..
10:48ro_stwe use a config file with plain defs that bring in System/getenv values
10:48XPheriorThat might be a good idea. Thanks ro_st :)
10:48ro_stand then use (binding [config/MYSQL-DB "some-test-db"] …) to wrap the midje facts with (background (around :facts ...))
10:49ro_stso if your defdb uses a config ns for its values that might work
10:49gtraktechnomancy: sorry to pm, but thought you might want to know, simple program prints one line to screen per second, lein1 repl http://i.imgur.com/7lamu.png , malignant lein2 repl http://i.imgur.com/geec4.png program: https://gist.github.com/3136631
10:50ro_styou'd have to use a defdb hash that is uniform across H2 and MySQL, though, to be able to plug in individual values from config vars
10:50XPheriorThat thought just occurred to me, yeah..
10:50ro_styou got as far as deciding to use clojure, though, so you're a clever chap. you'll figure it out ;)
10:51XPheriorHah. Where's your company at?
10:51ro_st(confirmation bias ftw)
10:51ro_stcape town, south africa
10:51XPheriorDefinitely want to go to East Africa someday
10:52triyoI'm going through the "Purely Functional Data Structures" book and was wondering if doing the exercises in Clojure would be a good idea or would it be a better to stick with SML?
10:52ro_sti'm sure they're looking forward to your visit :)
10:53XPheriorHah
11:11yonatanetriyo, i'd do them in clojure if that's what i'm after
11:29ro_stusing letfn inside a defn is bad from a processing perspective, right? because it'd have to declare those fns upon every execution of the defn?
11:30ro_stand by bad, i mean it increases the processing overhead
11:32nDuffro_st: Functions aren't recompiled during execution except in the presence of eval.
11:33ro_stso if i have (defn foo [args] (letfn [(some-inner-fn [arg] (work arg))] (some-inner-fn args))), you're saying some-inner-fn is compiled once?
11:34nDuffro_st: Yes.
11:34ro_stwhere is it stored then, because surely letfn is GC'd once foo exits?
11:35nDuffIt's compiled before foo is even _called_
11:35clgvro_st: there is a class generated for each function
11:35nDuffat, again, _compile time_.
11:35ro_stoh
11:35ro_stoh of course
11:35ro_stbrainfart
11:35edoloughlinI'm upgrading from an older version of Compojure and just can't seem to make this work: https://gist.github.com/3136955 - any ideas most appreciated
11:36ro_sthave you tried breakpointing inside your wrap fn?
11:37ro_stusing eg (swank.core/break)
11:37ro_stjust to see if execution reaches it
11:37edoloughlinro_st: I'm on Eclipse/CCW and recently upgraded. Breakpoints are quite flaky for me at the moment (!)
11:38ro_stah ok
11:38ro_stnot sure how to do 'em with E+CCW
11:38edoloughlinI have (dbg) statements in the fn and nothing is printer...
11:38edoloughlins/printer/printed/
11:38ro_stthat might be because the output isn't routing to where you expect
11:38ro_stwhat if you throw an exception from within it?
11:40edoloughlinFunnily enough, an exception is thrown because there's no data in :params that should be put there by parsing the body. I can see that the correct route is picked/called
11:40ro_stright. so throw an ex from the fn that should be putting the data in params to see if it fires
11:40edoloughlinHmm, ok. Will try.
11:40ro_stis the wrap working unconditionally, or only when a header or http verb is present?
11:41ro_sti had a similar issue a while back where my json parser ignored me. turns out i was sending x-form-encoded (or some such thing) and expecting application/json
11:41edoloughlinI'm driving it from a browser at the mo, so I haven't checked anything else.
11:42ro_stpaste the wrap fn that's not doing it's job?
11:43edoloughlinhttps://gist.github.com/3137011 - it's probably over complicated. Wrote it about a yr ago when learning Clojure.
11:43ro_stah. my ring handler does this: (def app (-> routes …)). yours does this: (defn app [req] (-> req routes …))
11:45edoloughlinI originally didn't have it but when I upgraded I was getting an error - too many args - so I put it in...
11:46ro_stcompojure 1.1.0?
11:46edoloughlinI'm on ring-1.1.1 and compojure-1.1.0
11:46ro_string 1.1.0?
11:46ro_stok
11:46ro_stmy ring handler definitely points to my (def app (-> routes wrap-fn wrap-fn wrap-fn))
11:46ro_stjust double checked it now
11:47ro_sti have to run, unfortunately. good hunting :-)
11:47edoloughlinStrange. I'll try throwing the exception and look into the extra arg. Thanks.
11:51edoloughlinro_st: If you're still there, this is embarrassing. Don't know how I ended up with a defn instead of a def, but that was the problem. I'll have to claim snow blindness, or something :(
11:52scriptorto anyone going to the clojure meetup tonight, how are people doing the hack night?
11:52scriptorI derped and forgot my laptop
11:53ohpauleezscriptor: My guess is that people will pair off or group up. Or open up tmux sessions for people to connect to
11:53ohpauleezOr brainstorm ideas around projects
11:53scriptorohpauleez: in the usual meetup place?
11:53ohpauleezgroup hammocking
11:53scriptorkinky
11:53ohpauleezwe're in the Market this week
11:54ohpauleezStill Google, just the other office
11:54scriptorthey have a chelsea market office? interesting
11:54scriptorI wonder how many people I can finnagle into clj->php
11:56wingyangularjs seems to be a perfect match for clojurescript
11:56wingyno objects
11:58scriptorI'm not sure how much of a fan I am of dom manipulation
11:58scriptor*data binding
11:58ohpauleezwingy: But what does angular give you that CLJS doesn't already have a better answer for?
11:59dgrnbrghello clojurians, i'm trying to write a macro to generate some native calls, and i'm having trouble eliminating the reflection warning. I generate the native object in my let binding like [(with-meta gensymed-name {:tag "my.class"}) `(crazy stuff)], then splice that into a let. But the compiler complains that it "Can't type hint a local with a primitive initializer". The crazy stuff results in an Object, though. What's the matteR?
11:59wingyohpauleez: im going to use angularjs with cljs
12:00ohpauleezwingy: But why? What does angularjs have that isn't already in the CLJS ecosystem?
12:00wingyohpauleez: doc?
12:00wingy:)
12:00llasramdgrnbrg: Can you post a more complete code example?
12:00ohpauleezEverything you could want in angular is already done (and most likely better) in CLJS
12:00ohpauleezwingy: Documentation?
12:01ohpauleezspecifically do you mean examples?
12:01wingyhttp://docs.angularjs.org/api/ http://docs.angularjs.org/guide/
12:01wingyhttp://docs.angularjs.org/tutorial http://angularjs.org/
12:02wingyohpauleez: im open for suggestions .. want to have something solid for frontend .. what are the choices in cljs?
12:02ohpauleezwingy: I think you're making a mistake, but the choice us yours to make
12:02wingyohpauleez: docs in general .. tutorial, code examples
12:02wingyohpauleez: it would be better if you could give me some examples
12:03dgrnbrgllasram: i can't post much else. The crazy stuff looks like `(-> ~captured-symbol my.static.factory/fromJava)
12:03ohpauleezwingy: I'd thumb around on the Google Group and watch what people say but...
12:03ohpauleezYou could use CLJS:One as a base or for the docs or example
12:03ohpauleeztake a look at the projects Chris Granger has pulled together
12:04wingyalso i like that they are extending the HTML rather than me having to use DOM manipulation lib for it .. watched their Hello World video and really liked it
12:04ohpauleezLook at any of Kevin Lynagh's libraries
12:04ohpauleezwatch the talks on CLJS
12:04goodieboy,(doc contains?)
12:04clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
12:05ohpauleezSo you want to liter your HTML with app specific code, that will prevent other designers and engineers from knowing what is actually going on unless they know the framework and technologies (wingy)
12:05ohpauleezsounds to me like a bad case of complecting
12:05wingyHTML is presentation
12:05wingyhaving code and presentation together seems more like complecting to me
12:05ohpauleezRight, and you're syaing controller logic should be litered in it with framework specific binding keys
12:06dgrnbrgllasram: it seems like cast doesn't remove reflection warnings either
12:06ohpauleezwingy: You can also have a look at Enfocus, you might like that approach better
12:06ohpauleezwingy: So take a look at the list above, and then if you can't find what you're looking for, I'd say try whatever you think will get you the results you want
12:07ohpauleezI also have a lot of library support for CLJS apps with a project called Shoreleave
12:09clojure-newcomerhi guys, I'm getting a load of 'No :main namespace specified in project.clj' across several projects out of the box including ClojureScript One, any ideas ?
12:10llasramdgrnbrg: Kind of difficult to say much then... I've only run into that when trying to (incorrectly) hint a local as a primitive. Looking at the Compiler code, it's a bit more interesting, as the error means what it says: any hint on a local bound to the result of an expression the compiler decides results in a primitive is disallowed
12:11llasramdgrnbrg: So the Compiler at least thinks crazy-stuff evaluates to a primitive somehow
12:12dgrnbrgllasram: what's weird is if i macroexpand and add the hint w/ a reader macro, it works
12:15llasramdgrnbrg: You can't distill to a minimal reproducing case?
12:16dgrnbrglet me work on that
12:16dgrnbrgi'm going to just go grab a bite to eat
12:16dgrnbrgfuel for thought
12:16dgrnbrgto figure out a minimum repro
12:17AtKaaZhey, how goes?
12:22technomancypyr: nice work; you should list it on https://github.com/technomancy/leiningen/wiki/Plugins
12:23wingyohpauleez: a good thing with clj and cljs is that it is pragmatic, inviting us to use stable widespread frameworks/libs in the host env .. i do believe that it's good to be pragmatic rather than dogmatic in certain cases .. documentation means a lot .. the cljs equivalent's doc is too terse imo compared to angularjs
12:24ohpauleezwingy: Sure, I wasn't arguing against that. I just wanted to know why you felt the approach and opinions of Angular were a better fit an another option. I wanted to know the tradeoffs
12:24dnolenwingy: Angular uses a wacky polling mechanism. I wouldn't use it.
12:24wingysure
12:24ohpauleezI don't think anyone was being dogmatic, I just felt it was a bad decision, and was trying to help you find other alternatives to explore
12:25technomancypyr: btw, the leiningen jar is now on clojars along with leiningen-core, so you could try using that for the jenkins plugin instead of requiring the user to upload the standalone one
12:25wingyok ill try it out and see what the + - are and come back with some more thoughts about it
12:27wingybtw do you recommend using jQuery or is enfocus sufficient?
12:27wingyand the other one using Hiccup syntax
12:28ohpauleezwingy: I use jayq and enfocus. You can do it all with either or, but I prefer doing some things with jQuery
12:28ohpauleezI do full div and page renders with enfocus
12:28wingyohpauleez: are you using jQuery through jayq only or jQuery directly as well?
12:28ohpauleezKevin uses C2, singult, crate/hiccup
12:29ohpauleezjayq
12:29ohpauleezyou can't really use jQuery directly if you advance compile, unless you have the externs file (which comes with jayq)
12:30ohpauleezso jayq simlifies the process all around
12:30wingyi see
12:30wingyyeah: https://github.com/ibdknox/jayq/blob/master/src/jayq/core.cljs seems just like a wrapper
12:31ohpauleezsome parts of my markup have jQuery code in it, but it's usually to attach some attribute to all elements (like popover or something)
12:31wingyohpauleez: why can't i use jQuery directly if i advance compile?
12:31ohpauleezwingy: The names are going to get all mashed up
12:31ohpauleezduring compilation
12:31ohpauleezand you can if you have the externs file
12:46wingyone thing i thought about is that i dont think anyone wants to write pure css without using extenders like less or sass .. angularjs/knockoutjs seems to be the equivalent to extend the HTML's capabilities
12:47SegFaultAX|work2SASS isn't really an extension of CSS.
12:47SegFaultAX|work2It's a preprocessor for it.
12:47scriptorit's a superset, and it's still css-oriented
12:48wingyyepp so it extends the CSS capabilities
12:48SegFaultAX|work2Except it doesn't, because it's just a preprocessor for CSS.
12:48SegFaultAX|work2The output is just plain old CSS.
12:48dnolenwingy: LESS or SASS are awful IMO.
12:48wingydnolen: ble
12:48SegFaultAX|work2According to its creator, Less is an actual "language" and adds new semantics to CSS.
12:49wingyok it's a superset then
12:49wingyand angularjs is a superset of HTML
12:49SegFaultAX|work2wingy: Less maybe. Not sass.
12:49wingySegFaultAX|work2: lets get to the point instead .. scss is :)
12:50wingythe point is .. angularjs is a superset of html it seems just like scss/less is a superset of css
12:50SegFaultAX|work2wingy: I wouldn't say C macros are a superset of C because I can do any textual substitution with them.
12:50wingyok so its a preprocessor then
12:51wingydnolen: you are using plain csss?
12:51wingycss
12:51scriptorit'd be a valid analogy if angular was just an extension of html, but doesn't it also need to generate a significant amount of js?
12:52wingyscriptor: ill get back on that one later :)
12:53scriptorwingy: check out http://keminglabs.com/c2/ if you haven't, I think I prefer that approach
12:53wingybut in some examples they have bound the input field values to the output
12:53dnolenwingy: yes
12:53wingyso in those cases you don't need JS
12:53wingyscriptor: ill check it out
12:54wingydnolen: isn't that hard to maintain a big projects with repetitions everywhere
12:58dnolenwingy: no
12:58wingythen btw isn't less/sass complecting?
12:58gerunddevdnolen: I was working through Reasonable Schemer and translating it to Clojure last night. I found a couple which my Clojure version yielded different results... any interest in me sending a couple examples?
12:58wingysince now logic and styling is as
12:58wingy one
12:58scriptorless/sass involve logic?
12:58dnolengerunddev: different order or actually different results?
12:58scriptorI thought most people used it as just css with some syntax changes, so you can embed rules, for example
13:00wingyscriptor: my bad i thought mixins as logic .. haven't worked with those yet
13:01scriptorsess/lass still ends up only being responsible for design
13:01gerunddevdnolen: Different results
13:01scriptorangular/knockout start to change the html so that instead of just layout/where the data goes, it specifies *what* data goes where
13:02dnolengerunddev: can you make a gist / paste of what you're seeing?
13:05wingyi kinda have this picture: css is above html, html is above data, they should not complect each other .. so css needs to know the attributes of html to be able to know what to style right? the same thing goes with html, it needs to know the attributes of the data to be able to know what to layout
13:06gerunddevdnolen: https://gist.github.com/3137485
13:06wingyscriptor: what do you think?
13:07gerunddevdnolen: Wondering if my translation is wrong or if it's a difference between implementations.
13:08wingyand the thing about something on top of another is that the one above has to know about the lower one .. css -> html -> data is the kind of picture i have when thinking about frontend
13:08scriptorwingy: I'm not comfortable with tying the html that tightly with the actual code. Of course, I haven't actually tried it, besides playing around with the knockout tutorial
13:09scriptorwell, css has to know about the html by design, now should the data itself care about where it goes? :)
13:09wingyscriptor: it doesn't
13:10wingyrick hickey said something very guiding .. "i dont know, i don't wanna know" .. the lower one would say that about the above one
13:10wingydata seems to not know anything about the html's plan to where to put it
13:11scriptorI guess we disagree on whether html is above the data or more alongside it
13:11scriptorthe data structures you use by themselves obviously shouldn't know, but the actual rendering code does
13:12scriptorand by rendering I just mean populating the html with the data
13:12dnolengerunddev: I don't have my copy handy but the results you're seeing seem correct to me - it demonstrates the lexical scoping aspect of fresh.
13:12scriptorso angular does that behind-the-scenes by reading the data-binding rules you set, while another method is to having maybe a template manager you you control and then place where needed
13:15gerunddevdnolen: I don't know scheme... does it use dynamic binding?
13:15dnolengerunddev: your expected "results" would mean x is not properly scoped.
13:15dnolengerunddev: I don't have my copy of TRS so I can say much more. The behavior you see is correct.
13:16dnolengerunddev: no, scheme doesn't use dynamic binding.
13:16gerunddevdnolen: You don't carry your TRS copy at all times? :)
13:17gerunddevdnolen: Yeah, so if scheme and clojure both use lexical binding then it should be the same in both.
13:20dnolengerunddev: I actually think those examples just might be wrong. TRS is a very old version of miniKanren
13:20gerunddevdnolen: Yeah also possible.
13:23gerunddevdnolen: So the two vectors in conde have different scopes? Otherwise [(fresh [x] (== y x) (== z x))] would unify x to y, therefore making it _.0 from the unification of x and y in the previous vector.
13:25dnolengerunddev: what do you mean different scope?
13:26dnolengerunddev: I did just try those examples with cKanren Scheme, same results as TRS ... though I don't understand why.
13:27dnolengerunddev: weird, and in cKanren Scheme can't replace x with some other fresh logic var.
13:28gerunddevdnolen: So fresh creates a new scope... but right after the fresh we unify y with x. Y has been unified to the original x (_.0) in the previous vector.
13:28dnolengerunddev: I don't think you understand yet how conde works.
13:28dnoleneach vector is "line", they don't interact at all.
13:28dnolenis a "line" I mena.
13:29gerunddevdnolen: Ok, yeah that's what I was trying to ask... so the unification of x and y in the previous "line" is not see in the next.
13:29dnolengerunddev: nope
13:29SegFaultAX|work2Is clojure.test "official"
13:29gerunddevdnolen: Now I remember, it runs each but sort of backs out before doing the next line.
13:33gerunddevdnolen: Weird that the cKanren gives the book version, but at least I now understand the Clojure version. Thanks!
13:34dnolengerunddev: oops you have a typo.
13:35dnolengerunddev: I was about to send email and thought this behavior was too bizarre.
13:35dnolengerunddev: #58 second conde line fresh scope is too large. Probably the same case for your second example.
13:35dnolengerunddev: the whole point of those is to illustrate the scoping behavior of fresh - so you've mistyped the examples.
13:36lynaghkemezeske: ping
13:41gerunddevdnolen: Ah, yes! Closing the fresh scope means z gets unified with the previous scope of x...
13:41gerunddevdnolen: got it, thanks!
13:42dnolengerunddev: at this point I think I would be very skeptical that are any issues with core.logic as far as TRS is concerned.
13:45emezeskelynaghk: pong
13:46gerunddevdnolen: The First Rule of Programming: It's Always Your Fault
13:46dnolengerunddev: heh not true. But I spent a very long time on getting core.logic to conform to miniKanren and others have gone through TRS w/o issue.
13:47lynaghkemezeske: have you run into lein cljsbuild problems with com.google.common.collect.ImmutableList.of no such method errors?
13:47gerunddevdnolen: I don't know if you've read that article, but it states that your code is the more likely source of bugs than a library.
13:48lynaghkemezeske: I'm getting it when adding a project with hella deps to my classpath. Lein deps :tree doesn't show goog java stuff anywhere though.
13:48gerunddevdnolen: Which I do believe to be true.
13:48emezeskelynaghk: I don't recall running into anything like that
13:48gerunddevdnolen: Good to find the typo, I hope to release the clojure versions of the code in the book when I'm done.
13:49lynaghkemezeske: okay. I'll let you know if I can track it down.
13:49dnolengerunddev: if the library is mature. I'm sure when I push cKanren extensions most bugs will be my own ;)
13:49emezeskelynaghk: The goog stuff might not show up, because the clojurescript compiler is a dependency of the lein-cljsbuild support JAR
13:49emezeskelynaghk: Which is a dependency of the plugin
13:50lynaghkemezeske: ah, I see.
13:50lynaghknathanmarz: I heard you're biking around PDX these days.
13:52dnolenlynaghk: congrats on the CUFP talk!
13:52lynaghkdnolen: thanks! I think it'll be a great excuse to go to Europe (I've never been)
13:53lynaghkdnolen: I feel like I should learn me some Haskell on the flight or otherwise do some high frequency trading in OCaml so they don't immediately smell weakness on me.
13:54dnolenlynaghk: ha! hold down the dynamic fort dude.
13:58SegFaultAX|work2What is the preferred json library?
13:58SegFaultAX|work2Google yields quite a few results.
13:58technomancycheshire
13:59SegFaultAX|work2technomancy: Thanks.
14:09nathanmarzmember:lynaghk: yea, it's pretty sweet
14:11lynaghknathanmarz: If you have any interest, I'm going bouldering in 15 minutes. Gym is about 20 blocks from the convention centre
14:12lynaghkbut yeah, pdx is best by bike.
14:14zerokarmaleftlynaghk: you're into rock-climbing right?
14:16lynaghkzerokarmaleft: yeah, bouldering in particular. Whenever I speak at conferences I try to find a cohort of nerds to hit the local gym.
14:16lynaghkOSCON is easy, since I live in PDX.
14:20ro_stseconded. i'm so happy i looked at clojure first. one look at scala and … -shudder-
14:21HodappScala certainly has some strong points.
14:22ro_stcourse it does. but being a lisp is a huge advantage
14:22ro_sti can actually feel my neckbeard growing -grin-
14:22HodappI am liking, for instance, the ability to write a parser with parser combinators very concisely, compile it to a JAR, and use it from some other Java code.
14:23Hodappand it has one of the best static type systems I've dealt with thus far.
14:24technomancyreally? the fact that it can't infer locals always seemed really crippling to me, especially vs HM
14:24technomancyI mean the fact that it only infers locals
14:25technomancyseems like the fact that arguments can't be inferred would lead to methods being longer than they should be
14:25technomancybecause it encourages more locals
14:25technomancyI've only used Mirah, but supposedly they work the same way when it comes to inference
14:26HodappUmm... I've looked around most of what I've written, and I've declared argument types approximately... never.
14:26Hodappexcept for in this AST written as case classes because Java has to be able to use it sanely.
14:27technomancyhuh; I guess it must be pretty different from Mirah then. someone told me they used the same approach to inference.
14:27technomancymaybe that's only the case when writing code that's intended for consumption by Java
14:27technomancy(which for Mirah is everything)
14:28Hodappa lot of the way Scala works - from my limited view - is that normal behavior is to define anonymous functions left and right, and rarely does this involve declaring any types
14:29technomancyI guess that depends on whether you're coming from the haskell-on-the-jvm crowd or the modernized-java crowd? =)
14:31pjstadigro_st: i think you are confused...being a "not lisp" is a feature http://gosu-lang.org/compare.html
14:31ro_stbeing a lisp is a feature to me :)
14:33ro_stdoesn't clojure allow you to modify existing types?
14:33ro_stthrough extending protocols?
14:33technomancypfff... don't go bringing your "facts" into the discussion
14:33TimMcpjstadig: haha
14:34ro_st-grin-
14:34technomancyheh; they call reified generics a feature
14:35Hodapptechnomancy: I have not yet learned Haskell. I despise Java pretty horribly, but in some cases it's all I have to work with
14:35Hodappand then I'm quite glad things like Clojure and Scala exist because they give other choices than Java for a lot of the code.
14:36Hodappbut the "RABBLE RABBLE RABBLE any language without static typing cannot be used for any Real Programming(tm)" crowd very rapidly becomes tiresome.
14:37ro_stwhile they're feeding their compilers kilobytes of configuration and syntactic sugar, we're shipping features
14:38Hodappyes, static typing serves a purpose, but no, it is not automatically true that the only "real programs" a "real programmer" writes are those programs that happen to be restricted to that subset that is amenable to the automated proof of some-level-of-correctness that static type systems enforce
14:39Hodappif they're going to advocate static typing, I at least wish they'd stop using languages like Java and C++ to advocate it
14:39winkI'm missing some basic "how to speed up your clojure code" howto, as the only thing I ever deployed doesn't feel too speedy
14:39ro_stwink: first step is getting rid of reflection warnings
14:40ro_stsecond is profiling with jvisualvm
14:40winkro_st: hm, I'm not even remembering seeing some :P and yes, that's always a good idea
14:41winkI should really put that app on a decent box to benchmark
14:41winkright now on a vps it doesn't feel fast, maybe it is not that bad after all :P
14:41ro_sti keep warn-on-reflection always-on. quite a lot of the deps i'm using have reflection warnings as well
14:41ro_sttrue. if you're io dependent, a vps isn't the best place to bench
14:43jweiss_i made a macro loop-with-timeout. i have no idea where to put it. seems crazy to make a namespace and lib out of one macro. is there some standard namespace for "unrelated functions sort of like clojure.core but a bit less core than that"?
14:44ro_st".macros" ".util"
14:44ro_st".sock-drawer"
14:45jweiss_ro_st: yeah i realize i could make up a name, but everyone's name would be different, so you'd end up with 100 different namespaces each with 1 function.
14:45ro_sthow many devs would use this code?
14:45jweiss_i don't know, however many need a loop with a timeout built in :)
14:46jweiss_or do you mean the entire group of imported funtions
14:46ro_stthe codebase you've made this macro for
14:46ro_stor do you want it out of this particular app entirely?
14:46jweiss_it's not for any particular codebase. just like "assoc" isn't for any particular codebase :)
14:47ro_stah. send it along with your SSN and a blood sample to the guys who maintain clojure contrib -grin-
14:47jweiss_clojure contrib is gone man, long gone :)
14:47scriptoralso your first-born as a hostage
14:48jweiss_even back then, the functions were grouped into related things
14:48jweiss_the closest i can find for loop-with-timeout is something like clojure.core.incubator or somthing.
14:48ro_stah.
14:48TimMcjweiss_: You could take gfredericks' approach to naming...
14:48TimMc&(format "lib-%04d" (rand-int 1e4))
14:48lazybot⇒ "lib-2307"
14:49jweiss_TimMc: hehe nice
14:49ro_stso if i'm using contrib, i should stop?
14:49jweiss_so i guess having a namespace like clojure.core.ext where each project might load different things into it, is a bad idea?
14:50jweiss_possible collisions i suppose
14:51jweiss_i'm just trying to avoid either throwing unrelated things together, or having 15 different 'use's that pull in 1 function each :)
14:51technomancyjweiss_: check out nstools
14:52technomancyit lets you describe a base ns form and create new ns forms that are :like the base
14:52technomancyso shared :require clauses can be maintained in one place
14:52llasramI honestly think copy-pasting into a .util (or such) namespace for each project which needs it is the right tack. Otherwise you ether have an explosion of tiny libraries or are loading from a hodge-podge library to get 1 function.
14:53llasramObv if it grows into something more, or ends up in every project you ever create, then it should go somewhere else
14:53ro_styup. not too normalized, not too denormalized. just right.
14:53jweiss_llasram: yeah, it seems to work fine in the emacs world
14:54jweiss_no, was serious
14:54llasramOk, cool :-)
14:54jweiss_lots of functions are just floating out there on webpages, that people copy/paste to their .emacs.
14:55jweiss_llasram: only problem there is if i realize there's a bug in the function, i have to hunt down each copy
14:55llasramIt's not entirely optimal, but I think it works. At my job we have a general-purpose utility library. My rule of thumb is that when a fourth project needs a particular one-off function, I put in the utility library
14:56ro_stprobably another good rule of thumb is if it's worth writing tests for, it's worth centralizing
14:56llasramjweiss_: That's definitely a downside. I think if something is large/complex enough enough to have non-trivial bugs then -- exactly, what ro_st said
14:57jweiss_i dunno, i think i might prefer keeping it as a lib. namespaces, jars, etc are cheap. what's a pain is all the use clauses, which there are apparently solutions for
14:59llasramIf only we could magically pluck individual functions from some sort of great function repository. All of our code co-existing in a ubiquitous implicit software ecosystem...
14:59ro_styou're getting dangerously close to an xkcd comic
14:59llasram*abort*
15:00technomancyllasram: as long as you're OK referring to functions (and revisions thereof) by UUID
15:00ro_styuck
15:00ro_stwe'd need dns for fns
15:01ro_stno security issues with that at allll
15:01technomancythat's actually pretty close to how nix works
15:01emezesketechnomancy: I already use UUIDs to name my functions, to avoid ambiguity. It also saves me from having to use separate namespaces.
15:02technomancyemezeske: you didn't have anything to do with the design of elisp by any chance, did you?
15:02Hodappemezeske: please tell me you're joking.
15:02technomancy"we don't need modules, just add a prefix to every name and it'll be fiiiiiiiine"
15:02emezesketechnomancy: Not that I know of, but it depends on whether I travel backwards in time at some point in the future
15:02emezeskeHodapp: ^_^ maybe
15:03HodappI have a coworker who has a fetish for GUIDs and it's horrid
15:03technomancyemezeske: how far would you go for your editor? would you sabotage its competition using time travel? that's dedication. =)
15:04ro_stand to think you could have stopped IE6 from happening.
15:04emezesketechnomancy: Apparently I must go back and sabotage VimL, too, though
15:04technomancyhaha
15:04technomancymust maintain balance in the force
15:04emezeske:)
15:04kreig1the function ID is a sha256 of the functions AST
15:05technomancykreig1: along with the closure of all the functions it calls
15:05technomancy(which is basically how nix works, for serious)
15:05kreig1yup
15:06pjstadigif you like UUIDs then you'll like my UUID based programming language
15:07ro_stnow you're just being obscene
15:07wingyis phonegap and cljs a good combination for making mobile apps?
15:07SegFaultAX|work2Dreadful: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ns
15:08ro_stwingy: i've used phonegap and gclosure. worked ok. html render performance isn't that great
15:09wingyro_st: this one? https://github.com/rhysbrettbowen/G-closure
15:09technomancySegFaultAX|work2: yep, pretty embarassing
15:09pjstadighttp://clojure-log.n01se.net/date/2011-09-12.html#17:16c
15:09technomancySegFaultAX|work2: that whole thing needs to be replaced with a link to http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
15:09ro_stsorry, by gclosure i mean the Google Closure Library, Templates and Compiler
15:09wingyi see
15:09SegFaultAX|work2technomancy: Hah, that's what I'm reading right now.
15:09SegFaultAX|work2technomancy: It is awesomely thorough.
15:09ro_stahh awesome link
15:10devnwill core take a whitespace fix commit? There's a ton of annoying whitespace and I end up git add -p'ing everytime i make a change and saying no to 100 automatic trailing whitespace fixes that happen when I save with emacs
15:10technomancyAFAIK it's literally the only coherent explanation of namespaces on the web
15:11SegFaultAX|work2technomancy: :( that makes me wonder how so many people are Getting Shit Done (tm) in clojure when there is so much of the language that's improperly documented.
15:11technomancySegFaultAX|work2: it's documented, just not in the right place
15:11technomancypart of learning clojure is learning what sources you can trust unfortunately
15:11wingyro_st: phonegap seems to be the only hope for not using different langs in each platform
15:11technomancyand routing around the damage of clojure.org
15:11SegFaultAX|work2technomancy: That's pretty bad.
15:12ro_stclojuredocs.org is canonical, isn't it?
15:12cemerickI've never seen a language or library that is "properly" documented.
15:12llasramtechnomancy: Yeah... I guess I really just want a system where fine-grained package boundaries have no negative implications and tooling automatically manages the common-case. I actually think Clojure is just about the closest I've experienced
15:12SegFaultAX|work2technomancy: It seems there is no way to effectively develop clojure without an internet connection.
15:12technomancySegFaultAX|work2: I wish there was something us mere mortals could do about it
15:12ro_stperhaps when datomic is finished :-)
15:12SegFaultAX|work2cemerick: Well perhaps. But Python and Perl, for instance, generally do a pretty good job IMHO.
15:12technomancyro_st: clojuredocs.org is community-maintanied
15:13ro_stwingy: yup, if you want something simple done quickly
15:13llasramSegFaultAX|work2: Oh yeah, IMHO the Python official doco has gotten *amazing*
15:13ro_stif you want something worth selling, however, there's very few reasons why you shouldn't go native
15:13cemerickSegFaultAX|work2: There's always brokenness. popen v. popen2 v. popen3 v. whatever the new thing is. *shrug*
15:13SegFaultAX|work2llasram: Yes. And integration with the language makes it so you don't have to have internet access to hack something because the online documentation is always available.
15:14cemerickNot to excuse brokenness in the Clojure sphere, but I take such things as a given when humans are involved.
15:14SegFaultAX|work2cemerick: Yes that's true. But that's a different issue from being well documented.
15:14ro_sttechnomancy: ah. so the official docs, what's happening there? the peeps involved not pulling their weight?
15:14ro_stor not handing control over to those who can?
15:14SegFaultAX|work2cemerick: The root of the problem stems from no one being able to get anything into core without having signed the developer agreement.
15:15pjstadigoh boy
15:15pjstadighere we go
15:15pjstadigis this our ever 90 days CA rant?
15:15SegFaultAX|work2cemerick: Also, are you the author of Clojure Programming?
15:15cemerickSegFaultAX|work2: depends on who wants to know and why. :-)
15:15vijaykiranSegFaultAX|work2: yup he is :)
15:15SegFaultAX|work2cemerick: I was wondering if it would be rude of me to offer some feedback?
15:16cemerickwhack away
15:16cemerickBut, um, the book's done…one way or the other. :-)
15:16technomancyro_st: as far as I can tell, yeah, and not very interested in help from the community
15:16TimMcpjstadig: No, it's our Wednesday CA rant.
15:16SegFaultAX|work2cemerick: Overall I think the book is quite good so far (I'm up to Macros). The one caveat is that you introduce new functions /all the time/ without providing any hint as to what they do.
15:16ro_stthat sucks
15:17wingytechnomancy: seems to be a bad style .. crowd sourcing FTW
15:17cemerickSegFaultAX|work2: like?
15:17SegFaultAX|work2cemerick: It becomes very difficult to work through it without a browser open constantly referring to the documentation.
15:17technomancywingy: don't get me started
15:17scriptortechnomancy: let's get you started
15:17technomancyno
15:17technomancyno, I have work to do
15:18ro_stif you could tell everyone getting started where to go instead of clojure.org, where would it be?
15:18SegFaultAX|work2cemerick: I feel it is mitigated to some extent with cross-referencing in the footnotes, but generally after the first chapter or two there is an implicit assumption of familiarity with the clojure standard lib.
15:18ro_stclojuredocs.org and #clojure?
15:18wingyclojure.org for the guides for each section
15:18scriptoris http://learn-clojure.com/ kept up-to-date?
15:18TimMcro_st: clojure.org is actually very, very useful.
15:18technomancyro_st: the dev.clojure.org wiki is a bit better since it's community-maintained
15:18wingybut clojuredocs.org for API consulting
15:18technomancy~volkmann
15:18clojurebotvolkmann is probably the best free introduction to the Clojure language: http://java.ociweb.com/mark/clojure/article.html
15:19technomancy^ is the best bet for learning the language itself
15:19ro_stwasn't aware of dev.
15:19cemerickSegFaultAX|work2: Not familiarity, but we did assume that, if you see a function you don't know yet, you can use a browser or your REPL to look it up, or simply infer what it's doing from the example output, etc.
15:19ro_stthis ? http://dev.clojure.org/display/doc/Home
15:19SegFaultAX|work2cemerick: The specific example that comes to mind is the Conway's Game of Life example. That's relatively early in the book but it assumes a lot of knowledge of how things work.
15:19cemerickIf we went function-by-function talking about what they did, the book would be a library reference and nothing more.
15:19technomancyro_st: it's not great (requires a CA to make edits (but not to comment; wtf)) but at least it gets updates
15:19SegFaultAX|work2cemerick: What each function does, what it takes, etc.
15:20ro_stcemerick, SegFaultAX|work2, i think that was a good decision on their part. it's a huge book even without all the asiding that would take
15:20SegFaultAX|work2cemerick: I don't think the discussion needs to be exhaustive. Just enough to understand the code in context.
15:20technomancyvolkmann's site could probably be turned into a pretty good general landing page beyond just learning the language itself
15:20ro_sti'll have a trawl around. always eager for more knowledges
15:21SegFaultAX|work2cemerick: I mean, this is coming from the assumption that this book is geared towards new clojure-ers but not necessarily new developers.
15:21cemerickThe more advanced examples are all like that; game of life, maze generation, the larger RPG bits in the concurrency chapter, the mandlebrot set stuff.
15:21cemerickYes, we assumed familiarity with one of Java, Python, or Ruby.
15:21technomancyhttp://docs.python-guide.org/en/latest/index.html <- pretty wonderful and worth emulating
15:21ro_stthe book's examples made it pretty clear to me: you'll have to do your homework
15:21SegFaultAX|work2cemerick: I guess the thing is, it seemed like going from baby steps to a marathon in the span of 2 pages.
15:22SegFaultAX|work2technomancy: Agreed.
15:23cemerickSegFaultAX|work2: That's fair. I'm pretty happy with the result, though.
15:23SegFaultAX|work2cemerick: Again this is /my/ humble opinion as I work through your text right now.
15:23cemerickAny more exposition, and I simply would have killed myself before finishing. ;-)
15:23SegFaultAX|work2cemerick: Understood. I just wanted to offer some feedback.
15:23cemerickSure, np. :-)
15:23ro_stone thing i think the community would benefit from is more screencasts and presos
15:23cemerickI'll pass it along to whoever's gonna do the 2nd edition. :-D
15:23ro_sti'm absolutely loving the euroclojure and clojure/west ones as they come out
15:23wingycemerick SegFaultAX|work2 I guess Clojure Programming doesn't fit a person with clj as the first language
15:23SegFaultAX|work2cemerick: The thing is, I am a BART reader. So not being able to follow what I'm reading without a laptop open sucks sometimes.
15:24ro_steven if it's waaay outside my own area of interest
15:24SegFaultAX|work2cemerick: (BART is the local subway in San Francisco, if you didn't know)
15:30SegFaultAX|work2ro_st: Lisps tend to be particularly conducive to experimentation IMHO.
15:30SegFaultAX|work2Whoa, did we just recover from a netsplit?
15:31ro_stoh, me neither. i was just so enthralled by the novelty of it (and all my screentime was tied up on other things)
15:32ro_sti can start an (atom) at nil and later give it a map, right?
15:33scgilardiro_st: yes, reset! makes that easy
15:33SegFaultAX|work2ro_st: Also swap!
15:34ro_stok, so an atom can be reset! to anything, but swap! requires the incoming type to match the current type?
15:34ro_stor am i dreaming
15:35tbaldridgero_st you can swap it with anything,
15:35ro_stok cool
15:37SegFaultAX|work2ro_st: swap! is cool because you can provide a function that will do the right thing based on the current value of the atom. Eg set it if it's nil, merge it, etc.
15:39ro_stbecause i'm reading the value of a privately declared atom, my fact is using @@#'alias/var :-)
15:48ro_stwhat's the magic word to tell emacs to transpose two forms, making the child the parent of it's current parent?
15:49ro_st(foo (bar)) => (bar (foo))
15:49ro_sti feel like i'm picking a skill for my diablo character -grin-
15:50TimMcro_st: There's paredit-convolute-sexp
15:51TimMce.g. (when foo (let [a 5] | etc)) -> (let [a 5] (when foo | etc))
15:51ro_stthat's the one
15:52ro_stif i C-h f paredit-convolute-sexp
15:52ro_stwould it show the binding if there is one set?
15:53TimMcyeah
15:53ro_stcool. i'll have to set one
15:53TimMcI don't know how to set bindings. :-/
15:53ro_sti do, thanks
15:55TimMcro_st: Well, tell me then! :-P
15:56ro_st(global-set-key (kbd "C-c v") 'eval-buffer)
15:56rplevyhas anyone ever compiled a semi-exhaustive checklist of Clojure performance common sense?
15:56ro_stput something like that in your .init.el
15:57ro_st.emacs.d/init.el i mean
15:58ro_streplace eval-buffer with paredit-convolute-sexp and C-c v with your own incantation
16:01TimMcro_st: \o/
16:01TimMcOK, that was easier than I imagined.
16:02amalloyTimMc: the power was within you all along!
16:17ro_stTimMc: https://github.com/robert-stuttaford/.emacs.d/blob/master/packs/user/user-pack/init.el and https://github.com/robert-stuttaford/.emacs.d/blob/master/packs/user/user-pack/config/bindings.el
16:17ro_stsorry for the huge links. that's my emacs config, based on emacs-live from overtone
16:19michaelr525ro_st: what's good in there?
16:20ro_stit's actually mostly stock emacs-live. i added compile-on-save for *.clj, whitespace-cleanup on save, kibit integration, and some short cuts to stuff i use all the time
16:21ro_stmidje-mode. auto-highlight-symbol. both indispensible
16:21ro_stauto-highlight-symbol is awesome; put cursor on something, it highlights all instances in the buffer
16:22TimMcI'm very, very cautious about altering my emacs config.
16:22ro_stmaxframe to maximise emacs on screen - this config is for Emacs for OSX
16:22TimMcThe last time I tried anything I had to restore from backup. :-/
16:22ro_stmines still very shallow. i'm reckless :-) and it's in git
16:27duck1123I'll probably end up stealing your kibit stuff
16:27ro_stwith pleasure. i stole it directly from the author of kibit
16:28emezesketheft!!
16:28emezeske~guards
16:28clojurebotSEIZE HIM!
16:28duck1123Are you ever worried about the auto load sending bad stuff to your connected repl session?
16:28ro_styou mean compile-on-save?
16:28ro_sti try to compile my defproject all the time :-)
16:28duck1123ro_st: yeah
16:28ro_stit hasn't bothered me yet
16:29ro_sti've probably had to restart a repl a couple times because of it
16:29ro_stbut the amount of time i've saved by it being automatic is worth it
16:29duck1123C-x C-s C-c C-k is muscle memory enough as it is
16:29kennethhey—i'm still looking into how to use a jar whose path i know in a lein project
16:30amalloy~repeatability
16:30clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
16:30ro_sti suppose. i put that bit in place in the first couple days of my emacs spelunk
16:30TimMcro_st: I would probably prefer a keybinding that sequenced save + compile.
16:30kenneththis is an internal project and every server that runs it will run on has this jar installed in /usr/share/java, i've read all about repeatability but building our own repository is not in the picture at this moment
16:31ro_stshould be easy enough to do, TimMc. just bind something up to that fn and kill the hook
16:32duck1123Before I started wrapping all my midje tests, I had a few unfortunate incidents where Midje wiped my dev database and replaced it with auto-generated test data
16:32duck1123Now I'm paranoid about accidentally evaling my tests
16:34emezeskekenneth: Setting up a maven repo is *really* not hard, and has tons of benefits for your internal apps
16:34emezeskekenneth: With that said, :extra-classpath-dirs could be used to hack together what you want
16:35xeqiemezeske, kenneth: :extra-classpath-dirs is lein1 only for reference
16:36kennethemezeske: okay, then, i'll use that in the meantime, and look into setting up a maven repo long term
16:36ro_stduck1123: all mine have rebound config vars for dbs in background around :contents
16:36ro_stand i'm never connected to a production server from emacs
16:36ro_stday will come, no doubt
16:37ro_sti'm out. good hunting!
16:37duck1123ro_st: That's essentially what I do, but I hit some issue with background contexts so I switched to wrapping the whole ns in a macro
16:37emezeskexeqi: Truth.
16:43mtkoancan anyone help me figure out why this trivial macro test in clojurescript isn't working? http://pastebin.com/LgtAwUvU
16:46emezeskemtkoan: How are you compiling it?
16:46mtkoanlein cljsbuild
16:47emezeskemtkoan: And macros.clj is properly in a /kambeo/ directory?
16:47nDuffmtkoan: ...as an aside, would you consider using a pastebin without the ads next time? gist.github.com and refheap (the latter written/owned by Raynes) are both good ones.
16:47mtkoanyes.. same dir as effects.cljs
16:48mtkoannDuff: sure
16:51emezeskemtkoan: I would consider what that macro expands to; isn't it going to try to ns-resolve console/log in the current namespace, due to the syntax quote?
16:51jarray52Is there a way to press up and get the last command typed in the clojure interpreter?
16:52emezeskemtkoan: I might be wrong about that, since console/log has a namespace component
16:52nDuffjarray52: JLine and/or rlwrap are your friend for that, though IIRC, "lein2 repl" ought to take care of it for you.
16:54jarray52nDuff: I was trying to remember the name rlwrap. That works. Thanks.
16:54nDuffjarray52: ...just curious, are you not using leiningen?
16:55nDuffmtkoan: Which version of cljsbuild? I don't see that with the version of clojurescript bundled with the current one. (I _do_ get a whole bunch of warnings out of Enfocus-0.9.1, on the other hand)
16:55jarray52nDuff: I already had rlwrap installed. I just couldn't remember the name.
16:57mtkoanbarfs just the same on (defmacro foomacro [name] `(defn ~name [] "foo"))
16:57mtkoannDuff: cljsbuild 0.1.10
16:58emezeskemtkoan: So, the compile is succeeding, though, right? And the barf is runtime?
16:58mtkoanit compiles with warnings
16:58emezeskemtkoan: I'd carefully inspect the javascript output from the macro expansion, to see what it's doing
16:59mtkoanthe compiler is trying to derefence the symbol, but it should be passed to the macro
16:59mtkoandoesn't look like there is any...
16:59nDuffmtkoan: That's pretty ancient; I'm using 0.2.4
16:59emezeskemtkoan: You are sure the dereference is not happening when you call (foo)?
16:59mtkoannDuff: hmm didn't realize I was so far behind
17:01wingyhow do i make a folder visible in compojure?
17:01wingyi have this line in the main routes: (route/resources "/")
17:03RaynesThat makes it serve things under resources/public
17:03RaynesIt wont give you an index or anything though. Serving static files is really something better done by nginx or something.
17:05wingyi see .. i thought it was serving from /public
17:06wingywhat's the difference between files and resources: http://weavejester.github.com/compojure/compojure.route.html#var-resources
17:08emezeskewingy: Generally a resource can be looked up from anywhere in the classpath, e.g. from another JAR or something
17:08wingyhm i see
17:08wingyill stick with files then
17:10wingyi see now
17:10wingyfiles is serving under /public
17:10wingyresources were serving under /resources/public
17:11emezeskewingy: In a leiningen project, /resources is added to the classpath by default, I believe.
17:11wingyok so resources is serving everything in the class path .. isn't that not good for security?
17:12wingyor is it only for dev?
17:12amalloyit's only serving things named /public/* on the classpatrh
17:12wingyah
17:12amalloyif you put something security-critical there, you deserve what you get
17:12wingythat makessense
17:13wingycan never know what the libs are putting in their public folder
17:14emezeskeProbably things that they want to be available publically?
17:14mtkoanlooks like upgrading cljsbuild fixed it
17:14emezeskemtkoan: I'll be. That's good!
17:15wingyemezeske: just looking into it from my apps perspective .. wouldn't be great if they could access other things than app specific stuff
17:16emezeskeThey?
17:16wingyend users
17:20wingybut i cannot control the libs public things
17:23RaynesWhat libs are you worried about?
17:24wingyits more like i dont get why this would be good choice for production apps
17:24RaynesWhat could a library author possibly put in a public directory that would have the faintest effect on you and your application's security?
17:24wingywhy would i serve my libs public stuff?
17:24emezeskewingy: Because that's what /resource/public *is* ?
17:28wingy:/
17:29wingya example of what public/ files i lib would serve and why i would want it in a production app?
17:29emezeske/resource/public/css/my-file.css ?
17:31wingyi see .. to used to put everything in my app's own reources/public/css folder
18:15austinhIs there any guarantee of order in unsorted maps? Or, are the functions that treat a map as a sequence guaranteed to always map over the same map in the same order?
18:16austinhe.g., is this always true (= (vals map) (vals map))
18:16dnolenaustinh: as long as the contents of the maps are the same yes (limited to a particular JVM I believe)
18:18austinhdnolen: Thanks!
18:22amalloyaustinh: yes, but there's usually a better way to solve the problem that winds up not relying on that
18:29austinhamalloy: I need to parse a map to separate keys from vals, but obviously I need to keep their order correct.
18:32amalloyhuh? parse a map? anyway if you have a map you can just call seq on it once, and get a seq of k/v pairs
18:32S11001001austinh: vals having stable order isn't the same as vals having an order bearing some relation to the map's literal form
18:32S11001001austinh: namely, you can't use clojure reader if you must preserve read-in order
18:33austinhS11001001: Right, that's why I posed two questions initially?
18:33austinhs/?/.
18:33S11001001austinh: ok
18:33austinhS11001001: Thanks, that part about the reader is exactly the kind of info I was looking for.
18:35austinhI'm just trying to write yet-another SQL DSL--nothing ambitious, just something to paper over some common use cases.
18:35austinhAnd I wanted to use maps to specify WHERE clauses.
18:35S11001001how?
18:35clojurebotwith style and grace
18:36austinhS11001001: How what? How are WHERE clauses specified?
18:36S11001001I mean, where takes an expression, which seems like a fit for lists rather than maps to me
18:37austinhS11001001: Right, but the most common use case that I have is something like "WHERE id = customer-id AND name = "austin" AND..."
18:38austinhSo I write {:id customer-id, :name "austin} instead.
18:39S11001001and for cases when it is, () is a suitable alternative for {} in dsls
18:39austinhI'm writing a couple small functions to handle 90% of the cases and leaving it very close to straight SQL (and rewriting keywords) for everything else.
18:40austinhBut, if order is going to be specific, and what you say about the reader is true, then I need to verify that SQL doesn't depend on order of those expressions.
18:40austinhs/specific/specified
18:45ToxicFrogWhat's the preferred way to make def-like things module-local?
18:45ToxicFrogthere's defn- for functions, but nothing for vars
18:46emezeskeToxicFrog: (defn- ...) is short for (defn ^:private ...)
18:46ToxicFrogAah
18:47S11001001,(meta '^'private private)
18:47clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map>
18:48S11001001too bad
18:48S11001001,(meta '^cons private)
18:48clojurebot{:tag cons}
18:48S11001001oh, nice
18:50S11001001,(-> '^^^private private private private meta :tag meta :tag meta)
18:50clojurebot{:tag private}
18:50S11001001excellent
18:50ToxicFrogaaaaaa
18:52S11001001metaryoshka
18:54S11001001,(take 5 (iterate (comp :tag meta) '^^^a b c d)) ; iow
18:54clojurebot(d c b a nil)
18:57clj_newb_209458is it wrong if I'm writing a clojure web app, and finding mysefl needing both redis and mongodb?
18:57clj_newb_209458i'm getting the impression taht I want to use mongodb for the actual k/v store, but using redis for the index of sorts
18:58clj_newb_209458nDuff: there isn't
19:02hiredmanmongodb is such a joke, it boggles the mind that people continue to use it and ask about it
19:07nDuffhiredman: ...it's less of a joke than it used to be. I remember when they had absolutely zero public documentation about their concurrency semantics.
19:07RaynesI must be pretty darn stupid.
19:09SegFaultAX|work2nDuff: Have great documentation for a turd doesn't make it a better turd.
19:09SegFaultAX|work2Having*
19:30wingyi have a index.html file in resources/public .. what is the best way to serve that one under the GET / path?
19:36wingyi ended up using (slurp "resources/public/index.html") in that compojure route
19:42duck1123wingy: I've used other things in the past, but I think you might want ring.util.response/file-response
19:42emezeskewingy: That sounds like the kind of thing you'd want your webserver frontend to do
19:43duck1123I normally use wrap-file and wrap-file-info, but that's for serving the whole directory and I'm not sure if there's a better way now
19:44duck1123emezeske: Should you still set it up to serve those files on the off chance you haven't set up nginx/apache yet?
19:44emezeskeduck1123: I mean, if you want to do things twice
19:45bprdoes anyone know what is going on with aleph/lamina/gloss when this is thrown: java.lang.IllegalArgumentException: Don't know how to create ISeq from: org.jboss.netty.buffer.BigEndianHeapChannelBuffer
19:45duck1123bpr: sounds like you're trying to manipulate the body of the request as a seq
19:45bprI looked at the code in gloss that throws that excpetion, and there's a cond in there that handles different types on a case-by-case basis
19:46bprand it has a case for ByteBuffer but not for BigEndianHeapChannelBuffer. Should I just add a new case? Why was it left out?
19:46duck1123finding the source of errors in Aleph can be hard, but that's the nature of the asynchronous beast
19:46bprwell, it's coming from a websocket message
19:47bpri can send text via the websocket, but not an ArrayBuffer. Sending an ArrayBuffer results in that exception
19:48bprthis exception is being thrown before any of my code gets invoked
19:48wingyduck1123: i used the fn you suggested like this: https://gist.github.com/3139752
19:48wingywhat is the difference?
19:49wingyhttp://mmcgrana.github.com/ring/ring.util.response.html#var-file-response one is that it returns nil if the file is not there
19:50duck1123That was just the first thing I found from going over the ring source
19:50duck1123Figured if it existed, it'd be there
19:50wingyanother thing is that i didn't need to specify index.html
19:52wingyemezeske: you mean a nginx? what is the difference between putting files in nginx vs having it in my web server
19:53wingyfaster i guess and caching?
19:53wingyim going to use Heroku for my app .. does that mean putting files in web server like now is the only way?
19:56emezeskewingy: Generally a dedicated web server is going to be vastly better at serving static files than your app
19:58wingybut what if A. I need to do some logic to know what file to serve, eg. check if its a mobile or desktop browser B. i have a caching layer in front of the web server. does that mean my app is serving the file once and then the cache is served other times?
20:01nDuffwingy: that's what the Vary header is used for.
20:01emezeskewingy: I'm not going to explain it in great detail, I suggest doing some reading on the topic of web app deployment.
20:03nDuffwingy: ...suffice to say that you _can_ tell caches to do The Right Thing in this kind of environment.
20:03wingybut if im going to use Heroku as hosting platform, that does mean that I can't control these things right
20:03cemerickwingy: Having the app serve static resources is perfectly fine. When that stops being the case, you'll know pretty fast, and then a CDN or somesuch is probably a better approach than worrying about nginx/apache/whatever.
20:04wingycemerick: that i have thought about .. images would be served from CDN
20:06cemerickAlso, look at compojure.route/resources and compojure.route/files. slurp and file-response are far too low level for most uses. Example app that uses the former is here: https://github.com/clojurebook/ClojureProgramming/tree/master/ch17-webapp-lein
20:07emezeskeThere is definitely nothing "wrong" with serving static stuff from the webapp directly, but I think it's usually a heck of a lot easier to configure a web server to do it. E.g. nginx' config files are basically a DSL for how to serve things.
20:09duck1123So I've been looking at the knockout.js site today, and I'm not sure if I should give that style a try or not. Anyone have advise on this matter wrt clojurescript?
20:10duck1123I am definitely looking to up the js in my site, but I want to keep the no-js option as functional as possible
20:10lynaghk`ping: ibdknox
20:11duck1123I'm not using noir, so a lot of his stuff isn't entirely appllicable, but I am enjoying waltz
20:12wingycemerick: nice example, but the problem with that is that i wanna serve resources/public/index.html in GET / route
20:14duck1123wingy: just set up to use enlive. You know you're going to want to dynamic up / soon enough
20:14wingyduck1123: not quite sure about that since it will be a single page app :)
20:15FareILC'2012 has extended its deadline -- send your article abstracts before Aug 5! http://international-lisp-conference.org/2012/index.html
20:16duck1123wingy: What did you end up going with? I see in the logs that you were asking about angular.js earlier.
20:18wingyduck1123: i ended up with angular .. i can give you a good read about a comparison about angular and knockout
20:19wingyduck1123: http://zdam.posterous.com/angularjs-vs-knockoutjs-knockout-gets-kod
20:19duck1123see, the thing is, I already have extensive templating and view code in hiccup. Thus far, I've been rendering html strings or json and sending that over, but it's mostly in html so far
20:21duck1123Wow, I'm not sure if I should trust the advice of someone who's css renders that badly for me in Chrome/OSX.
20:21duck1123The header is in the middle of the text and it changes colors halfway down
20:22wingydont take it as an advice .. see if what he says makes sense
20:23brehautwow that is quite squiffy
20:24wingyis that good or bad
20:24brehautsquiffy is bad
20:24wingythat is not good
20:24duck1123I'm so glad that once again, bad means bad
20:24imeredithi dont really like knockout or angular - i feel like its going to be another year or 2 before things really mature
20:24Bronsahttps://gist.github.com/3139914 non-tested, just finished clojure reader implementation in clojure
20:26imeredithwell, i just really like the way that both use dom attributes to do things, prefer the way that backbone does it more, but that also has other things i dont like heh
20:26duck1123I'm thinking that a really good clojurescript library on top of knockout could be quite powerful
20:26wingyhere is another one: http://litebyte.net/blog/?p=135
20:27duck1123I like knockout because it's properly using data attributes
20:27brehautBronsa: is it roughly a direct port of the java imp?
20:27Bronsait's not a 100% port but mostly yes
20:28brehautBronsa: thats sensible i think. too easy to miss things if you do it from scratch
20:29wingyduck1123: https://groups.google.com/forum/?fromgroups#!topic/angular/8iorDWKsMyI
20:31duck1123wingy: nice, I saw those ng attributes and was instantly turned off
20:31duck1123I look forward to hearing how it works out for you
20:31wingyyou mean you are still turned off?
20:32wingyor is it ok now that you can use data-ng...
20:33duck1123I was turned off that they used a custom attribute slightly. I feel better now that I know it's customizable
20:33wingythey should update the doc using data-...
20:33wingy:)
20:35wingyyeah ill get back to you in 3-4 weeks about the experience .. but it will sure be better than YUI/Sproutcore/ExtJS for sure :)
21:06cemerickwingy: so add a route like (GET "/" [] ((route/resources "/") "/index.html"))
21:42wingycemerick: i get java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
21:45cemerickoh, sorry, I botched that one
21:45cemerick(GET "/" request ((route/resources "/") (assoc request :uri "/index.html"))
21:46cemerickThat assumes you have a file on your classpath @ /public/index.html
21:48duck1123One of the downsides of lein2's new logging for install is that I can no longer see the groupId of what I just installed
21:51kennethif i have a function which receives something and a function which sends something, which is more idiomatic:
21:51kenneth(receive #(send %))
21:51kennethor (send (receive))
21:52technomancyc.j.jdbc doesn't have anything lower-level than do-commands, does it?
21:52technomancyhitting a bug in either do-commands or the postgres jdbc driver and wondering how deep down the rabbit hole I have to go to work around it
21:53cemericktechnomancy: like?
21:53technomancySELECT setval('mytable_id_seq', 12) -> PSQLException: A result was returned when none was expected.
21:54technomancysuspect the jdbc adapter is to blame there
21:55cemerickYou should be using with-query-results for that, not do-commands.
21:55technomancysuppose that makes sense; even though it's totally a side-effect
21:56cemerickyeah, `select` anything requires with-query-results
21:56cemerickI do the same with nextval, etc.
21:56technomancythanks
21:59wingycemerick: ok it worked
22:00wingyso that one you provided is faster than (GET "/" [] (util-response/file-response "resources/public")) ?
22:01kennethcan you guys critique my code? https://gist.github.com/36b552afb7e9975d78e9
22:01kennethiw ant to be as idiomatic as possible
22:04hiredmankenneth: ctx's are not thread safe last I checked
22:05kennethhiredman: right, but my main-loop is single-threaded, afaik
22:05hiredmankenneth: bleh
22:06amalloyi've never seen anyone surround their [parameters] with [brackets] in clojure
22:08hiredmanit drives me nuts how many pieces of various messaging systems (rabbitmq, 0mq, etc) are not thread safe
22:08hiredmanthe hell
22:08kennethagreed
22:09kennethoh wait, hiredman i just realized i might run more than one broker, but since the ctx is defined in that let, it'll be the same everywhere
22:09kennethfml
22:10kennethoh god, this is going to be painful
22:11cemerickamalloy: it's not a horrible notation, actually
22:12cemerickI usually use `backticks`, but the brackets are pleasant to pick out and imply the right thing at first glance.
23:21wingythis is from the compojure doc: (resources path & [options])
23:22wingyhttp://weavejester.github.com/compojure/compojure.route.html#var-resources
23:22wingydoesn't that mean you would do it like this : (route/resources "/" :root "app")
23:22wingyrather than (route/resources "/" {:root "app"})
23:22kenneth(doc each)
23:22clojurebotexcusez-moi
23:23wingyi noticed the latter worked but seing (resources path & [options]) as signature i thought it was the former syntax
23:23kennethhow do you do an each in clojure, ie. a map where you don't care about collecting the values?
23:24wingyis it me reading the signature wrong? I thought & meant the rest arguments
23:27duck1123kenneth: (doseq [item items] (println item))
23:30xeqiwingy: consider (.. & [options]) vs (.. & options)
23:30wingyxeqi: right
23:41kennethso if i do: (let [as [0 1 2 3] bs [9 8 7 6]] (doseq [a as b bs] (println (format "a %d and b %d" a b))))
23:42aduhi all
23:42kennethi get every combination of as and bs, what would i do if i'd like to merge the two, get [0 9] [1 8] etc…
23:43mattmoss,(map identity [0 1 2 3] [9 8 7 6])
23:43clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity>
23:43mattmossoops
23:44mattmoss,(map (fn [x y] [x y]) [0 1 2 3] [9 8 7 6])
23:44clojurebot([0 9] [1 8] [2 7] [3 6])
23:44xeqi&(map vec [0 1 2 3] [9 8 7 6])
23:44lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: core$vec
23:44xeqi&(map vector [0 1 2 3] [9 8 7 6])
23:44lazybot⇒ ([0 9] [1 8] [2 7] [3 6])
23:44mattmossthanks, xeqi
23:44kennethah neat
23:44kennethokay
23:45kenneththere's no way to skip the map, if i want to execute with a and b, not get the result
23:45kennethlike
23:46kennethoh i guess it's not too bad
23:46kenneth&(let [as [0 1 2 3] bs [9 8 7 6]] (doseq [[a b] (map vector as bs)] (println (format "a %d and b %d" a b))))
23:46lazybot⇒ a 0 and b 9 a 1 and b 8 a 2 and b 7 a 3 and b 6 nil
23:49amalloy&(doc printf)
23:49lazybot⇒ ------------------------- clojure.core/printf ([fmt & args]) Prints formatted output, as per format nil
23:53noidi_kenneth, you could also do this:
23:53noidi_&(let [as [0 1 2 3] bs [9 8 7 6]] (doall (map #(println (format "a %d and b %d" %1 %2)) as bs)))
23:53lazybot⇒ a 0 and b 9 a 1 and b 8 a 2 and b 7 a 3 and b 6 (nil nil nil nil)
23:54noidi_oops, should've used dorun there
23:54noidi_&(doc dorun)
23:54lazybot⇒ ------------------------- clojure.core/dorun ([coll] [n coll]) When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun ... https://www.refheap.com/paste/3681
23:55noidi_doall forces side effects and returns the results, dorun forces them and returns nil
23:56noidi_http://onclojure.com/2009/03/04/dorun-doseq-doall/
23:58kennethah yeah