#clojure log - Jan 11 2013

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

0:24 muhoo: i suspect the generous insertion of printlns will be necessary

0:25 i've noticed that too. it just kind of hangs. if it was a unix program i'd hit it with strace and see what it's doing. with java, who knows, there may be an equivalent to strace.

0:27 tomoj: there was some bug in clojurescript which caused that I think

0:27 dunno if that's your problem

0:28 I thought it had been fixed

0:30 muhoo: oh so it's the cljs compiler then? hmm, thanks.

0:31 * muhoo bets $10 the bug is in google closure somewhere.

2:48 clj: hey everyone. i remember there was a function which returned sequences like [1] [1 2] [1 2 3] for input [1 2 3], what was that (or is there no such inbuilt function)?

2:51 Sgeo: ,(doc reductions)

2:51 clojurebot: "([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."

2:51 * Sgeo wonders if that could be used

2:52 Sgeo: ,(reductions conj [1 2 3])

2:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>

2:52 Sgeo: ,(reductions conj [] [1 2 3])

2:52 clojurebot: ([] [1] [1 2] [1 2 3])

2:52 clj: Sgeo, thanks!

2:53 Sgeo: You're welcome

2:53 Not sure if there's an easier way

3:10 clizzin: are lein profiles intended to be used for storing dev vs. prod credentials? or is there another convention for storing/reading credentials (e.g. db username and password)?

3:18 alex_baranosky: clizzin: profiles are in your repo, so I wouldn't use them for credentials

3:29 ro_st: man clojurewest is looking awwwweeesome

3:33 echo-area: ro_st: I saw that nrepl supports binding to, so ssh tunneling is not necessary. Do you use that for security reasons?

3:34 ro_st: echo-area: i have an admission to make. i was just telling you what my colleague, who is much more of a linux pro than i am, set up

3:34 he did only spend 5 minutes on it, though. so the method can probably improve!

3:35 echo-area: ro_st: See. Thanks.

3:36 ro_st: how would that work?

3:36 echo-area: I set up :host and :port of :repl-options in project.clj. Then I can connect directly to the server

3:37 (:host "", of course)

3:37 ro_st: say the server is on

3:37 what would i enter into nrepl.el's connect dialog? the same?

3:37 the thing is it has to go over ssh

3:38 echo-area: Not if nrepl itself listens on

5:10 alex_baranosky: anyone around who's interesting in helping me think about a bug I'm seeing?

5:11 Somehow this function in Slamhound seems to loose the second half of files that are a few hundred or more lines long: https://github.com/technomancy/slamhound/blob/master/src/slam/hound.clj#L16

5:12 its as if the PushbackReader can only have X amount of chars copied out of it… it seems to lose any chars over some cap

5:29 clgv: alex_baranosky: best make a minimal example and create a github issue with a description and that minimal example. then people on irc are quickly setup your problem and have a look at it

5:30 and the maintainer gets notified as well

5:30 alex_baranosky: already posted an issue, but its hard to show the test case I have, because ti is 400 lines long

5:30 all you need is a 400 line namespace and that recreates the issue reliably :)

5:31 ro_st: a 400 line (ns) form?

5:31 clgv: alex_baranosky: check that thesis by just using one function def and replicate it until there ate 400 lines

5:31 alex_baranosky: too tired right now to do it, but I Could push to a fork tomorrow perhaps :)

5:32 clgv: *are

5:32 alex_baranosky: clcv: just the namspace, not the ns form

5:32 so a 400 line foo.clj file basically

5:32 clgv: you meant ro_st ;)

5:32 ro_st: ah. so here, a namespace = the file its in

5:32 alex_baranosky: I think it actually depends on the chars in the file, so depending on how much you have per line the number of lines can vary

5:33 ro_st: how many chars in the file?

5:33 clgv: might be an issue with not flushing to disk?

5:33 alex_baranosky: don't know exactly. What's a unix command I could run tot check?

5:34 would the flushing issue then be a bug in clojure.java.io?

5:34 we're using `io/copy` for this

5:34 clgv: humm but the writer is in a "with-open" form that should writer everything to disk

5:35 borkdude: about this clojure style guide, the indenting of the docstring would have a bad side effect on docstring extracting tools right? https://github.com/bbatsov/clojure-style-guide

5:35 alex_baranosky: borkdude: it'd mean that it will format addle when you call (doc foo), I think

5:36 colloquy strikes again

5:36 addle = badly

5:36 clgv: borkdude: the identation is part of the docstring

5:36 borkdude: alex_baranosky for example ys

5:36 clgv: borkdude: aka there is no processing ahppening to the docstring when (doc ) generates the output

5:37 borkdude: clgv yes, so.. hm.

5:39 wei_: has anyone gotten midje to work with clojurescript?

5:41 alex_baranosky: wei_: no

5:42 ro_st: wei_: there's a cljs branch but i didn't have much luck

5:42 tomoj: (fn [app & opts] app') bugs me

5:42 ro_st: i resorted to using cljsbuild crossovers for the pure model code and using midje and a jvm repl to write and test it

5:42 cljs only has ui/glue in it

5:43 tomoj: you can write (comp #(wrap-foo % 1 2 3) wrap-bar) I guess

5:43 wei_: hmm, smart

5:43 tomoj: (the intent obviously being (-> app (wrap-foo 1 2 3) wrap-bar))

5:44 wei_: but I can't do that since I'm writing tests for vanilla javascript. oh well, thanks for the feedback

5:44 tomoj: how about (comp (foo 1 2 3) bar) and (-> app (wrap foo 1 2 3) (wrap bar)) ?

5:44 (of course I forgot to reverse things in both examples)

5:44 ro_st: wei_: look at jay fields' expectations. it might work in cls

5:45 tomoj: (fn wrap ([app wrapper] (wrapper app)) ...)

5:45 wei_: looking now

5:46 ro_st: cljs*

6:09 tomoj: interesting.. https://www.refheap.com/paste/99bb196cc04e5bfcaef6c1098

6:12 firesofmay: Hi, How do I include a library which is not in clojars? (And I dont want to push to clojars)?

6:12 I searched around, it says use checkout, but I am not getting how to use that.

6:12 Any pointers?

6:13 Anderkent|away: firesofmay: is it in any maven repo, or do you want to just use a jar on your filesystem?

6:13 firesofmay: Anderkent|away, I have the project from someones github.

6:14 Anderkent|away, it's not in any maven repo

6:14 Anderkent|away: okay, checkouts are described in the tutorial: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md

6:15 basically make a checkouts directory in your project, then symlink the other projects into that directory

6:15 ro_st: works beautifully

6:15 Anderkent|away: that will let you hack on it, but I don't think it will include the other project in your jars/uberjars

6:15 ro_st: you do have to lein install from the linked-to projects so that deps management knows about its deps

6:15 s/its/their

6:16 Anderkent: right, I suppose if you add the other projects to your :dependencies and then do an uberjar it should be inclided

6:16 *included

6:17 firesofmay: Anderkent, okay let me check

6:19 Anderkent: I'll copy paste from #lein because maybe someone here has a better idea:

6:19 I have a plugin that injects a library into a project and then runs it - is there a better way than hardcoding the version to do it? Currently it looks like https://github.com/lshift/cloverage/blob/master/lein-cloverage/src/leiningen/cloverage.clj

6:21 ro_st: outside of my general area of knowledge, but maybe pomegranate can help?

6:26 clgv: Anderkent: yeah you could use pomegranate to get the dependency at runtime with a version specified at runtime. but a very simple approach would be to add a property to you project.clj and query that one since you write a leiningen plugin

6:26 ro_st: true :-)

6:26 couldn't you grab it from dev-deps directly?

6:27 Anderkent: You mean the plugins project.clj or the project config passed in during plugin invocation?

6:27 How do I query the former?

6:27 ro_st: the latter

6:28 assuming end-users will depend on cloverage as a dev-time dep

6:28 Anderkent: Well the idea of the plugin is that you don't have to add cloverage as a dependency to your project

6:28 only need to add the plugin to your user profile and it will work with all your projects

6:29 ro_st: ah so you need a way to query the version specified there

6:29 Anderkent: well basically whenever I release new cloverage I have to go into plugin sources and update that hard coded version, which seems suboptimal

6:33 ro_st: ping technomancy. he can probably help

6:44 clgv: Anderkent: ah so you want only one plugin release and that should pull in the newest release of the lib in the ideal case

6:44 Anderkent: ideally, yes

6:45 clgv: Anderkent: lein-outdated does something like that. you can have a look how it determines the latest version of a lib

6:45 Anderkent: but I suppose I'll just move that to a properties file and have a script that updates it on each lib release

6:45 oh, nice, thanks.

6:47 clgv: Anderkent: another possibility would be to have a permanent file on a fixed host (github?) that contains the latest release version and you query that on via http and use pomegranate to load it then

6:48 Anderkent: don't need pomegranate, since all *I* do is add an entry to the project clj - lein handles fetching the actual dependnecy

6:48 but yeah, thanks for the outdated pointer

6:48 clgv: ah right. then the last version is the simplest I guess

7:01 Anderkent: clgv: well, that was a nice idea, but with `lein search "a:cloverage"` taking from 30s to 2 minutes I don't think it's feasible :(

7:02 clgv: Anderkent: well then take the last approach. static permanent file that contains the latest release version (might be hosted on your projects github

7:03 Anderkent: for consistency you libraries project.clj can read its version from that file as well

7:04 Anderkent: eh, I'll rather just grab the maven-metadata.xml from releases.clojars.org/repo/... Just need to parse the xml.

7:06 clgv: thats in principle what lein outdated does as well but it includes maven which might be the reason for the longer duration

7:06 the maven repo I mean

7:06 Anderkent: I think the reason is that it tries to index the entire repo instead of fetching just one artifact

7:06 so in theory i should be able to do this quicker

7:06 clgv: ah right both^^

7:07 but couldn you reuse the download and parsing ability?

7:07 Anderkent: yeah I'm thinking right now of just using the apache.maven.index directly, if it does what I want

7:10 Bronsa: how's this function called? f(λ(x,y)) => λ(y,x)

7:13 clj: is there any inbuilt function which would return the first element in a list matching a predicate?

7:14 oliverro: http://clojuredocs.org/clojure_core/clojure.core/some

7:14 Bronsa: some returns a boolean

7:14 Anderkent: some returns what the predicate returns

7:15 Bronsa: right

7:15 clj: yeah, I'm looking for something which returns the element

7:15 Bronsa: (comp first filter)

7:15 clj: Bronsa: that would be lazily computed, right?

7:15 Bronsa: yep

7:15 clj: nice, thanks :)

7:17 Anderkent: clgv: following up on my issue: mvn (and lein) has a "RELEASE" version keyword

7:17 so there's the proper way to do what i want.

7:19 clj: and the best way to get an infinite sequence of say, n, n + 1, n + 2... ?

7:20 Bronsa: range

7:20 ,(take 4 (range 8))

7:20 clojurebot: (0 1 2 3)

7:20 Bronsa: ew

7:21 ,(take 4 (range 8 Double/POSITIVE_INFINITY))

7:21 clojurebot: (8 9 10 11)

7:21 Bronsa: ,(take 4 (iterate inc 8))

7:21 clojurebot: (8 9 10 11)

7:21 Bronsa: better

7:21 clj: iterate inc is nice! :)

7:27 clojure-newb: hi guys, I'm looking on info for ways to paginate/llimit number of results, but there is not much in the diatomic group… any pointers ?

7:28 I know I can use clojure to manipulate data once I have it back from diatomic, but I'm still a bit worried about the size of the collections pre manipulation

7:29 sorry, I meant to post that in the datomic group

7:47 augustl: what's the word we use instead of persistence for putting stuff on disk again? :)

7:57 ejackson: augustl: durable, i think :)

