#clojure log - Oct 19 2012

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

0:00 TimMc: Scroll to the bottom for the finished product.

0:02 technomancy: callen: sounds like clojurebot needs a new factoid

0:16 TimMc: clojurebot: rest is also easy to write without alphanumerics: https://www.refheap.com/paste/5980

0:16 clojurebot: Alles klar

0:20 TimMc: gfredericks: ##(#({} %& :constant) :whatever) is my new favorite #'constantly

0:20 lazybot: ⇒ :constant

0:22 technomancy: fewer chars!

1:31 hyPiRion: TimMc: Madman.

1:31 Well, it's not that long though.

1:59 john2x: how do I turn (map str seq) to use `->` syntax? (-> seq (map str)) is wrong..

2:00 ivan: ,(-> seq (map str))

2:00 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$str>

2:00 ivan: ,(->> seq (map str))

2:00 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$seq>

2:01 ivan: ,(->> '(1 2 3) (map str))

2:01 clojurebot: ("1" "2" "3")

2:04 antares_: john2x: -> places values as the first argument. You need ->> (places arguments to the end)

2:04 john2x: I doubt (map str seq) really needs to use ->>, though, it is best readable as is

2:05 john2x: antares_: thanks. yeah, i guess I'll do my chaining elsewhere

2:27 shriphani: hello 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])

2:27 java.lang.Exception: Unable to resolve symbol: defrecord in this context (NO_SOURCE_FILE:43)

2:29 noidi: what version of clojure are you using?

2:29 shriphani: how do i check ?

2:29 Clojure 1.1.0

2:29 too old ?

2:29 noidi: okay, that's *ancient* :)

2:30 it's from time before records and protocols

2:30 shriphani: oh wow.

