#clojure logs

2012-10-19

00:00TimMcScroll to the bottom for the finished product.
00:02technomancycallen: sounds like clojurebot needs a new factoid
00:16TimMcclojurebot: rest is also easy to write without alphanumerics: https://www.refheap.com/paste/5980
00:16clojurebotAlles klar
00:20TimMcgfredericks: ##(#({} %& :constant) :whatever) is my new favorite #'constantly
00:20lazybot⇒ :constant
00:22technomancyfewer chars!
01:31hyPiRionTimMc: Madman.
01:31hyPiRionWell, it's not that long though.
01:59john2xhow do I turn (map str seq) to use `->` syntax? (-> seq (map str)) is wrong..
02:00ivan,(-> seq (map str))
02:00clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$str>
02:00ivan,(->> seq (map str))
02:00clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$seq>
02:01ivan,(->> '(1 2 3) (map str))
02:01clojurebot("1" "2" "3")
02:04antares_john2x: -> places values as the first argument. You need ->> (places arguments to the end)
02:04antares_john2x: I doubt (map str seq) really needs to use ->>, though, it is best readable as is
02:05john2xantares_: thanks. yeah, i guess I'll do my chaining elsewhere
02:27shriphanihello clojure-devs. I am starting learning clojure and I can't debug why this 1 line example doesn't work: user=> (defrecord Book [title author])
02:27shriphanijava.lang.Exception: Unable to resolve symbol: defrecord in this context (NO_SOURCE_FILE:43)
02:29noidiwhat version of clojure are you using?
02:29shriphanihow do i check ?
02:29shriphaniClojure 1.1.0
02:29shriphanitoo old ?
02:29noidiokay, that's *ancient* :)
02:30noidiit's from time before records and protocols
02:30shriphanioh wow.
02:30noidiI suggest you start by downloading leiningen (it's a bit like Maven for Clojure, but not nearly as scary) https://github.com/technomancy/leiningen
02:31noidi(or Rubygems or PIP or whatever)
02:31shriphanii just got clojure off brew (I'm on os x).
02:32shriphaniand i can defrecord now.
02:32noidiok, cool :)
02:33john2xhow do I convert a string to a regex? something like (str #"" "blah" "$") => #"blah$"
02:33noidiin any case you should check Leiningen out. it's the de facto way to manage the clojure version and dependencies that your project is using
02:34noidijohn2x, http://clojuredocs.org/clojure_core/clojure.core/re-pattern
02:34john2xnoidi: oh missed that. thanks
02:50john2xis there a way to reload all libs loaded in the current REPL?
02:52Iceland_jacka
02:53arrdemis there a good way to build one value between several macro invocations?
02:54arrdemI'm wishing for a way to write a macro wich will expand into a (def), and also insert an entry into a map.
03:00ChongLiarrdem: yeah, wrap it in a do block
03:00ChongLierrr, I misread
03:04noidijohn2x, I haven't tried it, but clojure.tools.namespace seems to do that https://github.com/clojure/tools.namespace
03:04noidiapparently all you need is (use '[clojure.tools.namespace.repl :only (refresh)]) (refresh)
03:09john2xcool. thanks. hmm I get "Could not locate clojure/tools/namespace/repl". that means I have to add it in my project.clj? Is there a way to always use it for all my REPL's in the future? I'm using leiningen 2.
03:16noidijohn2x, check out leiningen's profiles https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md
03:17noidiadd a :user profile in ~/.lein/profiles.clj which adds tools.namespace as a dependency
03:18noidiand it'll be available in all your projects
03:20abpjohn2x: are you converting user input to regex or are there special chats in the string? Then you probably want to use http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#quote(java.lang.String) on the string before building a pattern.
03:20noidithis post describes how to load a library (clj-stacktrace) automatically in each lein repl. it's for lein1, though, so I don't know if that still works. http://technomancy.us/154
03:23john2xnoidi: nice, clj-stacktrace's readme has instructions for lein2 https://github.com/mmcgrana/clj-stacktrace#leiningen
03:35wei_is noir required to use the fetch library?
03:36antares_wei_: no, fetch is something client-side
03:37wei_so how do i add my remote on the server? I'm using compojure
03:38abpwei_: I just use that: https://github.com/shoreleave/shoreleave-remote-ring
03:40wei_thanks abp, looks good. this doesn't require any other part of shoreleave does it?
03:41abpwei_: shoreleave-remote for the client part.
03:41wei_right.
03:42abpwei_: Beware, the samples of shoreleave-remote-ring have wrong namespaces in the require statements, it's cemerick.shoreleave.rpc, not port79.rpc
03:56wei_it works! I'm constantly surprised at how easy it is to get things done in clojure
03:58mrhankyhi, i'm using clojure on macosx. i cant use the arrow keys to go through my inputs. i get ^[[A, ^[[B, ^[[C, ^[[D
03:58mrhankyhow can i fix that? i'm using bash as shell
03:59hiredmanmrhanky: clojure's built in repl doesn't support any kind of line editing or history
03:59mrhankyhm
03:59wei_are you using leiningen?
03:59hiredmanyou can use an external program like rlwrap or something like jline
04:00mrhankyi'm totally new to clojure, just downloaded it. my professor told me that arrow keys are working, but he's on windows
04:01hldfrhmm is it true that any data structure that implements first, cons, rest, on that any of clojure sequence library functions can be applied ?
04:02mrhankyanother guy on osx has the same issue with the arrow keys
04:03hiredmanmrhanky: most likely because the windows terminal is providing line editing
04:03hldfralso, are all clojure sequence lib functions defined in terms of first, cons, rest or another seq lib function ?
04:04wei_mrhanky: try following the directions here: http://clojure-doc.org/articles/tutorials/getting_started.html
04:05wei_it'll give you a better repl, with working arrow keys. though, my clojurescript repl isn't so nice..
04:05abpwei_: What do you use for cljs?
04:06wei_lein cljsbuild
04:06wei_for the repl, lein trampoline cljsbuild repl-listen
04:08abpwei_: Ah ok, do you know how to switch into my apps namespace in the cljs-repl?
04:09abpwei_: Do I have to load-namespace?
04:09wei_i just use (ns my-app.namespace)
04:10wei_the namespace gets loaded when you refresh the page
04:14abpwei_: Everytime I use something that's required in my file, the cljs repl hangs
04:16wei_me too- it's waiting for the page to connect. do you have a subsequent (repl/connect ("localhost:9000/repl"))? if so, the repl should unhang when you refresh the page.
04:17abpwei_: Yes, everytime the page is ready
04:17abpwei_: Will experiment a little more then, thanks.
04:27Kototamahi, any ideas what is the problem with 'lein autodoc' http://paste2.org/p/2353617 ?
04:28mpenetKototama: you are on windows?
04:28hyPiRionKototama: What operative system are you using?
04:33hyPiRionRegardless, it seems like autodoc isn't built for Leiningen 2.0
04:34Kototamai'm using linux ubuntu 12.04
04:35hyPiRionAnd you're using leiningen 2 or 1? (check by doing 'lein version')
04:35Kototamalein 2
04:37Kototamai'll try the JAR with the command line
04:37hyPiRionYeah, that seems to be the issue: https://github.com/tomfaulhaber/lein-autodoc/blob/master/src/leiningen/autodoc.clj#L4
04:38hyPiRionAutodoc is built for 1.x only (as of right now)- though it would be easy to fix that.
04:46Kototamastrange I got a lot of file not found exception
04:48Kototamamaybe i'll just use the codox plugin instead
04:50hyPiRionKototama: Seems like a solution for now, unless you're depending on autodoc.
04:51hyPiRionStrange that it's not updated though.
04:58wei_has anyone gotten the extensible reader to work between clj and cljs? I'm trying to serialize mongo ObjectIds.
05:05Kototamaoh yeah... now I have a super error with lein ring uberwar http://paste2.org/p/2353714
05:38Kototamaah... solved. It seems one of the plugin needed a version of clojure > 1.4.0
05:38Kototamait's always complicated this uberwar builds :-s
07:47edv-clear
07:47edvargh
07:50jballancwhat? where'd all my backlog go?
07:50jballanc;-)
08:32bordatouehello could anyone please tell me how to use search with lein
08:46gkovoors
09:03bordatoue`hello could anyone help me with lein command
09:05jsabeaudrybordatoue`, pose ta question
09:05antares_jsabeaudry: already answered in #leiningen
09:05bordatoue`jsabeaudry: i had an issue with lein search command , using lein version 2
09:06jsabeaudryantares_, great! I really need to add some timestamps here
09:07bordatoue`jsabeaudry: antares did answer my question from #leiningen
10:24supertramphi
10:24supertrampguys - how to trace function exection?
10:24supertrampis there something better than tools.trace?
10:26stuartsierrasupertramp: try a JVM profiler/debugger
10:26duck11231You could use Lamina's probe channels. https://github.com/ztellman/lamina/wiki/Probes-and-Instrumentation
10:29supertrampthanks - but I'm looking for some kind of tree-like structure where actual argument expansion & eval could be seen
10:30TimMcYOu want a stepping debugger.
10:32oichdoes this not work because it has "get" in the method name: (Integer
10:32oich(Integer/getInteger "3")
10:34TimMcNo, Clojure doesn't do bean-y stuff.
10:35TimMcoich: It's just that Integer/getInteger is not what you think it is.
10:35sunkencityrylehHow can I print out what kind of variable a variable is?
10:35TimMcsunkencityryleh: class ?
10:35oichI think it returns Integer, like in java. (Integer/parseInt "3") works.
10:35TimMcsunkencityryleh: And you probably mean a value, not a variable.
10:36TimMcoich: No, go look at the docs.
10:36sunkencityrylehTimMc: ah! thanks.
10:36TimMcoich: http://docs.oracle.com/javase/6/docs/api/java/lang/Integer.html#getInteger%28java.lang.String%29
10:37oichah.... I'm an idiot... ok
10:37TimMcNo, it's just a really, really weird thing to have in the Integer class.
10:37supertrampTimMc: probably yes - what do you use?
10:37TimMcsupertramp: I don't. There's CDT, for Emacs... but I haven't gotten around to learning how to use it.
10:38supertrampTimMc: so how you do debug?
10:38TimMcprintln :-P
10:38supertrampah :)
10:39stuartsierralogging
10:39stuartsierraBreaking apart fns and testing them at the REPL.
10:40duck1123I'm a big fan of clojure.tools.logging/spy for debugging
10:40TimMcYou can also drop in a spy macro that prints whatever it is wrapped around.
10:43supertrampthere is dotrace but I'm not sure how to use it yet .. :}
10:43supertrampin tools.trace
10:48supertrampI'm getting always: IllegalStateException Can't dynamically bind non-dynamic var: user/foo clojure.lang.Var.pushThreadBindings (Var.java:353)
10:49ToBeReplacedfor those who use enlive... do you usually keep your templates in src? i thought i'd put them in resources/public, but then i'd have to do some sorcery to always change the path in deftemplate
10:49tbaldridgesupertramp: example code?
10:50supertramptbaldridge: any that uses old clojure.contrib package I think
10:50TimMcsupertramp: Declare the var with :dynamic
10:50TimMcOh, there's your problem.
10:50TimMc~contrib
10:50clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
10:51TimMc...and more importantly, monolithic contrib stopped being maintained at 1.2.
10:51supertrampTimMc: I'm using new one :) but there is dotrace behaving differently I think ..
10:52supertramptbaldridge: for example this one: http://forum.pclayer.com/post39501.html
10:53supertrampif I use (use 'clojure.tools.trace) instead I got that exception
10:53AWizzArdDo we have a CCW user here? A friend just downloaded the newest Eclipse and newest version of CCW and wants to use a Leiningen project. We noticed that compiled classes go into the project root, into a folder classes/, but not into target/classes/. Could any CCW user try to verify this?
10:53TimMcsupertramp: What does *clojure-version* tell you?
10:53supertramp1.4.0
10:54supertrampwith org.clojure/tools.trace "0.7.3"
10:55TimMcOK, maybe trace is trying to bind your fn.
10:56TimMcTry putting ^:dynamic in front of your fn's name, after "defn".
10:57supertrampTimMc: great - works! :) what's the magic? :)
10:58TimMcsupertramp: Clojure 1.3 introduced a constraint on vars that to use dynamic binding on one, it needs to be declared as such.
10:58TimMcdotrace is trying to dynamically bind your fn
10:59wkelly1
10:59TimMcsupertramp: Do this in your terminal: (macroexpand-1 '(dotrace [foo] (foo 1)))
10:59wkellysorry!
11:00supertrampthanks TimMc! :)
11:24frozenlockI'm looking for an installation wrapper that allows clojure jar to run at startup. There's packjacket, but it seems to crash with any clojure jar. Any other suggestions?
11:25jcromartiefrozenlock: are you trying to create a distributable package?
11:26jcromartielike, a standalone app, or what?
11:26frozenlockyeah, like that :P
11:26jcromartieis this a standalone GUI app, or a command-line tool
11:26jcromartieand what installer are you using?
11:27frozenlockI would say neither, it should run as a service/daemon.
11:27jcromartieah ha OK
11:27jcromartiefor a specific platform?
11:28TimMcYou should be able to use any JAR-accepting utility.
11:29TimMcJust make sure it's an uberjar that runs with java -jar.
11:29frozenlockWell the service part for windows is more important, as I expect linux users to be able to it themself (but of course it would be a nice addition)
11:29jcromartieOK well now it gets tricky
11:30jcromartiehow about http://wrapper.tanukisoftware.com/doc/english/introduction.html
11:30jcromartieand for simplicity, you should bundle your dependencies and Clojure source code into a standalone jar
11:30jcromartieare you using Leiningen?
11:31frozenlockyes, it's all in a uberjar like TimMc said.
11:32frozenlockThe jar works flawlessly, it's just the installation/service part that confuses me.
11:32frozenlockTrying the tanukisoftware now :)
11:32jcromartiewell the wrapper just takes a jar and a startup or handler class I'd assume
11:33jcromartiebasically, set up the main .jar, main class, and arguments
11:33jcromartieshould work
12:00supertrampis it possible to 'reset' REPL somehow?
12:01nDuffsupertramp: ...well, you can switch to a new namespace...
12:02babilenseancorfield: thanks! (for clj-1066)
12:02supertrampnDuff: well I have source file - loaded with lein - do a change to file and want to rerun it with that change from repl
12:02supertrampnDuff: is it possible?
12:03supertrampwithout quit / run repl by lein again ...
12:03nDuffsupertramp: Perhaps the :reload keyword to use is what you're looking for?
12:06supertrampcool :)
12:06supertrampthanks nDuff! :)
12:15ToBeReplaceddoes anyone know of any static code analyzers for clojure other than kibit?
12:16AWizzArdToBeReplaced: FindBugs
12:17seancorfieldbabilen: not sure why you're thanking me for that ticket but "you're welcome!" on their behalf :)
12:18babilenseancorfield: err, I meant to thank Stuart. Somehow that name was shadowed by yours. I am sure that I could thank you for other things, so ... just keep it :)
12:19babilenstuarthalloway: thanks for fixing CLJ-1066!
12:19ohpauleezToBeReplaced: There's also Eastwood, but it's unclear what it's state is, and it's not entirely "static"
12:19ohpauleezit operates at the bytecode level
12:19ohpauleezyou could also AOT a file and run it through bytecode static analyzers for the JVM
12:20ohpauleez(As suggested by AWizzArd)
12:21ToBeReplacedyea; i'll take a look a both and other jvm options. thanks
12:42Sgeoreduce always walks the entire seq except in new Clojure with reduced?
12:42Sgeo:/
12:43jcromartieyes, reduce produces a single result value
12:43Sgeo"reduce produces a single result value" does not in fact answer the question.
12:44jcromartiethe only way to reduce a seq is to walk the whole thing
12:44SgeoNot true.
12:44jcromartieno?
12:44clojurebotno is tufflax: there was a question somewhere in there, the answer
12:44gfredericksis it 1.5 that lets you short-circuit?
12:45SgeoHaskell's foldr can stop, and thus works even on infinite lists. It's possible there thanks to pervasive lazyness (or is it non-strictness)?
12:45jcromartieah, so you are just talking about reducing over a subset of the reduction
12:45jcromartiea subset of the seq
12:45Sgeojcromartie, suppose I'm reducing with some sort of short-circuiting *
12:46SgeoAnd the seq looks like [1 2 3 0 4 5 6]
12:46jcromartieso like, (reduce + [1 2 3 0 4 5 6] :whille pos?)
12:46jcromartieor something like that
12:49SgeoWhy shouldn't I be able to write something like (reduce * [1 2 3 4 5 0 6 7 8 9 10]) and have the reduce stop as soon as it can determine the answer, when it hits 0
12:49technomancySgeo: that's exactly the point of the changes in 1.5
12:49Sgeocodeeval.com seems to be stuck on 1.2 :(
13:07bosiewhat does "seq-exprs" in the docs mean?
13:08bosiee.g. http://clojuredocs.org/clojure_core/clojure.core/for
13:10TimMcbosie: You mean coll-exprs?
13:11TimMcexpressions that evaluate to collections
13:11bosieTimMc: so a body-expr is an expresion that evaluates to a body?
13:11TimMcNope.
13:13TimMcThat means the expression that forms the body of the larger form.
13:13TimMcIt's not consistent naming.
13:15pandeirois there a way to find out what version of clojurescript is running at the clojurescript repl?
13:28hyPiRion*clojure-version* ?
13:29dnolenpandeiro: there is not, that would be a useful addition
13:33pandeirodnolen: what was the thinking behind the #_=> prompt?
13:33pandeiroso code could be pasted from the repl and evaled?
13:34hyPiRioneasier copy-pasting, I assume
13:34pandeiroyeah makes sense
13:35pandeiroi had forgotten about the #_ reader macro
13:37jamiihow can I have a macro produce a dynamic var? this doesn't work - https://gist.github.com/3919505
13:41jamiiIt looks like the ^:dynamic is getting applied to the splice rather than being present in the generated code
13:44jamiiaha, it can be applied before the splice:
13:44jamii(defmacro defdyn [name]
13:44jamii `(def ~(with-meta name (assoc (meta name) :dynamic true))))
13:46hyPiRionvary-meta is probably better
13:46hyPiRion(defmacro defdyn [var] #_=> `(def ~(vary-meta var assoc :dynamic true)))
13:47hyPiRionOr more succinct, at least.
13:48jamiihyPiRion: thanks
13:51Sgeojamii, thought: You might want to have *print-meta* be true at the REPL?
13:51jamiiSgeo: I do, you can see the meta in the gist I posted
13:51SgeoOh, ok
14:14ohpauleezdnolen: http://dev.clojure.org/jira/browse/CLJS-395 - Node.js bug is elusive and seems to be an isolated case. I also have a couple of updated patches to push to Jira (with-out-str, etc)
14:20dnolenohpauleez: did you try building clojurescript from scratch to repro?
14:21ohpauleezyeah - followed his directions to repro and nothing
14:21ohpauleezlooked through the code
14:21ohpauleezthe code changed a little (removed an unnecessary if) - but nothing is reproducting
14:21ohpauleeztried JDK 1.6 and 1.7
14:21ohpauleeztried Linux and OS X
14:22dnolenohpauleez: yeah unless we get more input from him will be hard to track. that's cool about the other patches.
14:22ohpauleezdnolen: Cool - moved it to minor, I'll just keep an eye on it to see if anyone else posts to it
14:39BaldandersI'm trying to get leiningen 2.0.0-preview10 working under Windows7. I put lein.bat and the matching standalone jar in c:\lein, added that to my path, and set LEIN_JAR to that path as well. If I try to run lein anything I get the error: "Error: Could not find or load main class clojure.main" Anyone know if I did something wrong?
14:40hiredmanBaldanders: I imagine LEIN_JAR should point to the actual jar?
14:41Baldandersah, OK, that is probabl;y it then- I expected it to be a path...
14:43BaldandersIndded that seems to have done it- it is downloading jars now. Thanks.
14:45wingyis it allowed to search for partners here?
14:46wingymaking the next big thing (billion market) .. if anyone with experience in clojure (datomic) wanna participate .. give me a message
14:46technomancyheh
14:47ystaeltechnomancy: am I correct in thinking that when leiningen says "java.lang.String cannot be cast to clojure.lang.IPersistentCollection" what it means is "you spelled your project.clj or profiles.clj wrong" ?
14:48technomancyystael: likely
14:48wingyat least i am honest :)
14:52muhooystael: more likely, you have {: foo "bar"} somewhere that it wants {:foo ["bar"]}
14:52muhoohappens all the damn time
14:53muhoosorry {:foo "bar"} where it wants {:foo ["bar"]} ... grr ssh lag
14:53aperiodicwould the casting error be to ISeq in that case?
14:54muhooit wants a seq, [] or ()
14:56ystaelwait. i thought :mirrors in user profile in profiles.clj was supported now?
14:57aperiodicoh right, strings totally suport ISeq, duh
14:57muhoo,(first "foobar")
14:57clojurebot\f
14:58technomancynot technically ISeq, but an approximation thereof
14:59scriptor,(class (seq "foo"))
14:59clojurebotclojure.lang.StringSeq
15:00scriptorhmm, looks like it extends ASeq, which implements ISeq
15:00gfredericksbut the string class doesn't
15:00scriptorah, right
15:01aperiodicyeah, it's handled here: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L479
15:01muhooi remember seeing a map/chart somewhere of all the IStuff that all the clojure types support
15:01muhoolike a bit inheritance tree
15:03muhoos/bit/big/ (fucking TYPING, how does it work?)
15:04stuarthallowayI declined http://dev.clojure.org/jira/browse/CLJ-1025, if any CLJS committers want to yell at me I am here ;-)
15:05cemerickstuarthalloway: I already have a fix for cljs that makes it irrelevant: https://gist.github.com/3918764
15:05stuarthallowaycemerick: great!
15:08BaldandersHmm- when I try to run lein it goes out and starts getting jars from maven, but it hangs trying to get core.cache
15:09stuartsierraClojureScript release 0.0-1513: http://build.clojure.org/job/clojurescript-release/18/
15:12frozenlock\o/
15:12nDuffHuh -- I'm getting reflection warnings on (doto *err* (.write "foo") (.flush)). Surprised it isn't known to be java.io.Writer as the docs imply.
15:14dnolenstuartsierra: sweet
15:17BaldandersI found an issue on the leiningen page about the maven servers being very slow, but it was closed, saying that mirror support had been added. Anyone know if this is still a problem? I'm wondering if it will eventually manage to get it or if it is just completely hung.
15:27emezeskestuartsierra: Thanks!
15:48amalloy&(meta #'*err*)
15:48lazybot⇒ {:ns #<Namespace clojure.core>, :name *err*, :added "1.0", :doc "A java.io.Writer object representing standard error for print operations.\n\n Defaults to System/err, wrapped in a PrintWriter"}
15:48`fogusstuartsierra: Thanks!
15:57lynaghk`fogus: re: your question a few days ago (sorry, I was out of town and left IRC on): did you want to exclude a namespace from from a CLJX file or want to exclude an entire namespace from being shared between runtimes?
16:02rlbIs there a naming convention for macros that set up a let binding i.e. (with-thing-involving-complicated-setup thing body-using-thing)?
16:03rlbi.e. is that an unexpected (and unwanted) use of "with-"?
16:04technomancyrlb: with- is typically used for macros that take a body, yeah
16:04rlbjust didn't know if having the caller specify the binding name was something people would expect in clojure.
16:05rlbi.e. (with-foo bar (do-something bar))
16:05amalloyrlb: yes, very much expected. the opposite is usually a surprise
16:05rlbI know about (with-foo [bar ...] (do-something bar)), but that's different.
16:05amalloyit's not really necessary, but you could also require a vector there, because vectors often visually imply a new binding: (with-foo [bar] (do-something bar))
16:06rlbamalloy, technomancy: right, and thanks.
16:07ghadishayban1Can anyone in core recommend how to deal with CLJ-1082?
16:08hiredmanemacs will nicely indent bodies for forms that start with with-
16:08ghadishayban1or I can throw some ideas on clojure-dev...
16:09amalloyi'm kinda surprised subvec works on primitive vectors, even, just because they're so rarely used
16:10hiredmanseems pretty straight forward
16:10hiredmanghadishayban1: is it beyond just changing the cast to IPV?
16:10hiredmanoh, I guess IPV doesn't specify a ranged iterator
16:11ghadishayban1yeah
16:11hiredmanspit balling on clojure-dev is not a bad idea
16:12hiredmanyou could turn rangeIterator in to a rhickey special
16:12hiredmana static method with instanceof checks + an interface
16:12hiredmanmake gvecs extend the interface
16:13ghadishayban1i'll try that. thanks!
16:19ghadishayban1i wanted to fold without boxing… i might just wrap an array
16:20ghadishayban1and sling CollFold onto it
16:22hiredmanghadishayban1: ah, so in that case you need to have gvec create it's own distrinct subvecs that support folding without the iterator бизнес
16:23ghadishayban1i considered making what you're calling the rhickey special check in subvec fn itself
16:23ghadishayban1but subvec is used early in bootstrapping
16:23technomancytrying to think of examples of things that can be = but do not print the same
16:23technomancyorder in sets and maps is the only thing I can think of, but it's interesting
16:23hiredmanlists and vectors or course
16:23hiredmanof
16:23technomancyoh of course
16:23ghadishayban1yep
16:23amalloy(reify Object (equals [this other] true))
16:24technomancy~gourds
16:24clojurebotSQUEEZE HIM!
16:24technomancyamalloy: equals is broken java equality though
16:24amalloystill passes the = check
16:24technomancyhuh
16:25technomancyanyway I was thinking of function equality
16:25technomancyseems safe to consider functions equal if they differ only on the name of the parameters
16:26hiredmantechnomancy: what about closures?
16:26amalloyand have identical closures
16:26technomancyof course
16:26technomancyanyway made me realize that c.c/= is technically not egal since egal is defined in terms of operational equivalence
16:27technomancyand printing differently is a violation of operational equivalence
16:27technomancyso I think it's OK by the rules of =, but not by the rules of egal, but that's ok in practice
16:27amalloylists and vectors are a more obvious violation
16:27technomancyyeah not sure why I didn't think of that first =)
16:28amalloywell i meant, they violate it in more than just printing differently
16:28amalloy&(map (juxt pop (memoize pop)) [[1 2 3] '(1 2 3)])
16:28lazybot⇒ ([[1 2] [1 2]] [(2 3) [1 2]])
16:29technomancyhaha
16:29technomancygeez
16:33pandeiroRaynes: does tentacles have anything to deal with gists?
16:34Raynestentacles.gist
16:34Raynestentacles.gists, even
16:35pandeiroRaynes: sorry, was reading the blog post and skipped the last graph
16:35pandeirowhat i wanted to give a gist ID and get back datums
16:36Raynes(tentacles.gists/specific-gist someid)
16:36pandeirobeautiful, just found it, thanks
16:43frozenlockIs there an equivalent of this: 'content-type "application/json; charset=utf-8"', but for a clojure map instead of json?
16:43nDufffrozenlock: Not a standardized type, no.
16:43dakronefrozenlock: application/clojure
16:43nDufffrozenlock: the x-* namespace is around for more free-form usage.
16:44frozenlockExcellent, thank you very much!
16:44technomancyistr the x- prefix being deprecated
16:45nDuffHmm. I could be behind on that.
16:46stuartsierraI've started using application/x-edn
16:48xeqihttp://tools.ietf.org/html/rfc6648 : x- being deprecated
16:50frozenlockstuartsierra: edn?
16:50stuartsierrahttps://github.com/edn-format/edn
16:51hiredmanthe x stands for extendable
16:51technomancyit's like clojure but ... actually yeah just that.
16:52frozenlock:)
16:53stuartsierraIt's a subset: no fns, no regexes
16:53amalloyxeqi: it checks out: publication date is not april first. probably legit
16:53Raynesstuartsierra: What color is your hair this year?
16:53stuartsierraI haven't decided yet.
16:54RaynesMy hair is way too natural. Needs to get molested by chemicals again soon.
16:54stuarthallowaystuartsierra: you don't have much time left to change the median hair color for the year
16:54stuartsierraI think I've already passed that point.
17:00gfredericksusing OOP makes me sad :(
17:00SgeoSo, not a Smalltalk fan?
17:00Sgeo:D
17:00gfredericksruby in this case
17:01SgeoRuby is a grossified Smalltalk
17:01gfredericksyou try to program with functions and values and it's just too awkward and the language pushes you back to stateful classes
17:01duck1123I liked Ruby before I learned Clojure
17:02technomancysupposedly ruby added currying and first-class methods in 1.9, but I haven't been able to figure it out
17:02scriptorcurrying?
17:02scriptoror just partial application?
17:02technomancypartial application, but they call it currying IIRC
17:02scriptorah
17:03duck1123I realized I was ruined by Clojure when I caught myself trying to do. some_array.map(:title) in Ruby
17:04technomancyalso, I use the term "first class" loosely
17:06scriptortechnomancy: hmm, it actually seems like real currying
17:07gfredericksso tired of having four different ways to make a function
17:07gfredericksand by 'four' I probably mean 'ten'
17:09duck1123just earlier today I finished watching "Clojure is my favorite Ruby" http://youtu.be/PCdEbUBk6a0 Had that same complaint
17:10technomancygfredericks: the distinctions between which can change between patchlevels
17:10amalloyscriptor: link?
17:11technomancyor maybe that was between "bugfix" version releases; it's been a while
17:11scriptoramalloy: just skimmed through http://pragdave.blogs.pragprog.com/pragdave/2008/09/fun-with-procs.html
17:11gfrederickstechnomancy: don't make me cry
17:11gfredericksI just found out the other day that `-42` and `- 42` are semantically different expressions
17:11scriptorI'm still not positive on the difference, though, so I'm probably wrong
17:12technomancyscriptor: real currying wouldn't require having to call .curry first
17:12amalloyright. it would implicitly work on every function
17:12gfrederickstechnomancy: so you're saying that any method called 'curry' is automatically wrong? :)
17:13technomancygfredericks: unless it's in the compiler =)
17:13SgeoHaskell has a function called curry
17:13scriptordoes it have to be done implicitly?
17:13technomancyscriptor: well this is somewhere between
17:13amalloygfredericks: it could just return "http://www.haskell.org/wikiupload/8/86/HaskellBCurry.jpg&quot;
17:13SgeoIt isn't needed usually, but can be useful
17:13scriptoras far as I can tell .curry just returns a curried version, which you can then partially apply on
17:14scriptortrue
17:14technomancysince it happens implicitly once you've transformed a regular lambda into a curryable one
17:14TimMcamalloy: All hail!
17:14scriptortheoretically, the interpreter could just call .curry on all functions internally
17:15technomancyscriptor: unless there are rest args
17:15scriptorright, or splats as those people call it
17:15gfredericksalso the default args
17:16gfredericksare a problem
17:16gfredericksof similar flavor
17:16gfredericksnot to mention blocks
17:24callenhttp://lisp-univ-etc.blogspot.com/2012/10/lisp-hackers-francois-rene-fare-rideau.html I found this interesting. What I found particularly interesting was the commentary on the social issues of the Lisp community. Particularly since the last time myself or technomancy noted such issues, there was a lot of loud bluster about how we couldn't possibly make such a sweeping gesture.
17:30frozenlockIs there something like a reverse destructuring? I often find myself doing a map like so: {:arg arg :arg2 arg...}
17:30gfredericksuseful has keyed
17:31gfredericksI haven't seen it anywhere else
17:31gfredericksI've wanted it 40 times at least though
17:31gfredericksbut always just barely not enough to use useful
17:31gfredericksI take it back, I brought in useful once.
17:31frozenlockThanks, I'll take a look
17:32frozenlockBut indeed bringing a library just for that... eh..
17:32duck11232I keep telling myself that useful has things I want, but since it's not already on my classpath, i don't use it
17:33frozenlockOh why doesn't github autofocus me on the search bar I wonder...
17:34technomancyduck1123: which is why someone needs to wire up convenience functions around pomegranate and the repl
17:35aperiodicthis might not be a clojure question, but how would i go about tunneling clj-http requests through a socks proxy or whatnot?
17:35dakroneaperiodic: the docs on the github page have instructions for using a proxy
17:36aperiodicdakrone: awesome! thanks
17:38amalloyduck11232: solution: add useful to your lein-new templates?
17:38dnolencallen: that interview doesn't talk about social issues in the overall CL community at all. rather CL's lack of modularity exacerbates large scale software development according to Fare.
17:42technomancycallen: woo cybernetics
17:43TimMcSuch a small world.
17:43TimMcEspecially when you live in Boston. :-P
17:44technomancyhalf a million lines of CL... good grief.
17:50technomancycallen: holy smokes; asdf wasn't self-upgradeable until *2010*
17:50technomancymind blown
17:52scriptorso it's a dependency manager that wouldn't fetch any dependencies you didn't have?
18:06aperiodicdakrone: is there any way to proxy with SOCKS?
18:07dakroneaperiodic: I thought the existing proxy support worked with socks
18:11aperiodicdakrone: when i point it at my socks server (:proxy-host "127.0.0.1", :proxy-port 9999, the socks server is just ssh -D 9999) i get org.apache.http.NoHttpResponseException: the target server failed to respond
18:12aperiodichmm, this might be user error; i'll dig into it and get back to you
18:13dakroneaperiodic: I'll also take a look
18:22TEttingerhmm, I am looking for an animation library for swing, preferably one with idiomatic Clojure bindings
18:23TEttingerI might have to resort to Quil, despite it being an absolute mess every time I try to run a demo
18:24ebaxtI'm trying to deploy to clojars, but I'm getting "Failed to deploy artifacts/metadata: No connector available to access repository clojars-https (clojars-https) of type default using the available factories FileRepositoryConnectorFactory, WagonRepositoryConnectorFactory". Anyone know what I have to do to fix it? I'm using Leiningen 2.0.0-preview10.
18:38technomancyebaxt: do you have any plugins? it's not able to find the https connector that ships with aether for some reason.
18:40ebaxttechnomancy: I have [lein-ring "0.7.5"] if that's what you mean. Also tried lein-clojars just now, but no go.
18:42ebaxttechnomancy: ➜ .lein cat .profiles
18:42ebaxt {:user
18:42ebaxt {:dependencies {clj-stacktrace "0.2.4"}
18:42ebaxt :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
18:42ebaxt 'print-cause-trace)
18:42ebaxt new (ns-resolve (doto 'clj-stacktrace.repl require)
18:42ebaxt 'pst)]
18:42ebaxt (alter-var-root orig (constantly @new)))]
18:42ebaxt :plugins [[lein-midje "2.0.0-SNAPSHOT"]
18:42ebaxt [lein-pprint "1.1.1"]]}}%
18:42hyPiRionebaxt: use pastebin/refheap next time
18:42TimMcebaxt: Please don't paste to the channel -- use a pastebin such as refheap.com
18:42ebaxtsry
18:43technomancyebaxt: never seen that particular problem before. maybe try getting rid of all your plugins/injections and seeing if that makes it go away?
18:45ebaxttechnomancy: OK, I'll do that
18:52patchwork1Hey guys, what do we use to emit xml nowadays?
18:52patchwork1I am running into this problem with clojure.xml
18:52patchwork1http://stackoverflow.com/questions/2463129/roundtripping-xml-in-clojure-using-clojure-xml-parse-and-clojure-xml-emit?rq=1
18:52lynaghkpatchwork1: emit from what? I tend to just use Hiccup
18:53SurlyFrogAnyone familiar with clojure.java.jdbc? I'm wondering if there is a way to update a row, based on the value that is currently in that row. As in an SQL: 'UPDATE foo SET i = i + 1, j = j + 1 ….' I see `update-values`, but am not sure that it gives me back each matching row.
18:53patchwork1Well, I am parsing an xml file into whatever format clojure.xml creates, changing a value, and now I want to emit that same structure back into a string
18:59lynaghkpatchwork1: ah. not familiar with that workflow, sorry.
19:05ebaxttechnomancy: removed all my plugins, delete the entire ~./m2/repository and still no go. Tried my other machine with lein 2.0.0-preview7 but same problem. Any tips to where I should start digging?
19:06SurlyFrogNevermind my JDBC question, it gets done using `do-commands`
19:15metellusI have a function that I want to modify a map if a series of nested conditions are true and just return the map otherwise. Is there a nice way to do that?
19:16S11001001metellus: depends on the nature of your modifications and conditions
19:17technomancyebaxt: the problem is that the http connector for aether (called a wagon for whatever reason) isn't found
19:17technomancyebaxt: usually you see this when you're trying to deploy to some nonstandard repository type like S3
19:18aperiodicdakrone: it seems to me that the proxy functionality doesn't work with SOCKS (i've got a local SOCKS tunnel open that my web browser is using fine, but i get the same no response exception w/clj-http)
19:18technomancythe fact that aether would be unable to find a wagon that it bundles with itself is bizarre
19:18metellusS11001001: just an assoc-in depending on some of the values inside the map, but it's hard to do without nesting them
19:19metellusI could use if and if-let instead of when, but it gets ugly quickly when I include the same "else" at every step of the way
19:19dakroneaperiodic: okay, could you open an issue on clj-http so I don't forget to work on it?
19:20metellusright now I just wrapped the whole thing in (or ... original-map) and that works but seems weird
19:20aperiodicdakrone: sure thing!
19:21dakronethanks
19:21S11001001metellus: maybe you're looking for update-in
19:21ebaxttechnomancy: Thx, I'll see what I can figure out.
19:24Sgeometellus, -?> ?
19:24SgeoOr some monad?
19:26metellusSgeo: those does seem more like what I want, but I'd rather stick to clojure.core if I can
19:26metellusthanks though
19:31AdmiralBumbleBeemetellus: if you could describe your problem a bit more, I suspect someone would have a better solution
19:33emezeskemetellus: Along the lines of what AdmiralBumbleBee just said, a paste of the code you're not happy with would go a long ways
19:35julsonnoob question... What's a good strategy for working with a largish collection in clojure? I'm trying to keep track of counts mapped to unique strings in a hash map. I would update that map as I take things out of a queue, and it would potentially grow large over a period of time.
19:37mefistoanother nooby question - I have a seq of ints, and I'd like to split it up into a seq of seqs of ints, with each split happening after any int less than 32. sort of a modified behavior of partition-with
19:37mefisto*partition-by
19:37emezeskejulson: It seems like a regular map would be a fine choice.
19:37emezeskejulson: Unless you're talking about something bigger than available RAM, or whatever
19:39AdmiralBumbleBeemefisto: iterate and split-with?
19:39AdmiralBumbleBeethough I would think partition-by would work
19:40mefistopartition-by puts the ints less than 32 in their own seq, rather than putting them with the preceding ints
19:41AdmiralBumbleBeemefisto: could you give a before and after seq?
19:42julsonemezeske: I was just thinking that with persistent collections, I might end up filling up all the available memory if I keep updating that large map. Maybe I shouldn't worry about it yet.
19:43emezeskejulson: You know about the structural sharing in Clojure's maps?
19:43mefistoAdmiralBumbleBee: ok - before: [54 46 38 3 49 39 48 52 6 61 60 52 48 43 12] and after: [ [54 46 38 3] [49 39 48 52 6] [61 60 52 48 43 12] ]
19:43technomancywhether you fill up available memory doesn't really depend on whether the map is immutable or not
19:44julsonemezeske: ohh damn! I've read about that! yeah. my bad.
19:46julsonI completely forgot about the structural sharing aspect of it. Gotta read up on it again. =D thanks!
19:47emezeskejulson: HTH
19:56amalloymefisto: (useful.seq/partition-between (fn [[before after]] (< before 32)) coll)
19:57mefistoamalloy: thanks!
19:57amalloyyou need useful, of course
19:58mefistonaturally
20:06ForSparePartsCould anybody help me debug? Very short: http://pastebin.com/Ds4s71jf
20:06ForSparePartsI don't understand the error message, and it doesn't make it very clear where my error is. I'm assuming I'm overlooking something really dumb?
20:07tmciverForSpareParts: you need parens around newtimer
20:07amalloyand args to the macro
20:07ForSparePartsThanks!
20:11XPheriorIs it possible to get access to the project map at run time with Leiningen?
20:12technomancyXPherior: sort of, but leiningen isn't designed to be used that way
20:12technomancywhat are you really trying to do?
20:12XPheriortechnomancy: That's the idea I got from the mailing list.
20:12XPheriorOkay, here it is.
20:12XPheriorI have a function that can take options. But defining those options everytime can be a pain. So I figured, it should be available as a configuration option.
20:13XPheriorBut using an entirely different file for the config might annoy people using the library
20:13XPheriorSo, project.clj seemed like a nice place to set configuration information.
20:14technomancyif you're not the end consumer you definitely shouldn't be reading project.clj
20:14technomancybecause then it will never work in an uberjar
20:14XPheriorAh, that's true..
20:14XPheriorI guess a separate config file is the way to go then. Where does one put such a file? resources/?
20:15technomancyyeah, typically
20:15XPheriorI suppose that will work.
20:15technomancyif you want to get fancy you could offer a choice between reading off the classpath vs having an init function to accept config values at boot
20:15XPheriorSo are you pretty much a one man operation at Heroku?
20:16technomancyless than that really
20:16technomancythe clojure support for heroku is really simple; it's not nearly enough to keep me busy
20:16XPheriorThat's too bad. What do you fill your free time with?
20:16technomancynah, it's better than having it be crazy complicated =)
20:16technomancyright now I'm working on the build pipeline
20:17XPheriorThat sounds like fun.
20:17XPheriorLooking everywhere for Clojure jobs. Hard to come by.
20:17XPheriorAbout to give up, probably.
20:17technomancyeasier if you can do remote, but yeah still hard to come by
20:18XPheriorI thought about that. Remote would be so freakin' boring.
20:18technomancydepends where you live I guess
20:18technomancyworks really well here
20:18XPheriorYou're in CA?
20:18technomancyno, seattle
20:19XPheriorI'm in upstate NY.
20:19XPheriorI hear Seattle's great.
20:19technomancyplenty of geek stuff still going on even though I don't see co-workers very often
20:19technomancyit is =)
20:19XPheriorI'll give you a buzz if you want to get coffee and talk nerd stuff. I might be up that way in the spring.
20:19technomancysure
20:20XPheriorPlenty of Rails jobs, at any rate.
20:20XPheriorThere's this place in NYC that does OCaml. I wonder what that's like, hah.
20:21technomancyprobably pretty intense if it's high-frequency trading
20:21XPheriorJane Street, yep.
20:24XPheriorPerhaps in 5 years it'll be easier.
20:24technomancythe build pipeline I'm on is all short-lived process management stuff; something the JVM is rubbish at
20:24technomancywould love to use ocaml here
20:25XPheriorToo late to switch?
20:25hiredmanhttp://ocamlunix.forge.ocamlcore.org/
20:26XPheriorInteresting, hiredman.
20:26technomancyXPherior: yeah, plus I'm the only one who likes it
20:26XPheriortechnomancy: That doesn't surprise me. I wonder if FP'ers will someday not be the minority.
20:30XPheriorAn init-function at boot time.. What does that even look like?
20:34technomancyXPherior: or better would be to just take it as an optional argument across all functions that consume it
20:35XPheriorI would, but it's a macro that takes & body :(
20:35technomancymacros shouldn't have any actual functionality beyond syntax
20:36XPheriorIt's not a matter of functional. It's that you can't have variadic and optional arguments, AFAIK
20:36XPheriorFunctionality, rather
20:38technomancytrue
20:38technomancyif you can't avoid rest args then you might have to make dynamic binding the only way to override classpath-based config
20:39XPheriorHm, yeah
20:39XPheriorThanks for the suggestions
20:40XPheriorMaybe I'll look into making it a plugin and use it with guzheng
20:40XPheriorEh, who knows
22:06shachafI heard y'all're "lens h8rs".
22:06shachafSgeo: Is that true?
22:09shachafLenses are the future, so I hear.
22:17Kolemanif you have a function with a third argument that has a default value is it possible to use the threading macro to insert the second argument?
22:25SgeoThe threading macros operate on forms, not functions
22:26Sgeo,(letfn [(f ([a b] (f a b 3)) ([a b c] (+ a b c)))] (->> 10 (f 1))
22:26clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
22:26Sgeo,(letfn [(f ([a b] (f a b 3)) ([a b c] (+ a b c)))] (->> 10 (f 1)))
22:26clojurebot14
22:35KolemanSgeo: I'm following along with the noir-blog sample adapting it to use monger and I want to pass true to indicate whether to perform an upsert or a regular update. See Gist here: https://gist.github.com/3921746
22:37SgeoThat -> will expand into something approximately like
22:37Sgeo(repo/upsert user :users)
22:38Sgeo,(macroexpand-1 '(-> user (repo/upsert :users) )))
22:38clojurebot(repo/upsert user :users)
22:39KolemanThinking about it now I can just bind variable for user and pass everything in directly instead of messing around with ->
22:40KolemanI actually screwed up that gist but basically there is supposed to be a function that encrypts the password in that -> call