7:58 augustl: ah

7:58 how is that better? >< It also has two meanings!

7:58 oh well

7:59 ejackson: its just that persisent crashes with persistent data structures

7:59 which is a core clojure concept

7:59 as far as i know

8:26 clj: what's the best way to format/indent clojure source file? googling this returns some unanswered stackoverflow questions, and old posts in the mailing list... a standalone program or something that works inside vim would be best :)

8:27 clgv: clj: doesnt your clojure vim ide provide that?

8:29 clj: I'm not sure, I haven't written code inside vim yet, just playing in the repl. And vim doesn't break existing lines into multiple lines, it only indents code broken up into multiple lines.

8:29 so that probably won't work

8:34 cmdrdats: clj: https://github.com/bbatsov/clojure-style-guide

8:34 clj: i find that style guide pretty solid

8:36 clj: cmdrdats: hmm, but there isn't an auto formatter for this I think?

8:36 cmdrdats: clj: oh, you mean an actual tool that styles it for you? just use emacs or, i'm guessing vimclojure does the same

8:37 clj: I'm haven't tried writing clojure in vim

8:37 clj: cmdrdats: yes. I don't think vimclojure has a complete formatter.

8:37 Hodapp: I have. Was not a fan.

8:37 Things just kept breaking.

8:37 clj: cmdrdats: can emacs format one long line of code into multiple lines?

8:38 cmdrdats: hmm, i think i've seen that - but you end up doing it by hand

8:38 because it can't possibly decide on the best style

8:38 Anderkent: I've been using slimv and other than minor annoyances (moving stuff with paredit leaves trailing whitespace, repl print messages have syntax coloring) it's working fine

8:40 cmdrdats: clj: I find the process is a bit like crafting your functions

8:40 clj: start off a bit ugly, then refine it to look nice

8:40 discover a better way of expressing the function and refine it again

8:40 clj: cmdrdats: I think you're right. Vim does format it well after I break it into lines.

8:42 cmdrdats: clj: cool :)

8:45 ciphergoth: Does a Compojure middleware thing for nicely logging exceptions exist?

8:47 ro_st: we use https://www.refheap.com/paste/8362

8:48 Raynes: I need to add a way to stay refheap pastes or something.

8:48 I bet people would use it for Clojure snippets.

8:48 star*

8:49 ro_st: +1!

8:49 cmdrdats: Raynes: especially if you can star and title them

8:50 Raynes: titling I'm not so sure about. Seems like adding a comment at the top of the paste saying what it is would be wildly more useful.

8:50 cmdrdats: true

8:50 augustl: general architecture question.. is it sensible to use queues for async request/response? I.e. component A puts a message on a queue, component B processes and when done creates a new message on the response queue that component A reads

8:58 cmdrdats: augustl: sounds like a common use case to me

9:00 augustl: we use two flavours of that - classic RPC, where the component A's thread waits for a response

9:00 ejackson: yeah, queues are your friend

9:00 cmdrdats: augustl: and where another part of component A is continuously chomping off the response queue asynchronously

9:02 augustl: cmdrdats, ejackson: thanks :)

9:02 cmdrdats: augustl: anytime :)

9:02 augustl: you typically do this with two queues, right? One for requests, and one for replies?

9:03 cmdrdats: augustl: definitely

9:03 queues are cheap, use them abundantly

9:04 generally though, make a queue have a single, simple job

9:05 augustl: cmdrdats: I've been using events a lot (namely in Node.JS), I guess it's much the same thing. The more generic an event is, the better

9:05 events that map 1:1 with business logic is pain.. Generally, the listener of the event should be where the business logic lies

9:10 ciphergoth: OK I've just written this https://www.refheap.com/paste/8365 which logs exceptions using clojure.tools.logging and returns a 500 page. However if someone else has already done this, they probably also log useful information about the request that caused the exception!

9:18 Anderkent: Is there lein-release for lein2?

9:30 shafire: Hi

9:30 Last time I checked clojure out is 2 years ago

9:31 Is Intellij IDEA as IDE for clojure the right choice?

9:31 Anderkent: I believe it has some plugins for it, but heard that refactoring is very buggy

9:32 the common alternatives are emacs+slime, vim+vimclojure/slimv, or eclipse + counterclockwise

9:34 shafire: Thank you, Anderkent

9:34 ro_st: or emacs + nrepl.el

9:35 minimal config for clj nrepl.el in emacs work: https://github.com/robert-stuttaford/.emacs.d

9:36 the disadvantage is that you have to learn some emacs (and therefore emacs lisp)

9:36 clgv: +1 for counterclockwise

9:36 cmdrdats: meh, i think we need to start a campaign against this notion that "emacs is hard"

9:37 ro_st: but it is hard. there's no denying it

9:37 when you're used to the visual studio way of thinking, it's a considerable mindset change. and that's hard

9:37 we can do things to make it easy, but you still have to go through it

9:37 cmdrdats: ah. I guess.. it's simple though!

9:38 ro_st: indeed it is :-)

9:38 cmdrdats: (to a degree)

9:38 ro_st: especially if you don't look under the hood once you're productive

9:38 Anderkent: emacs is hard on your fingers

9:38 ;)

9:39 ejackson: Anderkent: get a pedal :P

9:39 ro_st: or remap capslock

9:39 cmdrdats: ooh - a pedal… why didn't I think of that.

9:39 p_l: Anderkent: because you don't know how to use it. Or have shitty keyboard (the latter is common these days)

9:39 ejackson: ro_st, +1, first move.

9:39 Anderkent: p_l: I was kidding. I don't really use emacs

9:39 p_l: ejackson: actually, remapping caps lock would be more of a ViM thing ;)

9:40 though I do use remapped caps lock