2:30 noidi: I suggest you start by downloading leiningen (it's a bit like Maven for Clojure, but not nearly as scary) https://github.com/technomancy/leiningen

2:31 (or Rubygems or PIP or whatever)

2:31 shriphani: i just got clojure off brew (I'm on os x).

2:32 and i can defrecord now.

2:32 noidi: ok, cool :)

2:33 john2x: how do I convert a string to a regex? something like (str #"" "blah" "$") => #"blah$"

2:33 noidi: in 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

2:34 john2x, http://clojuredocs.org/clojure_core/clojure.core/re-pattern

2:34 john2x: noidi: oh missed that. thanks

2:50 is there a way to reload all libs loaded in the current REPL?

2:52 Iceland_jack: a

2:53 arrdem: is there a good way to build one value between several macro invocations?

2:54 I'm wishing for a way to write a macro wich will expand into a (def), and also insert an entry into a map.

3:00 ChongLi: arrdem: yeah, wrap it in a do block

3:00 errr, I misread

3:04 noidi: john2x, I haven't tried it, but clojure.tools.namespace seems to do that https://github.com/clojure/tools.namespace

3:04 apparently all you need is (use '[clojure.tools.namespace.repl :only (refresh)]) (refresh)

3:09 john2x: cool. 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.

3:16 noidi: john2x, check out leiningen's profiles https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md

3:17 add a :user profile in ~/.lein/profiles.clj which adds tools.namespace as a dependency

3:18 and it'll be available in all your projects

3:20 abp: john2x: 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.

3:20 noidi: this 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

3:23 john2x: noidi: nice, clj-stacktrace's readme has instructions for lein2 https://github.com/mmcgrana/clj-stacktrace#leiningen

3:35 wei_: is noir required to use the fetch library?

3:36 antares_: wei_: no, fetch is something client-side

3:37 wei_: so how do i add my remote on the server? I'm using compojure

3:38 abp: wei_: I just use that: https://github.com/shoreleave/shoreleave-remote-ring

3:40 wei_: thanks abp, looks good. this doesn't require any other part of shoreleave does it?

3:41 abp: wei_: shoreleave-remote for the client part.

3:41 wei_: right.

3:42 abp: wei_: Beware, the samples of shoreleave-remote-ring have wrong namespaces in the require statements, it's cemerick.shoreleave.rpc, not port79.rpc

3:56 wei_: it works! I'm constantly surprised at how easy it is to get things done in clojure

3:58 mrhanky: hi, i'm using clojure on macosx. i cant use the arrow keys to go through my inputs. i get ^[[A, ^[[B, ^[[C, ^[[D

3:58 how can i fix that? i'm using bash as shell

3:59 hiredman: mrhanky: clojure's built in repl doesn't support any kind of line editing or history

3:59 mrhanky: hm

3:59 wei_: are you using leiningen?

3:59 hiredman: you can use an external program like rlwrap or something like jline

4:00 mrhanky: i'm totally new to clojure, just downloaded it. my professor told me that arrow keys are working, but he's on windows

4:01 hldfr: hmm is it true that any data structure that implements first, cons, rest, on that any of clojure sequence library functions can be applied ?

4:02 mrhanky: another guy on osx has the same issue with the arrow keys

4:03 hiredman: mrhanky: most likely because the windows terminal is providing line editing

4:03 hldfr: also, are all clojure sequence lib functions defined in terms of first, cons, rest or another seq lib function ?

4:04 wei_: mrhanky: try following the directions here: http://clojure-doc.org/articles/tutorials/getting_started.html

4:05 it'll give you a better repl, with working arrow keys. though, my clojurescript repl isn't so nice..

4:05 abp: wei_: What do you use for cljs?

4:06 wei_: lein cljsbuild

4:06 for the repl, lein trampoline cljsbuild repl-listen

4:08 abp: wei_: Ah ok, do you know how to switch into my apps namespace in the cljs-repl?

4:09 wei_: Do I have to load-namespace?

4:09 wei_: i just use (ns my-app.namespace)

4:10 the namespace gets loaded when you refresh the page

4:14 abp: wei_: Everytime I use something that's required in my file, the cljs repl hangs

4:16 wei_: 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.

4:17 abp: wei_: Yes, everytime the page is ready

4:17 wei_: Will experiment a little more then, thanks.

4:27 Kototama: hi, any ideas what is the problem with 'lein autodoc' http://paste2.org/p/2353617 ?

4:28 mpenet: Kototama: you are on windows?

4:28 hyPiRion: Kototama: What operative system are you using?

4:33 Regardless, it seems like autodoc isn't built for Leiningen 2.0

4:34 Kototama: i'm using linux ubuntu 12.04

4:35 hyPiRion: And you're using leiningen 2 or 1? (check by doing 'lein version')

4:35 Kototama: lein 2

4:37 i'll try the JAR with the command line

4:37 hyPiRion: Yeah, that seems to be the issue: https://github.com/tomfaulhaber/lein-autodoc/blob/master/src/leiningen/autodoc.clj#L4

4:38 Autodoc is built for 1.x only (as of right now)- though it would be easy to fix that.

4:46 Kototama: strange I got a lot of file not found exception

4:48 maybe i'll just use the codox plugin instead

4:50 hyPiRion: Kototama: Seems like a solution for now, unless you're depending on autodoc.

4:51 Strange that it's not updated though.

4:58 wei_: has anyone gotten the extensible reader to work between clj and cljs? I'm trying to serialize mongo ObjectIds.

5:05 Kototama: oh yeah... now I have a super error with lein ring uberwar http://paste2.org/p/2353714

5:38 ah... solved. It seems one of the plugin needed a version of clojure > 1.4.0

5:38 it's always complicated this uberwar builds :-s

7:47 edv: -clear

7:47 argh

7:50 jballanc: what? where'd all my backlog go?

7:50 ;-)

8:32 bordatoue: hello could anyone please tell me how to use search with lein

8:46 gkovoor: s

9:03 bordatoue`: hello could anyone help me with lein command

9:05 jsabeaudry: bordatoue`, pose ta question

9:05 antares_: jsabeaudry: already answered in #leiningen

9:05 bordatoue`: jsabeaudry: i had an issue with lein search command , using lein version 2

9:06 jsabeaudry: antares_, great! I really need to add some timestamps here

9:07 bordatoue`: jsabeaudry: antares did answer my question from #leiningen

10:24 supertramp: hi

10:24 guys - how to trace function exection?

10:24 is there something better than tools.trace?

10:26 stuartsierra: supertramp: try a JVM profiler/debugger

10:26 duck11231: You could use Lamina's probe channels. https://github.com/ztellman/lamina/wiki/Probes-and-Instrumentation

10:29 supertramp: thanks - but I'm looking for some kind of tree-like structure where actual argument expansion & eval could be seen

10:30 TimMc: YOu want a stepping debugger.

10:32 oich: does this not work because it has "get" in the method name: (Integer

10:32 (Integer/getInteger "3")

10:34 TimMc: No, Clojure doesn't do bean-y stuff.

10:35 oich: It's just that Integer/getInteger is not what you think it is.

10:35 sunkencityryleh: How can I print out what kind of variable a variable is?

10:35 TimMc: sunkencityryleh: class ?

10:35 oich: I think it returns Integer, like in java. (Integer/parseInt "3") works.

10:35 TimMc: sunkencityryleh: And you probably mean a value, not a variable.

10:36 oich: No, go look at the docs.

10:36 sunkencityryleh: TimMc: ah! thanks.

10:36 TimMc: oich: http://docs.oracle.com/javase/6/docs/api/java/lang/Integer.html#getInteger%28java.lang.String%29

10:37 oich: ah.... I'm an idiot... ok

10:37 TimMc: No, it's just a really, really weird thing to have in the Integer class.

10:37 supertramp: TimMc: probably yes - what do you use?

10:37 TimMc: supertramp: I don't. There's CDT, for Emacs... but I haven't gotten around to learning how to use it.

10:38 supertramp: TimMc: so how you do debug?

10:38 TimMc: println :-P

10:38 supertramp: ah :)

10:39 stuartsierra: logging

10:39 Breaking apart fns and testing them at the REPL.

10:40 duck1123: I'm a big fan of clojure.tools.logging/spy for debugging

10:40 TimMc: You can also drop in a spy macro that prints whatever it is wrapped around.

10:43 supertramp: there is dotrace but I'm not sure how to use it yet .. :}

10:43 in tools.trace

10:48 I'm getting always: IllegalStateException Can't dynamically bind non-dynamic var: user/foo clojure.lang.Var.pushThreadBindings (Var.java:353)

10:49 ToBeReplaced: for 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:49 tbaldridge: supertramp: example code?

10:50 supertramp: tbaldridge: any that uses old clojure.contrib package I think

10:50 TimMc: supertramp: Declare the var with :dynamic

10:50 Oh, there's your problem.

10:50 ~contrib

10:50 clojurebot: Monolithic 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:51 TimMc: ...and more importantly, monolithic contrib stopped being maintained at 1.2.

10:51 supertramp: TimMc: I'm using new one :) but there is dotrace behaving differently I think ..

10:52 tbaldridge: for example this one: http://forum.pclayer.com/post39501.html

10:53 if I use (use 'clojure.tools.trace) instead I got that exception

10:53 AWizzArd: Do 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:53 TimMc: supertramp: What does *clojure-version* tell you?

10:53 supertramp: 1.4.0

10:54 with org.clojure/tools.trace "0.7.3"

10:55 TimMc: OK, maybe trace is trying to bind your fn.

10:56 Try putting ^:dynamic in front of your fn's name, after "defn".

10:57 supertramp: TimMc: great - works! :) what's the magic? :)

10:58 TimMc: supertramp: Clojure 1.3 introduced a constraint on vars that to use dynamic binding on one, it needs to be declared as such.

10:58 dotrace is trying to dynamically bind your fn

10:59 wkelly: 1

10:59 TimMc: supertramp: Do this in your terminal: (macroexpand-1 '(dotrace [foo] (foo 1)))

10:59 wkelly: sorry!

11:00 supertramp: thanks TimMc! :)

11:24 frozenlock: I'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:25 jcromartie: frozenlock: are you trying to create a distributable package?

11:26 like, a standalone app, or what?

11:26 frozenlock: yeah, like that :P

11:26 jcromartie: is this a standalone GUI app, or a command-line tool

11:26 and what installer are you using?

11:27 frozenlock: I would say neither, it should run as a service/daemon.

11:27 jcromartie: ah ha OK

11:27 for a specific platform?

11:28 TimMc: You should be able to use any JAR-accepting utility.

11:29 Just make sure it's an uberjar that runs with java -jar.

11:29 frozenlock: Well 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:29 jcromartie: OK well now it gets tricky

11:30 how about http://wrapper.tanukisoftware.com/doc/english/introduction.html

11:30 and for simplicity, you should bundle your dependencies and Clojure source code into a standalone jar

11:30 are you using Leiningen?

11:31 frozenlock: yes, it's all in a uberjar like TimMc said.

11:32 The jar works flawlessly, it's just the installation/service part that confuses me.

11:32 Trying the tanukisoftware now :)

11:32 jcromartie: well the wrapper just takes a jar and a startup or handler class I'd assume

11:33 basically, set up the main .jar, main class, and arguments

11:33 should work

12:00 supertramp: is it possible to 'reset' REPL somehow?

12:01 nDuff: supertramp: ...well, you can switch to a new namespace...

12:02 babilen: seancorfield: thanks! (for clj-1066)

12:02 supertramp: nDuff: well I have source file - loaded with lein - do a change to file and want to rerun it with that change from repl

12:02 nDuff: is it possible?

12:03 without quit / run repl by lein again ...

12:03 nDuff: supertramp: Perhaps the :reload keyword to use is what you're looking for?

12:06 supertramp: cool :)

12:06 thanks nDuff! :)

12:15 ToBeReplaced: does anyone know of any static code analyzers for clojure other than kibit?

12:16 AWizzArd: ToBeReplaced: FindBugs

12:17 seancorfield: babilen: not sure why you're thanking me for that ticket but "you're welcome!" on their behalf :)

12:18 babilen: seancorfield: 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:19 stuarthalloway: thanks for fixing CLJ-1066!

12:19 ohpauleez: ToBeReplaced: There's also Eastwood, but it's unclear what it's state is, and it's not entirely "static"

12:19 it operates at the bytecode level

12:19 you could also AOT a file and run it through bytecode static analyzers for the JVM

12:20 (As suggested by AWizzArd)

12:21 ToBeReplaced: yea; i'll take a look a both and other jvm options. thanks

12:42 Sgeo: reduce always walks the entire seq except in new Clojure with reduced?

12:42 :/

12:43 jcromartie: yes, reduce produces a single result value

12:43 Sgeo: "reduce produces a single result value" does not in fact answer the question.

12:44 jcromartie: the only way to reduce a seq is to walk the whole thing

12:44 Sgeo: Not true.

12:44 jcromartie: no?

12:44 clojurebot: no is tufflax: there was a question somewhere in there, the answer

12:44 gfredericks: is it 1.5 that lets you short-circuit?

12:45 Sgeo: Haskell'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:45 jcromartie: ah, so you are just talking about reducing over a subset of the reduction

12:45 a subset of the seq

12:45 * Sgeo moves the question mark into the parens

12:45 Sgeo: jcromartie, suppose I'm reducing with some sort of short-circuiting *