9:40 ejackson: p_l: I use the remapped capslock specifically for emacs. C- is so common

9:41 but then I use a Kinesis, so all bets are off

9:41 p_l: ejackson: emacs modifier key use was designed for both-handed input

9:41 with the hand opposite to the "normal" key being used to hit the modifiers

9:42 ejackson: but for the space kadet keyboard, not 101 AFAIK

9:42 p_l: even 101

9:42 ejackson: anyway, do whatever works for you

9:42 p_l: it's the Unix keyboards that had only one Control :)

9:42 ejackson: i did not know that

9:42 * p_l plans to get a Symbolics LispM keyboard

9:43 p_l: ejackson: iirc the keyboard used with VAX-connected terminals (where Vi was born) had only one Control, located where PC has caps lock

9:44 MIT keyboards had rubout (backspace/delete) in the same place

9:44 ejackson: hm, live and learn.

9:45 p_l: of course, modern laptops no longer have any usable keyboard layout :/

9:45 with thinkpads finally dying

10:19 alexnixon: I seem to be entering "dependency hell" with Clojure. The language/community encourages the use of many small libaries, each depending on several others. However (and as lein-pedantic warns you about), issues with conflicting versions of transitive dependencies lead to serious and very subtle bugs, and these become more frequent as the number of libraries depended on grows.

10:20 I assume it can't be just myself with this problem - has anyone else run into/solved this problem?

10:21 Anderkent: other than excluding things I don't have any idea

10:23 alexnixon: yeah that's an option, but doesn't feel like a very general solution given you still end up with a library using a version of its dependency which is different from the one it wants to use

10:24 if a library isn't backwards compatible then you still end up in a mess

10:24 Anderkent: don't think that problem is solvable, if two libraries depend on different versions of a shared library you can't use them together

10:26 alexnixon: ...unless you can come up with a way of loading multiple versions of the same library at once

10:29 Anderkent: That would require some advanced java classloader hackery i'm not up to thinking about

10:30 saberman: this is why OSGI was developed, and it's a different kind of hell

10:31 alexnixon: I know nothing about OSGI

10:33 Hodapp: Java web services are an interesting mix of "pretty neat" and "jesus christ, what the fuck"

10:34 on the one hand, it's pretty cool to be able to just drop a WAR file onto your server, maybe point it at a database, and have it magically work.

10:35 on the other hand, there are 'technologies' in Java EE where I have read upwards of 100 pages and realized that I still don't even have a CLUE what the technology is, or how to interact with it, because they've literally gone on for 100 pages without saying.

10:37 alexnixon: I can imagine

10:37 Hodapp: the specs are just so damn complex

10:38 alexnixon: though I'm more surprised by this dependency hell in Clojure - I've muddled along for the past year or so completely oblivious to the fact that it's only a happy coincidence that applications work at all

10:38 Hodapp: and at the same time, the specs will include something and describe it very specifically, but they don't describe any mechanism for interacting with it

10:39 end result: the application server provides something that is fairly standard, but in a way that you cannot get at in any cross-platform way

10:40 nDuff: alexnixon / Anderkent: That classloader hackery exists.

10:40 djwonk: pprint isn't working the same for me in 1.5 as it did in 1.4 -- at least not from nrepl

10:40 nDuff: Witness OSGi

10:40 ...though it doesn't play well with Clojure

10:40 djwonk: could anyone confirm / deny that pprint may have changed somehow in 1.5 vs 1.4?

10:41 nDuff: (I mean, clojure.osgi exists, and I use it in production, but Clojure's single-runtime-multiple-namespaces model isn't really a great fit)

10:41 Sgeo: Maybe there are better runtimes for Clojure >.>

10:41 nDuff: alexnixon: ...but yes, isolating transitive dependencies is exactly what OSGi is intended/used for.

10:41 clgv: alexnixon, Anderkent: you could use classlojure for the classloader trickery

10:42 jkkramer: alexnixon: are you actually experiencing problems or just concerned about its latent potential?

10:42 * Sgeo is still a Racket addict

10:42 TimMc: p_l: What's this about Thinkpads dying? D-:

10:42 alexnixon: jkkramer: I have problems

10:42 jkkramer: and a colleague also

10:42 nDuff: alexnixon: Are those problems surrounding Java libraries, or Clojure libraries?

10:43 Anderkent: clgv: you'd have to manually (via pomegranate) load some dependencies in separate classloaders, instead of having lein load them... But yeah that should work

10:44 * nDuff eyes classlojure

10:44 nDuff: ...mmm; shiny. Didn't know that existed.

10:44 alexnixon: clojure libraries. Specifically, I have an internal library which had a non-backwards compatible release (with a major version number increment). I have several projects which depend on it, and so they all need to be updated in lockstep

10:44 * nDuff got into playing with OSGi on account of building tools for an environment (JIRA plugins, in this case) where it was mandatory.

10:44 nDuff: alexnixon: ...well, classlojure looks pretty precisely on-point for that.

10:45 alexnixon: nDuff: it looks like a solid base, but I don't want to be doing this manually

10:46 clgv: alexnixon: get those libraries fixed by their maintainers. if you are able to and can spend the time for it, you might support them with a patch

10:46 Anderkent: or just push your own version to clojars if they don't want to pull it in, and depend on that

10:46 alexnixon: clgv: sure, with a bit a of pain I can dig myself out of the hole

10:47 clgv: it's just a messy situation. What if I find there's a bug in a library B (which I depend on), and I need to revert to an older version? Well then I also need to revert *every* dependency I have which also depends on B.

10:48 clgv: alexnixon: but you wont find a language where you dont get that problem I suppose

10:49 llasram: Or if there is such a language, I would very much like to know about it :-)

10:49 TimMc: If A uses B behind the scenes, sure, a different classloader would work. But if A exposes objects that B creates -- problem.

10:50 (Note: Not the same B as alexnixon's.)

10:50 alexnixon: yeah it's a hard problem - I guess I'd just been blissfully unaware of what a fragile state my code was in

10:50 Anderkent: TimMc: it's a problem if you pass these objects to your version of B, but it shuold work fine if you just give it back to A later on?

10:50 jkkramer: the only time I've had issues so far (fingers crossed) is with unstable internal libs, which was kind of my own fault

10:51 alexnixon: and when this does bite you, it does it in horribly obscure ways

10:55 I suspect this hasn't been too much of an issue so far because Clojure (and especially most libraries) are very new, so there hasn't been time for many backwards-incompatible changes

10:56 djwonk: when I changed from project.clj from 1.4.0 to 1.5.0-RC1 I've lost access to many functions, including pprint and doc

10:57 jkkramer: djwonk: are you using CCW?

10:57 djwonk: jkkramer nrepl

10:58 I made sure to clean out my targets too before restarting the lein repl

10:59 I wonder if something in the namespacing changed?

10:59 jkkramer: djwonk: the auto-referring was causing issues under certain scenarios - e.g., if you have a function named "doc" or "source"

10:59 djwonk: https://github.com/clojure/clojure/commit/728972b026a323fc941a5d560b81d37453dc6cad

10:59 TimMc: Anderkent: Right, it depends on whether the objects are opaque or not. Also, whether you pass them to C which also depends on (possibly a different version of) B.

11:03 djwonk: jkkramer: thanks! so, after looking that over I would hope that nrepl would still work fine

11:04 jkkramer: and, in a fresh project, it does. so something in my current project is different and mucking it up I suppose

11:05 jkkramer: djwonk: the fresh project is using 1.5 also?

11:05 djwonk: jkkramer: yes.

11:05 jkkramer: so here is what I have noticed. in the user namespace, all works fine

11:06 when I go into another, I lose doc. is that what you think was intended?

11:06 jkkramer: I think so

11:07 djwonk: so if I need to do work in the repl in a new namespace, I'll do (apply require repl-requires)

11:07 jkkramer: or (clojure.repl/doc …)

11:08 djwonk: sure. but I'm in the REPL for a reason :) typing doc is the way to go

11:08 jkkramer: or use your favorite tool's shortcut for docs

11:09 djwonk: jkkramer: thanks for pointing that out. i thought I was crazy for a minute

11:16 john3452: g'day

11:18 Having an issue with csv. I have a csv file that has 10 headers. On some of the parse rows, some of the fields are blank, which rather than returning an empty string or something, just returns a row with less than 10 collumns.

11:19 so unfortunately, when I try to zipmap the headers to each key, those rows that are too short obviously don't map correctly

11:19 S11001001: john3452: different csv libs have different options and do different things

11:19 john3452: does anyone know of a particular csv library that will allow me to get back empty strings for empty fields?

11:20 clojure-csv does not

11:34 djwonk: jkkramer: if you have any additional ideas, I created a question here: http://stackoverflow.com/questions/14282109/missing-doc-in-non-user-namespaces

11:58 JulioBarros: FYI I had to upgrade to lein-ring 0.8.0 to use Leiningen 2.0.0-RC1 in a compojure app. The template uses an incompatible version.

12:07 weavejester: JulioBarros: Should be fixed

12:13 john3452: uuuhmm.. It would appear as though I was wrong about clojure-csv

12:13 and empty cells return ""

12:13 so nevermind!

12:13 JulioBarros: weavejester Thanks. Was just trying to figure out who and how to let someone know.

12:14 weavejester: JulioBarros: Just to check, you meant "lein new compojure foo" right?

12:14 JulioBarros: As in that's the outdated template

12:14 JulioBarros: Exactly. Then lein ring run and it would complain about vector?

12:14 vector? in leinjacker ....

12:14 weavejester: JulioBarros: Yeah. It was an outdated version of leinjacker to blame

13:03 peat: Hey all. Just released full support for the Twitter API v1.1 in the twitter-api project. Would love to get eyeballs and testing. :) https://github.com/adamwynne/twitter-api

13:05 ravster: hello all

13:21 augustl: tried to install leiningen on a fresh box, getting "Could not find artifact lein-newnew:lein-newnew:jar:0.3.7", anyone know what that might mean?

13:22 nopolabs: need to run it once in an existing project to prime dependencies, known problem, they are working on it

13:22 augustl: ah

13:22 RC is RC :)

13:23 john3452: I'm trying to use Raynes' fs utility

13:23 having confusion with dependencies

13:24 in project.clj, I have [fs "1.3.3"]

13:24 my understanding is that needs no other pre-text, like fs/fs or anything... and lein deps does not return an error

13:25 however, in my core.clj, doing a (require '[fs.fs :refer :all]) tells me that fs__init.class cannot be found, etc.

13:25 ibdknox: it's fs.core

13:25 john3452: there is an fs jar in my lib directory

13:26 ah

13:26 TimMc: john3452: group/artifact coordinates are independent of namespaces :-)

13:26 For better or worse.

13:26 I still can't believe he named it "fs".

13:26 john3452: right... so confusing... so in the future, how should I figure that out myself? dig into source of the library in question and look at the filename?

13:27 TimMc: john3452: A well-written readme will tell you both the lein dependency vector and the main API namespace.

13:27 john3452: aye

13:27 TimMc: If all you have is a jar file... dig in. :-/

13:29 pmonks: Related: is there any way to determine the list of available namespaces, *without* requiring/using them first?

13:29 Or do they have to be explicitly require'd / use'd before they're "known" to Clojure?

13:30 augustl: favorite part of lein 2 rc1 is that the unencrypted auth config in ~/.lein is no longer deprecated :)

13:31 got that annoying deprecation message all the time..

13:32 tpope: cemerick: do you think nREPL 0.2.0 will be out in time to make it into Leiningen 2.0.0? re: https://github.com/technomancy/leiningen/issues/917

13:34 cemerick: tpope: yes

13:35 tpope: \o/

13:40 TimMc: pmonks: `tree .` :-P

13:40 augustl: I guess it was reprecated.

13:40 john3452: is there a prefered way to do a def from within a defn? Like a make-var or something?

13:41 TimMc: You don't want to.

13:41 augustl: john3452: dynamic vars or with-redefs I'd say

13:42 TimMc: john3452: What's the use-case?

13:43 john3452: well, I have the need to run an executable that creates a csv... I then slurp it into a datastructure... but I'd prefer have all three steps in one defn... I suppose I could slurp the file and return the whole string.. then do a def in the global scope

13:44 its a little messy, having to run the external executable

13:44 dakrone: stuartsierra: ping

13:44 stuartsierra: pong

13:44 john3452: as I really don't care about the intermediate csv file. I just want to get the data into memory

13:46 dakrone: stuartsierra: you haven't responded to https://github.com/dakrone/clj-http/issues/111 yet, is the fix working for you?

13:47 stuartsierra: I'm just avoiding redirects for now, but thanks for responding.

13:49 dakrone: okay? I'll leave it open until you can try it again or a few weeks go by

13:49 stuartsierra: Sorry, this was for a client project and I've already moved on.

13:53 Looks OK though.

13:53 technomancy: pmonks: the bultitude lib does that

13:54 nothing in clojure itself

13:54 augustl: TimMc: hehe, never heard the word reprecated before :)

13:54 pmonks: Thank guys

13:55 s/Thank/Thanks

13:57 dnolen: technomancy: when I try to upgrade to lein 2.0 rc1, it tries to fetch https://github.com/technomancy/leiningen/raw/'preview'/bin/lein

13:57 technomancy: note the quotes in the url

13:58 technomancy: dnolen: ouch; thanks