12:46 And the seq looks like [1 2 3 0 4 5 6]

12:46 jcromartie: so like, (reduce + [1 2 3 0 4 5 6] :whille pos?)

12:46 or something like that

12:49 Sgeo: Why 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:49 technomancy: Sgeo: that's exactly the point of the changes in 1.5

12:49 Sgeo: codeeval.com seems to be stuck on 1.2 :(

13:07 bosie: what does "seq-exprs" in the docs mean?

13:08 e.g. http://clojuredocs.org/clojure_core/clojure.core/for

13:10 TimMc: bosie: You mean coll-exprs?

13:11 expressions that evaluate to collections

13:11 bosie: TimMc: so a body-expr is an expresion that evaluates to a body?

13:11 TimMc: Nope.

13:13 That means the expression that forms the body of the larger form.

13:13 It's not consistent naming.

13:15 pandeiro: is there a way to find out what version of clojurescript is running at the clojurescript repl?

13:28 hyPiRion: *clojure-version* ?

13:29 dnolen: pandeiro: there is not, that would be a useful addition

13:33 pandeiro: dnolen: what was the thinking behind the #_=> prompt?

13:33 so code could be pasted from the repl and evaled?

13:34 hyPiRion: easier copy-pasting, I assume

13:34 pandeiro: yeah makes sense

13:35 i had forgotten about the #_ reader macro

13:37 jamii: how can I have a macro produce a dynamic var? this doesn't work - https://gist.github.com/3919505

13:41 It looks like the ^:dynamic is getting applied to the splice rather than being present in the generated code

13:44 aha, it can be applied before the splice:

13:44 (defmacro defdyn [name]

13:44 `(def ~(with-meta name (assoc (meta name) :dynamic true))))

13:46 hyPiRion: vary-meta is probably better

13:46 (defmacro defdyn [var] #_=> `(def ~(vary-meta var assoc :dynamic true)))

13:47 Or more succinct, at least.

13:48 jamii: hyPiRion: thanks

13:51 Sgeo: jamii, thought: You might want to have *print-meta* be true at the REPL?

13:51 jamii: Sgeo: I do, you can see the meta in the gist I posted

13:51 Sgeo: Oh, ok

14:14 ohpauleez: dnolen: 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:20 dnolen: ohpauleez: did you try building clojurescript from scratch to repro?

14:21 ohpauleez: yeah - followed his directions to repro and nothing

14:21 looked through the code

14:21 the code changed a little (removed an unnecessary if) - but nothing is reproducting

14:21 tried JDK 1.6 and 1.7

14:21 tried Linux and OS X

14:22 dnolen: ohpauleez: yeah unless we get more input from him will be hard to track. that's cool about the other patches.

14:22 ohpauleez: dnolen: Cool - moved it to minor, I'll just keep an eye on it to see if anyone else posts to it

14:39 Baldanders: I'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:40 hiredman: Baldanders: I imagine LEIN_JAR should point to the actual jar?

14:41 Baldanders: ah, OK, that is probabl;y it then- I expected it to be a path...

14:43 Indded that seems to have done it- it is downloading jars now. Thanks.

14:45 wingy: is it allowed to search for partners here?

14:46 making the next big thing (billion market) .. if anyone with experience in clojure (datomic) wanna participate .. give me a message

14:46 technomancy: heh

14:47 ystael: technomancy: 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:48 technomancy: ystael: likely

14:48 wingy: at least i am honest :)

14:52 muhoo: ystael: more likely, you have {: foo "bar"} somewhere that it wants {:foo ["bar"]}

14:52 happens all the damn time

14:53 sorry {:foo "bar"} where it wants {:foo ["bar"]} ... grr ssh lag

14:53 aperiodic: would the casting error be to ISeq in that case?

14:54 muhoo: it wants a seq, [] or ()

14:56 ystael: wait. i thought :mirrors in user profile in profiles.clj was supported now?

14:57 aperiodic: oh right, strings totally suport ISeq, duh

14:57 muhoo: ,(first "foobar")

14:57 clojurebot: \f

14:58 * aperiodic drinks coffee

14:58 technomancy: not technically ISeq, but an approximation thereof

14:59 scriptor: ,(class (seq "foo"))

14:59 clojurebot: clojure.lang.StringSeq

15:00 scriptor: hmm, looks like it extends ASeq, which implements ISeq

15:00 gfredericks: but the string class doesn't

15:00 scriptor: ah, right

15:01 aperiodic: yeah, it's handled here: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L479

15:01 muhoo: i remember seeing a map/chart somewhere of all the IStuff that all the clojure types support

15:01 like a bit inheritance tree

15:03 s/bit/big/ (fucking TYPING, how does it work?)

15:04 stuarthalloway: I declined http://dev.clojure.org/jira/browse/CLJ-1025, if any CLJS committers want to yell at me I am here ;-)

15:05 cemerick: stuarthalloway: I already have a fix for cljs that makes it irrelevant: https://gist.github.com/3918764

15:05 stuarthalloway: cemerick: great!