14:04 ppppaul: how do i stop a jetty server from the repl? (launched in the repl via ring/run-jetty

14:05 technomancy: ppppaul: you have to save the return value of run-jetty and call .stop on it

14:06 ppppaul: oh

14:07 thanks

14:07 technomancy: I usually have a ;; (def s (-main)) at the bottom of my main.clj files

14:08 ppppaul: that's what i just did

14:08 i'm wondering how to kill my server now

14:15 jvyas: hearing alot about the hammock dev thingy. its this week huh

14:16 frozenlock: hrm... I'm transferring an object from another language to a clojure map. The said object has redundant information. Is there a way, in the clojure map, to point to another section of the map, or should I simply repeat the information?

14:16 tmciver: ppppaul: (.stop s)?

14:18 amalloy: john3452: every def is in the global scope

14:18 TimMc: john3452: None of that sounds like mucking with dynamic vars is appropriate in the slightest.

14:18 amalloy: if you want something local, use let

14:18 technomancy: TimMc: does this make sense to you? https://github.com/technomancy/leiningen/issues/920

14:19 TimMc: Didn't do it!

14:19 I'll try to reproduce it.

14:21 nDuff: john3452: maybe you want let

14:21 john3452: ...if you can show us the code you're trying to use, we could perhaps provide a more concrete example of how it could be better written.

14:22 TimMc: pastebin: http://refheap.com/

14:22 nDuff: or ideone.com

14:22 though the latter isn't so useful in cases like the current one (where your code is interacting with external files/executables)

14:26 technomancy: TimMc: I just merged newnew to leiningen itself

14:26 but fixing it either place would work

14:26 TimMc: oh god windows

14:27 technomancy: TimMc: I don't get how you can get that exception out of clojure.string/replace

14:29 TimMc: Could it have to do with java.io.File/separator being a blackslash?

14:29 *backslash

14:30 ppppaul: i'm having a very strange situation with ring... i had my routes working for quite some time, and all of a sudden i can't even get (GET "/" [] "some sting") to work when it's my only route. i only get NPEs back. i have no wrappers either.

14:30 john3452: nDuff: I ended up going with a let. Thanks!

14:31 technomancy: TimMc: yeah, looks like it needs to be a double backslash? which as a string literal is a quadruple?

14:31 sandbags: anyone using LaClojure: can confirm that println ought to appear in the console area where you see the java command being output?

14:32 technomancy: crazytown

14:32 TimMc: ok, I got a fix

14:33 TimMc: &(clojure.string/replace "foobar" #"\." "\\")

14:33 lazybot: ⇒ "foobar"

14:33 TimMc: &(clojure.string/replace "foo.core" #"\." "\\")

14:33 lazybot: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

14:33 technomancy: ayup

14:33 TimMc: loveliness

14:33 technomancy: pushed a fix and it's ridiculous

14:33 TimMc: &(clojure.string/replace "foo.core" #"\." (java.util.regex.Pattern/quote "\\")) ;; nooope

14:33 lazybot: ⇒ "fooQ\\Ecore"

14:34 TimMc: ,(doc clojure.string/replace)

14:34 clojurebot: "([s match replacement]); Replaces all instance of match with replacement in s. match/replacement can be: string / string char / char pattern / (string or function of match). See also replace-first."

14:34 TimMc: &(clojure.string/replace "foo.core" \. \\)

14:34 lazybot: ⇒ "foo\\core"

14:34 TimMc: technomancy: ^ works

14:35 &(clojure.string/replace "foo.core" "." "\\")

14:35 lazybot: ⇒ "foo\\core"

14:35 TimMc: ^ rather

14:35 technomancy: huh; that's a bit nicer than "\\\\"

14:35 thanks for checking it out

14:35 TimMc: also it's generic

14:36 So if you're using some crazy-ass OS that uses newlines as path separators, you're good.

14:37 ppppaul: lein ring server-headless isn't reloading when my files change

14:38 amalloy: TimMc: technomancy: ##(clojure.string/replace "foo.core" #"\." (java.util.regex.Pattern/quoteReplacement "\\"))

14:38 lazybot: java.lang.IllegalArgumentException: No matching method: quoteReplacement

14:38 amalloy: er

14:39 &(clojure.string/replace "foo.core" #"\." (java.util.regex.Matcher/quoteReplacement "\\"))

14:39 lazybot: ⇒ "foo\\core"

14:39 p_l: TimMc: regarding Thinkpad's dying - have you seen the new keyboard? The lack of "power" in components you can select for a thinkpad, even in T/W-series?

14:39 amalloy: iirc though, clojure 1.5 makes that quoteReplacement behavior become the default so you might want to be careful. i'm not sure

14:39 technomancy: p_l: resisting the urge to rant about screen resolution in the X series

14:39 but it's hard

14:40 p_l: technomancy: yeah

14:40 technomancy: the fact that old thinkpads last forever and are easy to repair makes it more bearable

14:40 tpope: my old thinkpad recently died and I didn't know what to buy :/

14:40 technomancy: there's a guy in #emacs who lives on a sailboat and hacks CL on a pair of X41s

14:40 tpope: ended up doing a W series :/ :/

14:40 p_l: but my main complaint is about the new keyboard. I could accept island keys, especially since it supposedly has similar good tactile feedback as old ones, but the layout, oh god, layout

14:40 technomancy: ...drewc?

14:40 technomancy: p_l: the response mechanism hasn't changed though has it?

14:40 yeah drewc

14:41 TimMc: p_l: Haven't seen it. Don't want to. :-(

14:41 chrstphrhrt: anyone have a good suggestion for a tutorial on recursion (loop [n n…)? coming from OO my brain is incapable of escaping for, while etc.

14:41 TimMc: They finally added a way to switch Ctrl and Fn in teh BIOS, so R-Ctrl is back to its rightful place...

14:42 technomancy: TimMc: the corner is the wrong place

14:42 don't be silly

14:42 TimMc: p_l: And I did have to yank out some keys they put around the arrow keys...

14:42 technomancy: ctrl goes next to A

14:42 p_l: TimMc: without the pure awesomeness that was full keyboard (with 4-grouped F-keys!), and lack of power... >_>

14:42 TimMc: technomancy: Don't worry, I also remapped CapsLock.

14:42 * technomancy calls off the gourds

14:43 p_l: technomancy: not necessarily, at least for emacs. OTOH, proper emacs keyboard requires mirrored modifiers so you can use your thumbs for them

14:44 seangrove: chrstphrhrt: Not sure it needs much explanation. A recursive function checks if some condition is met: if so, it returns the value. If not, it calls itself with (probably) different values

14:46 chrstphrhrt: seangrove: really just an explanation of the syntax… one-liner sexps are no problem but multi-liners are a bit confusing to my beginner's mind

14:46 * TimMc finally gives in and checks Lenovo's website

14:46 TimMc: ...the fuck did they do with PgUp and PgDn?

14:47 amalloy: chrstphrhrt: perhaps don't worry about loop/recur at all for the moment, and focus on recursion via named functions like (defn factorial [n] (if (zero? n) 1 (* n (factorial (dec n)))))

14:48 chrstphrhrt: amalloy: thanks yeah that expression makes perfect sense

14:48 i guess what seems confusing about "loop [n n…" syntax is really a matter of "where's my operator?"

14:48 amalloy: *shrug* it's just where it is in a while loop: inside

14:48 mattmoss: Give me a full powered, non-hamstrung tablet with linux or osx and I'll plugin in my own keyboard, thank you very much. http://www.trulyergonomic.com/store/index.php

14:49 TimMc: mattmoss: So, carry that keyboard with you, or what?

14:49 mattmoss: Not yet.

14:49 loganlinn: if i cons onto a lazy seq, does the seq get realized?

14:49 chrstphrhrt: amalloy: well, usually a while loop has some condition like (x > 4)… but "[n n…" why two n ?

14:49 amalloy: loganlinn: try it and see

14:50 chrstphrhrt: (loop [x y] (...)) is very much like ((fn [x] (...)) y)

14:50 it's (sorta) shorthand for an anonymous recursive function, which of course has no termination conditions

14:51 the body of the function itself decides what to do, including whether to keep going

14:51 chrstphrhrt: amalloy: OHH now i get it. jeez.. was just the repeated arguments that threw me off

14:51 thanks!

14:53 loganlinn: actually, i dont think it should… otherwise idioms like, (cons n (lazy-seq (inc n)) wouldn't be lazy, right?

14:54 amalloy: well, that particular formulation of the idiom is a classcastexception :P

14:54 hiredman: anything inside a lazy-seq is lazy, anything outside is not

14:54 cons will not force a lazy seq, but cons is not lazy

14:54 TimMc: &(cons 3 (range))

14:54 lazybot: java.lang.OutOfMemoryError: Java heap space

14:55 TimMc: &(take 5 (cons 3 (range)))

14:55 lazybot: ⇒ (3 0 1 2 3)

14:55 hiredman: (lazy-seq (cons … …)) is lazy

14:58 TimMc: p_l: When my current Thinkpad breaks, I'm just gonna quit programming and become a farmer.

14:59 technomancy: TimMc: just stock up on spares while they're still available on ebay/craigsist

15:04 p_l: technomancy: the problem is when the thinkpad you have doesn't have the power nor mobility potential

15:05 I ended up looking at Clevo resellers like Eurocom, because they have wide choice of parts... so I'd order the next laptop with japanese keyboard to have enough modifiers

15:05 TimMc: I had a Clevo. It did not end well.

15:06 All sorts of little pieces falling off...

15:06 and the screen failed after a few years.

15:12 p_l: TimMc: well, depends exactly what kind (and who assembled it)

15:12 Eurocom tends to do a quality job

15:13 (A big part of their market is engineers/scientists/hi-end content creation etc.)

15:18 sandbags: i realise not using emacs maybe puts me at a disadvantage but is using IntelliJ & LaClojure regarded as ghetto Clojure?

15:18 technomancy: sandbags: it's certainly behind CCW from what I can tell

15:19 sandbags: i'm a sometime Vim user also

15:19 * nDuff considers CCW fairly ghetto too, but hasn't reevaluated it in several months.

15:19 sandbags: not really looked into the Vim options yet

15:19 ibdknox: sandbags: just used vim

15:19 use*

15:19 sandbags: i use AppCode for Objective-C so Intellij&LaClojure seemed a reasonable option

15:19 * nDuff uses vim for things that aren't Clojure; the emacs tools are good enough to pull him over when working on LISPs.

15:19 sandbags: ibdknox: how's editing support there? does it handle indentation well?

15:19 nDuff: i can't get on with emacs (i have tried, more than once)

15:20 amalloy: agreed, use vim if you like it

15:20 ibdknox: sandbags: yes

15:20 ravster: how do I solve a 'REPL server launch timout' when I do a 'lein repl'?

15:20 sandbags: ibdknox: is there a best link for getting started with Vim & Clojure? A quick google seems to turn up quite a lot of hits

15:21 amalloy: sandbags: foreplay is supposed to be good; i'm not sure if that's instead of, or in addition to, vimclojure

15:21 sandbags: amalloy: ah a tim pope production, that sounds hopeful

15:21 thanks

15:22 seems like it goes with VimClojure to provide editing support

15:22 looks like i'm good to go, thanks :)

15:25 edtsech: sandbags: guide for VimClojure http://clojure-doc.org/articles/tutorials/vim.html

15:30 sandbags: edtsech: ta

16:06 TimMc: I'm trying to build org.clojure/java.classpath -- what's the magic incantation?

16:06 It appears to use Mavne.

16:06 *Maven

16:06 tomoj: likely `mvn install`

16:08 amalloy: mvn package would work too if you don't want it installed

16:08 TimMc: I guess I can always remove it from my m2 afterwards...

16:08 amalloy: Thanks, that seems to do it.

16:09 sandbags: anyone here used foreplay.vim?

16:09 tomoj: oh, I always vaguely wondered why I was installing when I just wanted to build

16:09 clojurebot: Cool story bro.

16:11 bbloom: tpope: the location list is frickin brilliant.

16:13 sandbags: hrmmm... cq just went bang... took MacVim with it (and no crash report either which is odd)

16:13 not sure if this is because I'm using MacVim rather than regular Vim

16:15 bbloom: sandbags: i think macvim reports it's crashes a little differently than regular vim

16:15 puts them in ~/Library or something mac-like

16:15 sandbags: bbloom: oh it circumvents the usual crash reporter? odd choice

16:16 bbloom: sandbags: well vim runs on non-osx platforms and provides vim-specific dump information

16:16 sandbags: ah

16:16 good point

16:16 bbloom: so i dunno if they explicitly turn off the mac crash reporter

16:16 or simply recover before osx ever sees the error and then writes to file

16:16 sandbags: occasionally an app does die with no crash report but its usually a bad sign when that happens

16:17 for some value of bad sign, e.g. "ominous portent" etc..

16:17 bbloom: i have no idea, i'm just kinda making wild-ass guesses

16:17 sandbags: well i guess tpope's not going to be debugging my vim dumps files :)

16:18 bbloom: no, but somebody over in #vim might

16:18 :-P

16:18 sandbags: i'm not clear if foreplay.vim is prime time or something he's still hacking on

16:18 bbloom: or, presumably #macvim exists

16:18 i've been using foreplay for full time clojure work since he released it

16:18 sandbags: hrmmm

16:18 bbloom: it's been rock solid for me

16:19 sandbags: so i updated macvim, installed using pathogen according to his instructions... started lein repl in my project, opened a relevant .clj, :Connect'd to my repl, then :cq

16:20 i'm guessing even if i did something wrong vim shouldn't have exited stage left

16:22 TimMc: I just attached a patch to a JIRA ticket. Do I need to poke someone to advance the review process, or is there someone watching uploads?

16:23 This is for the java.classpath contrib, mind you, not clojure core.

16:24 dnolen: TimMc: yeah the project lead should get an email.

16:24 TimMc: OK, great.

16:35 ibdknox: bbloom: what does the location list give you?

16:36 bbloom: ibdknox: if an evaluation causes an exception, :lopen will give you the stack trace in the location list

16:36 ibdknox: so you can read the stack trace & jump to the line that failed

16:37 and then navigate around the stack

16:37 ibdknox: cool

16:37 I just did something similar for LT the other day :)

16:38 bbloom: it's pretty useful, but i don't rely on stack traces that much, i much prefer tracing output

16:38 only inserting random print lines gets messy

16:38 luckily, small pure functions are pretty easy to instrument, so i just clean up all my print lines and always test itty bitty pieces with the repl

16:39 but i kinda wish there was some sort of automatic logging facility that captured all the inputs/outputs to functions & to large blocks in functions and kept a logorithmic scale log

16:39 ie the further back in time, the less information it keeps

16:39 but closer to NOW it would keep every single value at every single step

16:39 with persistent/immutable data structures, that'd be crazy useful and reasonably memory efficient

16:40 ibdknox: sounds like a slight augmentation to the instarepl :)

16:40 TimMc: log log

16:40 bbloom: ibdknox: well then what are you waiting for? :-)

16:40 ibdknox: haha more hands :p

16:41 Raynes: ibdknox: When are you going to have people? Haven't you been hiring forever?

16:41 bbloom: Raynes: hiring is crazy fucking hard.

16:41 Raynes: Sure, but I would have expected *someone* to get a job there by now.

16:41 ibdknox: Raynes: especially hard for what we're doing

16:42 TimMc: The company I work at has been looking for a web dev for like 6 months now.

16:42 A *web dev*.

16:42 bbloom: heh

16:42 ibdknox: Raynes: I have two potentials, but going after the best takes time

16:43 * nDuff is keeping his eyes out for interesting opportunities w/ shops either having Chicago offices or set up for (and w/ experience supporting) remote employees.

16:43 nDuff: ...happily and busily employed right now, but planning to move up that way in a year or so.

16:45 ibdknox: Raynes: trust me when I say if I could have someone, I would. Constantly being in the "I have to get shit done" phase doesn't leave a lot of time for the more fundamental and creative thinking that I *should* be doing

16:45 TimMc: nDuff: OfficeMax tried to recruit me to that area. Why would I leave the Boston area for the Chicago area? *Why?*

16:46 Raynes: It's hard enough right now even hiring Excel experts to hold up the ends of the hammock for when you need some time to think.

16:46 bbloom: tpope: is it possible to color code the location list? i'd love it if code within my project directory was a brighter/more-obvious color

16:47 nDuff: TimMc: *nod*. In my case, I'm engaged to a UofC grad who's been planning on moving back home to the Hyde Park area for years... also, we're both completely sick of Texas summers.

16:48 TimMc: Those are both some pretty good reasons.

16:48 nDuff: (for better reasons in her case than mine -- she doesn't sweat, so heat stroke is a real and constant danger when ambient temperature gets too high).

16:48 TimMc: anhidrosis?

16:49 nDuff: ...as a side effect of spina bifida, yes.

16:49 TimMc: That would *suck*.

16:49 Of course, I grew up in Virginia, where the humidity is so high that sweating doesn't help anyway.

16:57 jweiss: one problem i have lately is that while my code uses few data structures, they're a bit complex. when I need to add a feature or change something, i'm never exactly sure i've gotten everything in all the functions that work with this data, to match. what tools could help with that?

16:58 i could write a validator function, but seems like overkill at runtime to keep calling it.

16:58 where should the 'canonical schema' (if you will) be kept?

16:59 bbloom: jweiss: you don't need to call the validator at runtime all the time

17:00 jweiss: you can insert calls to it where you need them during development, or assert the subets of the data individual functions depend on

17:00 amalloy: jweiss: the sicp guys would recommend not using that data structure "raw", but defining constructor and accessor functions for it, such that any time you change the actual format you need only update the constructors and accessors to know that all users are up to date

17:00 that style isn't very popular in clojure, probably because it winds up being a lot more verbose, but it's worth thinking about at least

17:01 jweiss: amalloy: yeah, i'd end up with a lot of functions like (def result :result)

17:01 snowylike: sorry to bust in, but when i read the part about data structures, it blew my mind

17:01 frozenlock: Is there a built-in variable in nrepl.el to prevent the popup window on error?

17:03 jweiss: bbloom: i would like to have "what the data structure should look like" all in one place, so spreading the assertions out is pretty much what I do now, and the problem is when i update the structure, i don't know where to go to fix the assertions.

17:04 i suppose i could just keep running the code and fixing it one by one as it blows up but that seems like 'not the best way'

17:04 bbloom: jweiss: the problem is that the solution is often very domain specific

17:04 but the simplest and most general solution is a single global validator function

17:04 TimMc: snowylike: ...how so?

17:04 bbloom: the other sort of approach is to serialize your data structure to html or something so you can visually inspect it

17:05 see the Thinking In Data talk by stuart siera for an example of that with a poker game

17:05 snowylike: TimMc: I was 17 at the time, maybe 18, and i'm more a mathematician than a programmer

17:05 bbloom: jweiss: alternatively, there is some ongoing work for a schema system

17:05 snowylike: hadn't programmed much up until then

17:05 bbloom: which would basically just be a declarative bag of predicates that could give you a sensible collection of validation errors

17:05 as opposed to throwing an assertion on the first error

17:06 TimMc: snowylike: But what part of it blew your mind?

17:07 snowylike: i'd read about OOP and things like that before, but never quite saw the point in it

17:07 amalloy: neither have most OOP programmers

17:07 TimMc: Ah, I see.

17:07 callen: I...am going to dissent here. This is *some* value in OOP.

17:07 no one approach wins the whole treasure chest.

17:07 amalloy: that's not dissent at all?

17:08 callen: amalloy: I am dissenting from the silent majority that is #clojure

17:08 snowylike: i, personally, don't think OOP in itself is bad

17:08 just some vocal subset

17:08 amalloy: i don't think a silent majority bothers itself with complaining about what other people are doing. that's something only minorities are interested in spending effort on

17:08 snowylike: (of the users, i should add)

17:10 jweiss: bbloom: i'll try out a validator fn, thanks. i think ideally (since my data is nested maps w keywords) that i could have a prototype var and have the validator match the keys against the prototype. that way i can easily look at the prototype when i need to.

17:11 bbloom: jweiss: if all you care about is that it has the right keys, (= (keys prototype) themap) would do the trick :-P

17:11 jweiss: bbloom: i care about more than that,but that is probably the first thing the validator will check.

17:18 justin_smith: I ran lein update and now a bunch of functions in clojure.data.json are renamed; I don't have full control of versioning in the deployment environment; How do I go about making sure the functions have the same name on my dev machine and the deployment environment? (this is with clojure 1.3)

17:19 technomancy: justin_smith: how can you not have control of versioning in deployment?

17:19 justin_smith: because someone else admin's the machine

17:19 paranoid client

17:19 technomancy: you don't need admin access

17:19 nothing in Clojure is installed system-wide except possibly lein itself

17:19 justin_smith: they ask for source. They write the compilation script

17:20 we provide a pom.xml, they refuse to run lein

17:20 technomancy: ok, still with a pom it doesn't matter

17:20 you don't need admin access

17:21 justin_smith: so I guess what my real question is is how do I get clojure to use a specific version of clojure.data.json via pom.xml

17:21 technomancy: whatever you put in project.clj will come out in pom.xml

17:22 plus transitive dependencies will be pulled in of course

17:22 justin_smith: the guy who coordinates build with the client offloaded this query onto me. I need to talk to him now, I do not understand our deploy / build process, I just know it is a mess

17:22 n/m sorry for the noise

17:26 TimMc: $latest clojure.data.json

17:26 lazybot: No project by this name exists on clojars.

17:27 TimMc: $latest org.clojure/data.json

17:27 lazybot: No project by this name exists on clojars.

17:27 TimMc: Ugh, right -- I need to check central.

17:27 0.2.1 -- yeah, I wouldn't rely on that having a stable API

17:29 justin_smith: yeah, lesson learned on that one, but the site is already deployed, I just have to figure out how to make sure this dependency (not an explicit dependency of our project, but one pulled in as a clojure dep) does not update and break the site

17:29 or how to force it to update and upgrade all our code to the new namespace

17:29 technomancy: justin_smith: if you get lein2 you can do `lein deps :tree` to see where transitive deps come from

17:29 TimMc: Do you rely on a SNAPSHOT version of anything?

17:29 technomancy: makes it a lot easier to debug things like this

17:30 also relevant: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html

17:31 justin_smith: let me double check on the SNAPSHOT thing

17:31 not directly, but some library may be suspect...

17:32 yeah, it is probably because of one of our in house libs requiring a SNAPSHOT, thanks for the tip

17:34 TimMc: That'll do it.

17:37 estebann: I just wrote my first lein plugin, which is working fine if I package it as an uberjar (it relys on an external library). Is there any way to avoid having to do that?

17:38 egghead: gosh, core.logic is so nice -- I just wrote a simple ~remove member~ relation, think I'm getting the hang of this :)

17:38 https://www.refheap.com/paste/8391

17:40 TimMc: estebann: lein should be fetching your dependencies for you when your plugin is used.

17:40 egghead: looking at that code I realize I shadow a lot of the core library (first, rest, list, recur), what is the general opinion on that?

17:40 sometimes it just seems like the right name...

17:40 estebann: TimMc: is there anything I need to do to make that happen?

17:41 because right now, its not

17:41 TimMc: No, it should just work. Got public source I can look at?

17:41 estebann: hmmm... not sure. I'll ask

17:43 TimMc: estebann: Even a project.clj with faked strings might turn up some clues.

17:44 technomancy: estebann: have you read doc/PLUGINS.md?

17:46 estebann: technomancy: not completely, ... I loook there again

17:48 TimMc: it's a little proguard helper plugin project.clj is here http://pastebin.com/MpFt2rw3

17:48 * nDuff scowls at the pastebin.com link

17:49 estebann: nDuff: what's preferred?

17:50 nDuff: estebann: refheap.com is ideal

17:50 estebann: ...but anything that's not full of annoying ads is at least good enough to avoid snark.

17:50 estebann: ok, i'll use that in the future

17:51 nDuff: (refheap.com -> maintained by Raynes, so it's not far to go to complain if anything breaks)

17:57 Raynes: But nobody ever complains because I'm cool like that. Right nDuff? RIGHT?

17:57 * nDuff whistles

18:00 clojure-newb: hey guys, anyone know how to compose transformations in a defdocument with laser ?

18:01 I see an example '((comp (l/classes "foo") (l/id "bar"))' but I'm having trouble translating this across to a defdocument

18:01 Raynes: Raynes might know.

18:02 I'll ask me.

18:02 clojure-newb: comp should work fine. Can you show a piece of problem code?

18:02 clojure-newb: Raynes… does Ryanes know ?

18:02 :-)

18:02 egghead: ugh, I hate projects like laser where you can never get a hold of the author

18:02 abandonware

18:03 Raynes: It's ridiculous, egghead.

18:03 clojure-newb: I guess I'm having problem applying two transformations against two selectors

18:03 in my case just putting some data in a ul, and writing a text val into a div

18:04 Raynes: Do you have an example you can show?

18:05 egghead: http://clojurewest.org/sessions some nice stuff here, looking forward to bbloom's talk

18:05 some of the stuff, like stuart halloways talk on simulation testing is such a tease

18:05 bbloom: egghead: i'm also looking forward to my talk.... i've got to go write it :-)

18:05 egghead: "This talk will introduce simulation testing, walking through a complete example using Simulant, an open-source simulation library." -- open source? -- WHERE

18:08 Raynes: yogthos: technomancy inlined lein-newnew in leiningen itself.

18:08 yogthos: Just a heads up so you know where to look now.

18:08 bbloom: is there a refer-as type construct?

18:09 callen: Raynes: he annexed it. LIKE SIE GERMANS

18:09 bbloom: i can refer to a namespace :as something, but can i refer to a function :as something?

18:10 amalloy: &(doc refer)

18:10 lazybot: ⇒ "([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symb... https://www.refheap.com/paste/8394

18:11 clojure-newb: Raynes: my current sample more or less is : https://www.refheap.com/paste/8393… I just can't figure out how to get another select/transform pair into there… or more than another...

18:11 bbloom: ahhh rename

18:11 got it

18:11 thanks amalloy

18:12 amalloy: the one-stop shop for all your (doc x) needs

18:21 stuartsierra: egghead: It hasn't been released yet. Should appear before Clojure/West.

18:22 egghead: figured as much stuartsierra :D

18:59 clizzin: i have a ring app that i've packaged into an uberjar via lein-ring and run using `java -jar app.jar`. but i'd like to pass it db credentials via the command line. how does my app get access to these command-line arguments?

19:00 egghead: clizzin: they are passed to the main "method"

19:00 clizzin: egghead: where is that if i'm using lein-ring

19:01 i haven't defined a :main in my project.clj, i've only defined a :ring {:handler ...}

19:02 justin_smith: anyone know off the top of their head the new name for clojure.data.json/read-json-from?

19:23 clojure-newb: Raynes: any luck… did my refheap help ?

19:24 Raynes: clojure-newb: Oh, I'm sorry. I forgot all about it. Give me a few.

19:24 clojure-newb: Raynes: no worries

19:26 Raynes: clojure-newb: Okay, so you want to compose transformations, run that on a node, and replace the node with the output of that?

19:26 What about … (l/element= :tbody) #(l/on % (trans1) (trans2) ..)

19:27 clojure-newb: Raynes: it will be one transformation per selector

19:27 Raynes: if possible

19:27 Raynes: I don't know what you mean by that.

19:27 clojure-newb: operating on different parts of the document

19:27 Raynes: You're trying to run different transformers for different :tbody elements?

19:27 clojure-newb: so rather than multiple transformations on one element selector, I want to change different bits of the document

19:27 yes

19:28 Raynes: You'll have to select and transform those individual elements. You can add an id or something to them to give you something to select.

19:28 clojure-newb: How do I put more than one selector/transformer pair into the defdocument ?

19:29 Raynes: (defdocument foo (some-readable-thing) [args] selector1 transformer1 selector2 transformer2 ..)

19:30 clojure-newb: that simple ? haha

19:30 Raynes: Indeed. :p

19:31 clojure-newb: cool

19:31 thanks for the help

19:32 Raynes: clojure-newb: I've got to take off for now. If you run into any more problems, just ping me or email me or something.

19:32 clojure-newb: ok thx

19:32 Raynes: Note that there is a standing bug with returning seqs from transformers which may or may not effect you. I hope to have it fixed over the weekend. See the relevant issue for more details.

19:32 affect*

19:33 clojure-newb: noted, I'll have a play with this tomorrow morning, will yell if I get stuck

19:33 thx

19:34 devn: Call 608-729-4573 -- It's a dial-a-clojure-doc service

19:45 pmonks: Jenny? Is that you?

19:45 tpope: bbloom: you could probably rig it up with :match, but that's kind of manual

19:45 pmonks: Oh wait, that's 867-5309

19:45 egghead: seven two nine four five seven threeee ee e

19:49 bbloom: one more bug to fix & then i have a cool bit of code to release :-)

19:49 and probalby a copy-edit pass on the docs heh

19:49 probalby <- see why i need it?

19:49 egghead: pro balby? what is balby and why are you so supportive of it?

19:50 bbloom: heh

20:11 brainproxy: binding cmd key to Emacs meta on a Mac can have funny/frustrating consequences, especially after long stretches of programming

20:12 i keep pressing cmd-w to copy text in apps other than emacs, and thereby closing the windows :-/

20:13 technomancy: apps ... other than emacs?

20:13 brainproxy: yeah like web browser :p

20:13 technomancy: you mean like grep?

20:13 egghead: haven't heard of it

20:13 brainproxy: hehe

20:13 nDuff: brainproxy: You mean w3? That's part of emacs.

20:13 http://www.emacswiki.org/emacs/w3

20:14 (or emacs-w3m, for those who aren't purist enough to want software written in elisp)

20:14 pandeiro: brainproxy: my brain farts on C-d all the time and I end up with the characters not deleted and a bunch of bookmarks to my own gmail

20:15 brainproxy: pandeiro: lol

20:18 mattmoss: Using homebrew, I just typed 'man brew' at the console. That's just wrong.

20:23 bbloom: there are plenty of good man puns

20:24 man less, man which, man man, etc

20:25 tpope: man -a tee

20:53 pmonks: man -k ini

21:11 bbloom: is 6pm on a friday a good time to release a project? probably not...

21:11 *shrug* oh well

21:14 https://github.com/brandonbloom/fipp

21:16 tomoj: cool

21:16 I guess I can easily make one that doesn't print the contents of Vars?

21:16 and doesn't recurse into DbIds

21:17 bbloom: tomoj: the extensibility model isn't 100% fleshed out yet, but i accept patches :-) should me *much easier* to work with than clojure.pprint

21:18 s/me/be

21:18 frozenlock: &(re-matches #"[A-Z]" "This is a Test")

21:18 lazybot: ⇒ nil

21:18 frozenlock: I was expecting to get ["T" "T"] :(

21:19 bbloom: (doc re-find)

21:19 clojurebot: "([m] [re s]); Returns the next regex match, if any, of string to pattern, using java.util.regex.Matcher.find(). Uses re-groups to return the groups."

21:19 bbloom: (doc re-seq)

21:19 clojurebot: "([re s]); Returns a lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), each such match processed with re-groups."

21:19 tomoj: &(re-matches #"[A-Z]" "A")

21:19 lazybot: ⇒ "A"

21:20 frozenlock: Oh I see, it must be a perfect match.

21:22 bbloom: that dopey project took me about 3 days longer than i expected it would...

21:22 but i'm happy with how it turned out :-)

21:23 ibdknox: i expect somebody from LT to implement code-dispatch for me :-P

21:49 frozenlock: Ok this is driving me crazy... how does one replace an uppercase letter _not_ at the beginning of line?

21:50 (defn from-camel [string] (str/replace string #"[A-Z]" #(str \- (str/lower-case %))))

21:52 tomoj: frozenlock: https://github.com/flatland/useful/blob/develop/src/flatland/useful/string.clj#L22

21:53 xeqi: &(.toLowerCase "AsdaSDF")

21:53 lazybot: ⇒ "asdasdf"

21:54 frozenlock: tomoj: thanks! I should have guessed I wasn't the first to convert camel

21:57 hurmf... (dasherize "ThisIsATest") --> "this-is-atest"

22:05 tomoj: frozenlock: my attempt once: https://www.refheap.com/paste/0b91c4905a3207ab1dbc35119

22:05 caps> (lisp-case :ThisIsATest)

22:05 :this-is-a-test

22:05 caps> (lisp-case 'THIS_IS_A_TEST)

22:05 this-is-a-test

22:07 frozenlock: Wow, that's specialized

22:08 tomoj: I don't understand split-term anymore :(

22:11 frozenlock: (defn from-camel [string] (-> (str/replace string #"[A-Z]" #(str \- (str/lower-case %))) (#(str/replace % #"^-" "")))) Is dirty but it works :)

22:12 TimMc: Clojail must apply dotify after macroexpansion time, yeah?

22:18 mattmoss: I think there's clj-identifiers that has a few like that.

22:19 https://github.com/joodie/clj-identifiers

22:21 headshot: howdy

22:22 an anyone comment on leiningen? (good, bad, appears to be supported, etc)

22:23 frozenlock: headshot: leiningen is the alpha and omega

22:23 Every project starts with it, and end with it :p

22:23 headshot: okay, cool. it appeared to have great promise. didn't want to get my hopes up on a great idea, and have the devs have lost interest

22:24 frozenlock: headshot: On the contrary, technomancy just released a new version yesterday

22:25 technomancy: and a new one tomorrow; what more could you ask for? =)

22:25 hyPiRion: yeah, leiningen's blooming now.

22:25 technomancy: bloomin' crazy

22:26 xeqi: like a fox

22:27 I hear the book isn't very good though https://twitter.com/leiningenhaters

22:27 bbloom: did somebody say bloom?

22:28 amalloy: your bloom filter must be working beautifully

22:28 bbloom: amalloy: nah, there are some false positives

22:28 *zing*

22:28 amalloy: you win this round

22:28 but i'll be back with more bits

22:29 * bbloom tips hat

22:38 frozenlock: In regards to leiningenhaters twitter.. did I miss an event or something?

22:44 xeqi: frozenlock: I think some people are forced to read it in school

22:50 headshot: okay, need an opinion: lein self-install or brew?

22:52 technomancy: it's a single file, and it updates itself; brew doesn't really buy you much

22:52 frozenlock: xeqi: Oh wow! I was sure it was leiningen VS ant.... you, java stuff...

22:52 headshot: http://stackoverflow.com/questions/14281215/leiningen-install-issues-on-osx-mountain-lion

22:52 i'm experiencing this

22:53 nightfly_: Dumb question, does getting the number of items in a sorted-hash (count) require iterating through the whole structure internally?

22:53 technomancy: headshot: https://github.com/technomancy/leiningen/issues/915 or use the 2.0.0-preview10 tag

22:53 headshot: kthx

22:53 technomancy: or wait till tomorrow when RC2 comes out

22:53 tomoj: &(counted? (sorted-map))

22:53 lazybot: ⇒ true

22:53 tomoj: nightfly_: that means no

22:54 headshot: technomancy: thanks, i'll have patience and find another toy to play with tonight.

22:55 nightfly_: tomoj: Neat! thanks.

22:55 tomoj: (doc counted?)

22:55 clojurebot: "([coll]); Returns true if coll implements count in constant time"

23:11 devn: ,(counted (range))

23:11 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: counted in this context, compiling:(NO_SOURCE_PATH:0)>

23:12 devn: ,(counted? (range))

23:12 clojurebot: false

23:12 devn: ,(counted? (range 0 10))

23:12 clojurebot: false

23:13 frozenlock: If I have the choice, should I use eval or a macro?

23:14 amalloy: choosing between eval and X, the answer is generally X

23:15 frozenlock: Well that was my rule for macros :P

23:16 amalloy: heh. yes, i thought that too while answering

23:16 but it's only true when choosing between macros and functions, not macros and X

23:16 Hodapp: "You have a problem. You think, 'I know, I'll use eval!' Now you have two problems."

23:16 Sgeo: Between macros and repetitive boilerplate, you should choose macros

23:17 If you were using Tcl, eval would be a reasonable choice I think

23:18 Hodapp: The sum of my involvement with Tcl is that the Tcl website has a paper about why scripting languages are good.

23:18 and I think it's a rather good paper.

23:22 bpr: is there a canonical way to check if a value is an array? Or do I have to deal directly with java types?

23:23 amalloy: &(.isArray (class (.getBytes "sdff"))) works, or something close to it

23:23 lazybot: ⇒ true

23:23 bpr: ok, thanks

23:24 Caffeine: Is it possible to read a number as a string? I'm trying to (read) something like "01010" without the quotes. It gets read as a binary digit. I would like to get the string representation instead without having to write the quotes. Is there a read function which doesn't eval?

23:25 bbloom: Caffeine: that's not eval, it's part of the reader

23:25 Caffeine: arfff ok sorry .. read-line

23:26 bbloom: Caffeine: are you only reading an individual number?

23:26 Caffeine: yes!

23:26 bbloom: ,(Integer/parseInt "010")

23:26 clojurebot: 10

23:27 Caffeine: ok thanks!

23:40 headshot: beh, i give up

23:47 tmciver: How do I kill nrepl in emacs?

23:48 (other than (System/exit 0))

23:49 Hodapp: tmciver: you can C-x k in the buffer

23:50 tmciver: Hodapp: does that kill the server too?

23:50 Hodapp: hmmmmm, I'm not sure

23:50 it'll ask I think

23:50 tmciver: doesn't look like it

23:53 bpr: tmciver: M-x nrepl-quit

23:54 tmciver: bpr: OK, that seemed to do it - though it prompted me twice to kill a process.

23:55 bpr: hrm. you may have connected two times? I've gotten things into that state before, and had to restart emacs to fix it

23:56 in normal state it will only ask once

23:57 tmciver: bpr: yeah, I think you're right. Tried it again and it worked fine. Thanks.

23:57 bpr: tmciver: if you hit C-x k in the repl buffer, that may have corrupted the state

23:57 ok. great

23:58 tmciver: I miss swank-clojure's M-, (or whatever that was)

23:59 bpr: nrepl's got M-. :]

23:59 but, yeah that's very nice

23:59 tmciver: ah, yes.

23:59 bpr: i also miss the slime-who-calls/refrences/etc. functions

Logging service provided by n01se.net