15:08 Baldanders: Hmm- when I try to run lein it goes out and starts getting jars from maven, but it hangs trying to get core.cache

15:09 stuartsierra: ClojureScript release 0.0-1513: http://build.clojure.org/job/clojurescript-release/18/

15:12 frozenlock: \o/

15:12 nDuff: Huh -- 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:14 dnolen: stuartsierra: sweet

15:17 Baldanders: I 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:27 emezeske: stuartsierra: Thanks!

15:48 amalloy: &(meta #'*err*)

15:48 lazybot: ⇒ {: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 `fogus: stuartsierra: Thanks!

15:57 lynaghk: `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:02 rlb: Is there a naming convention for macros that set up a let binding i.e. (with-thing-involving-complicated-setup thing body-using-thing)?

16:03 i.e. is that an unexpected (and unwanted) use of "with-"?

16:04 technomancy: rlb: with- is typically used for macros that take a body, yeah

16:04 rlb: just didn't know if having the caller specify the binding name was something people would expect in clojure.

16:05 i.e. (with-foo bar (do-something bar))

16:05 amalloy: rlb: yes, very much expected. the opposite is usually a surprise

16:05 rlb: I know about (with-foo [bar ...] (do-something bar)), but that's different.

16:05 amalloy: it'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:06 rlb: amalloy, technomancy: right, and thanks.

16:07 ghadishayban1: Can anyone in core recommend how to deal with CLJ-1082?

16:08 hiredman: emacs will nicely indent bodies for forms that start with with-

16:08 ghadishayban1: or I can throw some ideas on clojure-dev...

16:09 amalloy: i'm kinda surprised subvec works on primitive vectors, even, just because they're so rarely used

16:10 hiredman: seems pretty straight forward

16:10 ghadishayban1: is it beyond just changing the cast to IPV?

16:10 oh, I guess IPV doesn't specify a ranged iterator

16:11 ghadishayban1: yeah

16:11 hiredman: spit balling on clojure-dev is not a bad idea

16:12 you could turn rangeIterator in to a rhickey special

16:12 a static method with instanceof checks + an interface

16:12 make gvecs extend the interface

16:13 ghadishayban1: i'll try that. thanks!

16:19 i wanted to fold without boxing… i might just wrap an array

16:20 and sling CollFold onto it

16:22 hiredman: ghadishayban1: ah, so in that case you need to have gvec create it's own distrinct subvecs that support folding without the iterator бизнес

16:23 ghadishayban1: i considered making what you're calling the rhickey special check in subvec fn itself

16:23 but subvec is used early in bootstrapping

16:23 technomancy: trying to think of examples of things that can be = but do not print the same

16:23 order in sets and maps is the only thing I can think of, but it's interesting

16:23 hiredman: lists and vectors or course

16:23 of

16:23 technomancy: oh of course

16:23 ghadishayban1: yep

16:23 amalloy: (reify Object (equals [this other] true))

16:24 technomancy: ~gourds

16:24 clojurebot: SQUEEZE HIM!

16:24 technomancy: amalloy: equals is broken java equality though

16:24 amalloy: still passes the = check

16:24 technomancy: huh

16:25 anyway I was thinking of function equality

16:25 seems safe to consider functions equal if they differ only on the name of the parameters

16:26 hiredman: technomancy: what about closures?

16:26 amalloy: and have identical closures

16:26 technomancy: of course

16:26 anyway made me realize that c.c/= is technically not egal since egal is defined in terms of operational equivalence

16:27 and printing differently is a violation of operational equivalence

16:27 so I think it's OK by the rules of =, but not by the rules of egal, but that's ok in practice

16:27 amalloy: lists and vectors are a more obvious violation

16:27 technomancy: yeah not sure why I didn't think of that first =)

16:28 amalloy: well i meant, they violate it in more than just printing differently

16:28 &(map (juxt pop (memoize pop)) [[1 2 3] '(1 2 3)])

16:28 lazybot: ⇒ ([[1 2] [1 2]] [(2 3) [1 2]])

16:28 * technomancy implements egal for purists

16:29 technomancy: haha

16:29 geez

16:33 pandeiro: Raynes: does tentacles have anything to deal with gists?

16:34 Raynes: tentacles.gist

16:34 tentacles.gists, even

16:35 pandeiro: Raynes: sorry, was reading the blog post and skipped the last graph

16:35 what i wanted to give a gist ID and get back datums

16:36 Raynes: (tentacles.gists/specific-gist someid)

16:36 pandeiro: beautiful, just found it, thanks

16:43 frozenlock: Is there an equivalent of this: 'content-type "application/json; charset=utf-8"', but for a clojure map instead of json?

16:43 nDuff: frozenlock: Not a standardized type, no.

16:43 dakrone: frozenlock: application/clojure

16:43 nDuff: frozenlock: the x-* namespace is around for more free-form usage.

16:44 * nDuff would make it x-application/clojure, to avoid claiming to be standardized

16:44 frozenlock: Excellent, thank you very much!

16:44 technomancy: istr the x- prefix being deprecated

16:45 nDuff: Hmm. I could be behind on that.

16:46 stuartsierra: I've started using application/x-edn

16:48 xeqi: http://tools.ietf.org/html/rfc6648 : x- being deprecated

16:50 frozenlock: stuartsierra: edn?

16:50 stuartsierra: https://github.com/edn-format/edn

16:51 hiredman: the x stands for extendable

16:51 technomancy: it's like clojure but ... actually yeah just that.

16:52 frozenlock: :)

16:53 stuartsierra: It's a subset: no fns, no regexes

16:53 amalloy: xeqi: it checks out: publication date is not april first. probably legit

16:53 Raynes: stuartsierra: What color is your hair this year?

16:53 stuartsierra: I haven't decided yet.

16:54 Raynes: My hair is way too natural. Needs to get molested by chemicals again soon.

16:54 stuarthalloway: stuartsierra: you don't have much time left to change the median hair color for the year

16:54 stuartsierra: I think I've already passed that point.

17:00 gfredericks: using OOP makes me sad :(

17:00 Sgeo: So, not a Smalltalk fan?

17:00 :D

17:00 gfredericks: ruby in this case

17:01 Sgeo: Ruby is a grossified Smalltalk

17:01 gfredericks: you try to program with functions and values and it's just too awkward and the language pushes you back to stateful classes

17:01 duck1123: I liked Ruby before I learned Clojure

17:02 technomancy: supposedly ruby added currying and first-class methods in 1.9, but I haven't been able to figure it out

17:02 scriptor: currying?

17:02 or just partial application?

17:02 technomancy: partial application, but they call it currying IIRC

17:02 scriptor: ah

17:03 duck1123: I realized I was ruined by Clojure when I caught myself trying to do. some_array.map(:title) in Ruby

17:04 technomancy: also, I use the term "first class" loosely

17:06 scriptor: technomancy: hmm, it actually seems like real currying

17:07 gfredericks: so tired of having four different ways to make a function

17:07 and by 'four' I probably mean 'ten'

17:09 duck1123: just earlier today I finished watching "Clojure is my favorite Ruby" http://youtu.be/PCdEbUBk6a0 Had that same complaint

17:10 technomancy: gfredericks: the distinctions between which can change between patchlevels

17:10 amalloy: scriptor: link?

17:11 technomancy: or maybe that was between "bugfix" version releases; it's been a while

17:11 scriptor: amalloy: just skimmed through http://pragdave.blogs.pragprog.com/pragdave/2008/09/fun-with-procs.html

17:11 gfredericks: technomancy: don't make me cry

17:11 I just found out the other day that `-42` and `- 42` are semantically different expressions

17:11 scriptor: I'm still not positive on the difference, though, so I'm probably wrong

17:12 technomancy: scriptor: real currying wouldn't require having to call .curry first

17:12 amalloy: right. it would implicitly work on every function

17:12 gfredericks: technomancy: so you're saying that any method called 'curry' is automatically wrong? :)

17:13 technomancy: gfredericks: unless it's in the compiler =)

17:13 Sgeo: Haskell has a function called curry

17:13 scriptor: does it have to be done implicitly?

17:13 technomancy: scriptor: well this is somewhere between

17:13 amalloy: gfredericks: it could just return "http://www.haskell.org/wikiupload/8/86/HaskellBCurry.jpg"

17:13 Sgeo: It isn't needed usually, but can be useful

17:13 scriptor: as far as I can tell .curry just returns a curried version, which you can then partially apply on

17:14 true

17:14 technomancy: since it happens implicitly once you've transformed a regular lambda into a curryable one

17:14 TimMc: amalloy: All hail!

17:14 scriptor: theoretically, the interpreter could just call .curry on all functions internally

17:15 technomancy: scriptor: unless there are rest args

17:15 scriptor: right, or splats as those people call it

17:15 gfredericks: also the default args

17:16 are a problem

17:16 of similar flavor

17:16 not to mention blocks

17:16 * gfredericks throws up a little

17:24 callen: http://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:30 frozenlock: Is there something like a reverse destructuring? I often find myself doing a map like so: {:arg arg :arg2 arg...}

17:30 gfredericks: useful has keyed

17:31 I haven't seen it anywhere else

17:31 I've wanted it 40 times at least though

17:31 but always just barely not enough to use useful

17:31 I take it back, I brought in useful once.

17:31 frozenlock: Thanks, I'll take a look

17:32 But indeed bringing a library just for that... eh..

17:32 duck11232: I keep telling myself that useful has things I want, but since it's not already on my classpath, i don't use it

17:33 frozenlock: Oh why doesn't github autofocus me on the search bar I wonder...

17:34 technomancy: duck1123: which is why someone needs to wire up convenience functions around pomegranate and the repl

17:35 aperiodic: this might not be a clojure question, but how would i go about tunneling clj-http requests through a socks proxy or whatnot?

17:35 dakrone: aperiodic: the docs on the github page have instructions for using a proxy

17:36 aperiodic: dakrone: awesome! thanks

17:38 amalloy: duck11232: solution: add useful to your lein-new templates?

17:38 dnolen: callen: 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:42 technomancy: callen: woo cybernetics

17:43 TimMc: Such a small world.

17:43 Especially when you live in Boston. :-P

17:44 technomancy: half a million lines of CL... good grief.

17:50 callen: holy smokes; asdf wasn't self-upgradeable until *2010*

17:50 mind blown

17:52 scriptor: so it's a dependency manager that wouldn't fetch any dependencies you didn't have?

18:06 aperiodic: dakrone: is there any way to proxy with SOCKS?

18:07 dakrone: aperiodic: I thought the existing proxy support worked with socks

18:11 aperiodic: dakrone: 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:12 hmm, this might be user error; i'll dig into it and get back to you

18:13 dakrone: aperiodic: I'll also take a look

18:22 TEttinger: hmm, I am looking for an animation library for swing, preferably one with idiomatic Clojure bindings

18:23 I might have to resort to Quil, despite it being an absolute mess every time I try to run a demo

18:24 ebaxt: I'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:38 technomancy: ebaxt: do you have any plugins? it's not able to find the https connector that ships with aether for some reason.

18:40 ebaxt: technomancy: I have [lein-ring "0.7.5"] if that's what you mean. Also tried lein-clojars just now, but no go.

18:42 technomancy: ➜ .lein cat .profiles

18:42 {:user

18:42 {:dependencies {clj-stacktrace "0.2.4"}

18:42 :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)

18:42 'print-cause-trace)

18:42 new (ns-resolve (doto 'clj-stacktrace.repl require)

18:42 'pst)]

18:42 (alter-var-root orig (constantly @new)))]

18:42 :plugins [[lein-midje "2.0.0-SNAPSHOT"]

18:42 [lein-pprint "1.1.1"]]}}%

18:42 hyPiRion: ebaxt: use pastebin/refheap next time

18:42 TimMc: ebaxt: Please don't paste to the channel -- use a pastebin such as refheap.com

18:42 ebaxt: sry

18:43 technomancy: ebaxt: never seen that particular problem before. maybe try getting rid of all your plugins/injections and seeing if that makes it go away?

18:45 ebaxt: technomancy: OK, I'll do that

18:52 patchwork1: Hey guys, what do we use to emit xml nowadays?

18:52 I am running into this problem with clojure.xml

18:52 http://stackoverflow.com/questions/2463129/roundtripping-xml-in-clojure-using-clojure-xml-parse-and-clojure-xml-emit?rq=1

18:52 lynaghk: patchwork1: emit from what? I tend to just use Hiccup

18:53 SurlyFrog: Anyone 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:53 patchwork1: Well, 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:59 lynaghk: patchwork1: ah. not familiar with that workflow, sorry.

19:05 ebaxt: technomancy: 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:06 SurlyFrog: Nevermind my JDBC question, it gets done using `do-commands`

19:15 metellus: I 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:16 S11001001: metellus: depends on the nature of your modifications and conditions

19:17 technomancy: ebaxt: the problem is that the http connector for aether (called a wagon for whatever reason) isn't found

19:17 ebaxt: usually you see this when you're trying to deploy to some nonstandard repository type like S3

19:18 aperiodic: dakrone: 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:18 technomancy: the fact that aether would be unable to find a wagon that it bundles with itself is bizarre

19:18 metellus: S11001001: just an assoc-in depending on some of the values inside the map, but it's hard to do without nesting them

19:19 I 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:19 dakrone: aperiodic: okay, could you open an issue on clj-http so I don't forget to work on it?

19:20 metellus: right now I just wrapped the whole thing in (or ... original-map) and that works but seems weird

19:20 aperiodic: dakrone: sure thing!

19:21 dakrone: thanks

19:21 S11001001: metellus: maybe you're looking for update-in

19:21 ebaxt: technomancy: Thx, I'll see what I can figure out.

19:24 Sgeo: metellus, -?> ?

19:24 Or some monad?

19:26 metellus: Sgeo: those does seem more like what I want, but I'd rather stick to clojure.core if I can

19:26 thanks though

19:31 AdmiralBumbleBee: metellus: if you could describe your problem a bit more, I suspect someone would have a better solution

19:33 emezeske: metellus: Along the lines of what AdmiralBumbleBee just said, a paste of the code you're not happy with would go a long ways

19:35 julson: noob 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:37 mefisto: another 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:37 *partition-by

19:37 emezeske: julson: It seems like a regular map would be a fine choice.

19:37 julson: Unless you're talking about something bigger than available RAM, or whatever

19:39 AdmiralBumbleBee: mefisto: iterate and split-with?

19:39 though I would think partition-by would work

19:40 mefisto: partition-by puts the ints less than 32 in their own seq, rather than putting them with the preceding ints

19:41 AdmiralBumbleBee: mefisto: could you give a before and after seq?

19:42 julson: emezeske: 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:43 emezeske: julson: You know about the structural sharing in Clojure's maps?

19:43 mefisto: AdmiralBumbleBee: 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:43 technomancy: whether you fill up available memory doesn't really depend on whether the map is immutable or not

19:44 julson: emezeske: ohh damn! I've read about that! yeah. my bad.

19:46 I completely forgot about the structural sharing aspect of it. Gotta read up on it again. =D thanks!

19:47 emezeske: julson: HTH

19:56 amalloy: mefisto: (useful.seq/partition-between (fn [[before after]] (< before 32)) coll)

19:57 mefisto: amalloy: thanks!

19:57 amalloy: you need useful, of course

19:58 mefisto: naturally

20:06 ForSpareParts: Could anybody help me debug? Very short: http://pastebin.com/Ds4s71jf

20:06 I 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:07 tmciver: ForSpareParts: you need parens around newtimer

20:07 amalloy: and args to the macro

20:07 ForSpareParts: Thanks!

20:11 XPherior: Is it possible to get access to the project map at run time with Leiningen?

20:12 technomancy: XPherior: sort of, but leiningen isn't designed to be used that way

20:12 what are you really trying to do?

20:12 XPherior: technomancy: That's the idea I got from the mailing list.

20:12 Okay, here it is.

20:12 I 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:13 But using an entirely different file for the config might annoy people using the library

20:13 So, project.clj seemed like a nice place to set configuration information.

20:14 technomancy: if you're not the end consumer you definitely shouldn't be reading project.clj

20:14 because then it will never work in an uberjar

20:14 XPherior: Ah, that's true..

20:14 I guess a separate config file is the way to go then. Where does one put such a file? resources/?

20:15 technomancy: yeah, typically

20:15 XPherior: I suppose that will work.

20:15 technomancy: if 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:15 XPherior: So are you pretty much a one man operation at Heroku?

20:16 technomancy: less than that really

20:16 the clojure support for heroku is really simple; it's not nearly enough to keep me busy

20:16 XPherior: That's too bad. What do you fill your free time with?

20:16 technomancy: nah, it's better than having it be crazy complicated =)

20:16 right now I'm working on the build pipeline

20:17 XPherior: That sounds like fun.

20:17 Looking everywhere for Clojure jobs. Hard to come by.

20:17 About to give up, probably.

20:17 technomancy: easier if you can do remote, but yeah still hard to come by

20:18 XPherior: I thought about that. Remote would be so freakin' boring.

20:18 technomancy: depends where you live I guess

20:18 works really well here

20:18 XPherior: You're in CA?

20:18 technomancy: no, seattle

20:19 XPherior: I'm in upstate NY.

20:19 I hear Seattle's great.

20:19 technomancy: plenty of geek stuff still going on even though I don't see co-workers very often

20:19 it is =)

20:19 XPherior: I'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:19 technomancy: sure

20:20 XPherior: Plenty of Rails jobs, at any rate.

20:20 There's this place in NYC that does OCaml. I wonder what that's like, hah.

20:21 technomancy: probably pretty intense if it's high-frequency trading

20:21 XPherior: Jane Street, yep.

20:24 Perhaps in 5 years it'll be easier.

20:24 technomancy: the build pipeline I'm on is all short-lived process management stuff; something the JVM is rubbish at

20:24 would love to use ocaml here

20:25 XPherior: Too late to switch?

20:25 hiredman: http://ocamlunix.forge.ocamlcore.org/

20:26 XPherior: Interesting, hiredman.

20:26 technomancy: XPherior: yeah, plus I'm the only one who likes it

20:26 XPherior: technomancy: That doesn't surprise me. I wonder if FP'ers will someday not be the minority.

20:30 An init-function at boot time.. What does that even look like?

20:34 technomancy: XPherior: or better would be to just take it as an optional argument across all functions that consume it

20:35 XPherior: I would, but it's a macro that takes & body :(

20:35 technomancy: macros shouldn't have any actual functionality beyond syntax

20:36 XPherior: It's not a matter of functional. It's that you can't have variadic and optional arguments, AFAIK

20:36 Functionality, rather

20:38 technomancy: true

20:38 if you can't avoid rest args then you might have to make dynamic binding the only way to override classpath-based config

20:39 XPherior: Hm, yeah

20:39 Thanks for the suggestions

20:40 Maybe I'll look into making it a plugin and use it with guzheng

20:40 Eh, who knows

21:01 * gfredericks has not used clojureql in a while

22:06 shachaf: I heard y'all're "lens h8rs".

22:06 Sgeo: Is that true?

22:09 Lenses are the future, so I hear.

22:17 Koleman: if 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:25 Sgeo: The threading macros operate on forms, not functions

22:26 ,(letfn [(f ([a b] (f a b 3)) ([a b c] (+ a b c)))] (->> 10 (f 1))

22:26 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

22:26 Sgeo: ,(letfn [(f ([a b] (f a b 3)) ([a b c] (+ a b c)))] (->> 10 (f 1)))

22:26 clojurebot: 14

22:35 Koleman: Sgeo: 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:37 Sgeo: That -> will expand into something approximately like

22:37 (repo/upsert user :users)

22:38 ,(macroexpand-1 '(-> user (repo/upsert :users) )))

22:38 clojurebot: (repo/upsert user :users)

22:39 Koleman: Thinking about it now I can just bind variable for user and pass everything in directly instead of messing around with ->

22:40 I actually screwed up that gist but basically there is supposed to be a function that encrypts the password in that -> call

Logging service provided by n01se.net