#clojure logs

2013-01-11

00:24muhooi suspect the generous insertion of printlns will be necessary
00:25muhooi'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.
00:27tomojthere was some bug in clojurescript which caused that I think
00:27tomojdunno if that's your problem
00:28tomojI thought it had been fixed
00:30muhoooh so it's the cljs compiler then? hmm, thanks.
02:48cljhey 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)?
02:51Sgeo,(doc reductions)
02:51clojurebot"([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."
02:52Sgeo,(reductions conj [1 2 3])
02:52clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>
02:52Sgeo,(reductions conj [] [1 2 3])
02:52clojurebot([] [1] [1 2] [1 2 3])
02:52cljSgeo, thanks!
02:53SgeoYou're welcome
02:53SgeoNot sure if there's an easier way
03:10clizzinare 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)?
03:18alex_baranoskyclizzin: profiles are in your repo, so I wouldn't use them for credentials
03:29ro_stman clojurewest is looking awwwweeesome
03:33echo-arearo_st: I saw that nrepl supports binding to 0.0.0.0, so ssh tunneling is not necessary. Do you use that for security reasons?
03:34ro_stecho-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
03:34ro_sthe did only spend 5 minutes on it, though. so the method can probably improve!
03:35echo-arearo_st: See. Thanks.
03:36ro_sthow would that work?
03:36echo-areaI set up :host and :port of :repl-options in project.clj. Then I can connect directly to the server
03:37echo-area(:host "0.0.0.0", of course)
03:37ro_stsay the server is on 1.2.3.4:9999
03:37ro_stwhat would i enter into nrepl.el's connect dialog? the same?
03:37ro_stthe thing is it has to go over ssh
03:38echo-areaNot if nrepl itself listens on 0.0.0.0
05:10alex_baranoskyanyone around who's interesting in helping me think about a bug I'm seeing?
05:11alex_baranoskySomehow 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
05:12alex_baranoskyits as if the PushbackReader can only have X amount of chars copied out of it… it seems to lose any chars over some cap
05:29clgvalex_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
05:30clgvand the maintainer gets notified as well
05:30alex_baranoskyalready posted an issue, but its hard to show the test case I have, because ti is 400 lines long
05:30alex_baranoskyall you need is a 400 line namespace and that recreates the issue reliably :)
05:31ro_sta 400 line (ns) form?
05:31clgvalex_baranosky: check that thesis by just using one function def and replicate it until there ate 400 lines
05:31alex_baranoskytoo tired right now to do it, but I Could push to a fork tomorrow perhaps :)
05:32clgv*are
05:32alex_baranoskyclcv: just the namspace, not the ns form
05:32alex_baranoskyso a 400 line foo.clj file basically
05:32clgvyou meant ro_st ;)
05:32ro_stah. so here, a namespace = the file its in
05:32alex_baranoskyI 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
05:33ro_sthow many chars in the file?
05:33clgvmight be an issue with not flushing to disk?
05:33alex_baranoskydon't know exactly. What's a unix command I could run tot check?
05:34alex_baranoskywould the flushing issue then be a bug in clojure.java.io?
05:34alex_baranoskywe're using `io/copy` for this
05:34clgvhumm but the writer is in a "with-open" form that should writer everything to disk
05:35borkdudeabout 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
05:35alex_baranoskyborkdude: it'd mean that it will format addle when you call (doc foo), I think
05:36alex_baranoskycolloquy strikes again
05:36alex_baranoskyaddle = badly
05:36clgvborkdude: the identation is part of the docstring
05:36borkdudealex_baranosky for example ys
05:36clgvborkdude: aka there is no processing ahppening to the docstring when (doc ) generates the output
05:37borkdudeclgv yes, so.. hm.
05:39wei_has anyone gotten midje to work with clojurescript?
05:41alex_baranoskywei_: no
05:42ro_stwei_: there's a cljs branch but i didn't have much luck
05:42tomoj(fn [app & opts] app') bugs me
05:42ro_sti resorted to using cljsbuild crossovers for the pure model code and using midje and a jvm repl to write and test it
05:42ro_stcljs only has ui/glue in it
05:43tomojyou can write (comp #(wrap-foo % 1 2 3) wrap-bar) I guess
05:43wei_hmm, smart
05:43tomoj(the intent obviously being (-> app (wrap-foo 1 2 3) wrap-bar))
05:44wei_but I can't do that since I'm writing tests for vanilla javascript. oh well, thanks for the feedback
05:44tomojhow about (comp (foo 1 2 3) bar) and (-> app (wrap foo 1 2 3) (wrap bar)) ?
05:44tomoj(of course I forgot to reverse things in both examples)
05:44ro_stwei_: look at jay fields' expectations. it might work in cls
05:45tomoj(fn wrap ([app wrapper] (wrapper app)) ...)
05:45wei_looking now
05:46ro_stcljs*
06:09tomojinteresting.. https://www.refheap.com/paste/99bb196cc04e5bfcaef6c1098
06:12firesofmayHi, How do I include a library which is not in clojars? (And I dont want to push to clojars)?
06:12firesofmayI searched around, it says use checkout, but I am not getting how to use that.
06:12firesofmayAny pointers?
06:13Anderkent|awayfiresofmay: is it in any maven repo, or do you want to just use a jar on your filesystem?
06:13firesofmayAnderkent|away, I have the project from someones github.
06:14firesofmayAnderkent|away, it's not in any maven repo
06:14Anderkent|awayokay, checkouts are described in the tutorial: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md
06:15Anderkent|awaybasically make a checkouts directory in your project, then symlink the other projects into that directory
06:15ro_stworks beautifully
06:15Anderkent|awaythat will let you hack on it, but I don't think it will include the other project in your jars/uberjars
06:15ro_styou do have to lein install from the linked-to projects so that deps management knows about its deps
06:15ro_sts/its/their
06:16Anderkentright, I suppose if you add the other projects to your :dependencies and then do an uberjar it should be inclided
06:16Anderkent*included
06:17firesofmayAnderkent, okay let me check
06:19AnderkentI'll copy paste from #lein because maybe someone here has a better idea:
06:19AnderkentI 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
06:21ro_stoutside of my general area of knowledge, but maybe pomegranate can help?
06:26clgvAnderkent: 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
06:26ro_sttrue :-)
06:26ro_stcouldn't you grab it from dev-deps directly?
06:27AnderkentYou mean the plugins project.clj or the project config passed in during plugin invocation?
06:27AnderkentHow do I query the former?
06:27ro_stthe latter
06:28ro_stassuming end-users will depend on cloverage as a dev-time dep
06:28AnderkentWell the idea of the plugin is that you don't have to add cloverage as a dependency to your project
06:28Anderkentonly need to add the plugin to your user profile and it will work with all your projects
06:29ro_stah so you need a way to query the version specified there
06:29Anderkentwell basically whenever I release new cloverage I have to go into plugin sources and update that hard coded version, which seems suboptimal
06:33ro_stping technomancy. he can probably help
06:44clgvAnderkent: ah so you want only one plugin release and that should pull in the newest release of the lib in the ideal case
06:44Anderkentideally, yes
06:45clgvAnderkent: lein-outdated does something like that. you can have a look how it determines the latest version of a lib
06:45Anderkentbut I suppose I'll just move that to a properties file and have a script that updates it on each lib release
06:45Anderkentoh, nice, thanks.
06:47clgvAnderkent: 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
06:48Anderkentdon't need pomegranate, since all *I* do is add an entry to the project clj - lein handles fetching the actual dependnecy
06:48Anderkentbut yeah, thanks for the outdated pointer
06:48clgvah right. then the last version is the simplest I guess
07:01Anderkentclgv: 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 :(
07:02clgvAnderkent: well then take the last approach. static permanent file that contains the latest release version (might be hosted on your projects github
07:03clgvAnderkent: for consistency you libraries project.clj can read its version from that file as well
07:04Anderkenteh, I'll rather just grab the maven-metadata.xml from releases.clojars.org/repo/... Just need to parse the xml.
07:06clgvthats in principle what lein outdated does as well but it includes maven which might be the reason for the longer duration
07:06clgvthe maven repo I mean
07:06AnderkentI think the reason is that it tries to index the entire repo instead of fetching just one artifact
07:06Anderkentso in theory i should be able to do this quicker
07:06clgvah right both^^
07:07clgvbut couldn you reuse the download and parsing ability?
07:07Anderkentyeah I'm thinking right now of just using the apache.maven.index directly, if it does what I want
07:10Bronsahow's this function called? f(λ(x,y)) => λ(y,x)
07:13cljis there any inbuilt function which would return the first element in a list matching a predicate?
07:14oliverrohttp://clojuredocs.org/clojure_core/clojure.core/some
07:14Bronsasome returns a boolean
07:14Anderkentsome returns what the predicate returns
07:15Bronsaright
07:15cljyeah, I'm looking for something which returns the element
07:15Bronsa(comp first filter)
07:15cljBronsa: that would be lazily computed, right?
07:15Bronsayep
07:15cljnice, thanks :)
07:17Anderkentclgv: following up on my issue: mvn (and lein) has a "RELEASE" version keyword
07:17Anderkentso there's the proper way to do what i want.
07:19cljand the best way to get an infinite sequence of say, n, n + 1, n + 2... ?
07:20Bronsarange
07:20Bronsa,(take 4 (range 8))
07:20clojurebot(0 1 2 3)
07:20Bronsaew
07:21Bronsa,(take 4 (range 8 Double/POSITIVE_INFINITY))
07:21clojurebot(8 9 10 11)
07:21Bronsa,(take 4 (iterate inc 8))
07:21clojurebot(8 9 10 11)
07:21Bronsabetter
07:21cljiterate inc is nice! :)
07:27clojure-newbhi 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 ?
07:28clojure-newbI 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
07:29clojure-newbsorry, I meant to post that in the datomic group
07:47augustlwhat's the word we use instead of persistence for putting stuff on disk again? :)
07:57ejacksonaugustl: durable, i think :)
07:58augustlah
07:58augustlhow is that better? >< It also has two meanings!
07:58augustloh well
07:59ejacksonits just that persisent crashes with persistent data structures
07:59ejacksonwhich is a core clojure concept
07:59ejacksonas far as i know
08:26cljwhat'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 :)
08:27clgvclj: doesnt your clojure vim ide provide that?
08:29cljI'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.
08:29cljso that probably won't work
08:34cmdrdatsclj: https://github.com/bbatsov/clojure-style-guide
08:34cmdrdatsclj: i find that style guide pretty solid
08:36cljcmdrdats: hmm, but there isn't an auto formatter for this I think?
08:36cmdrdatsclj: oh, you mean an actual tool that styles it for you? just use emacs or, i'm guessing vimclojure does the same
08:37cmdrdatsclj: I'm haven't tried writing clojure in vim
08:37cljcmdrdats: yes. I don't think vimclojure has a complete formatter.
08:37HodappI have. Was not a fan.
08:37HodappThings just kept breaking.
08:37cljcmdrdats: can emacs format one long line of code into multiple lines?
08:38cmdrdatshmm, i think i've seen that - but you end up doing it by hand
08:38cmdrdatsbecause it can't possibly decide on the best style
08:38AnderkentI'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
08:40cmdrdatsclj: I find the process is a bit like crafting your functions
08:40cmdrdatsclj: start off a bit ugly, then refine it to look nice
08:40cmdrdatsdiscover a better way of expressing the function and refine it again
08:40cljcmdrdats: I think you're right. Vim does format it well after I break it into lines.
08:42cmdrdatsclj: cool :)
08:45ciphergothDoes a Compojure middleware thing for nicely logging exceptions exist?
08:47ro_stwe use https://www.refheap.com/paste/8362
08:48RaynesI need to add a way to stay refheap pastes or something.
08:48RaynesI bet people would use it for Clojure snippets.
08:48Raynesstar*
08:49ro_st+1!
08:49cmdrdatsRaynes: especially if you can star and title them
08:50Raynestitling 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.
08:50cmdrdatstrue
08:50augustlgeneral 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
08:58cmdrdatsaugustl: sounds like a common use case to me
09:00cmdrdatsaugustl: we use two flavours of that - classic RPC, where the component A's thread waits for a response
09:00ejacksonyeah, queues are your friend
09:00cmdrdatsaugustl: and where another part of component A is continuously chomping off the response queue asynchronously
09:02augustlcmdrdats, ejackson: thanks :)
09:02cmdrdatsaugustl: anytime :)
09:02augustlyou typically do this with two queues, right? One for requests, and one for replies?
09:03cmdrdatsaugustl: definitely
09:03cmdrdatsqueues are cheap, use them abundantly
09:04cmdrdatsgenerally though, make a queue have a single, simple job
09:05augustlcmdrdats: 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
09:05augustlevents that map 1:1 with business logic is pain.. Generally, the listener of the event should be where the business logic lies
09:10ciphergothOK 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!
09:18AnderkentIs there lein-release for lein2?
09:30shafireHi
09:30shafireLast time I checked clojure out is 2 years ago
09:31shafireIs Intellij IDEA as IDE for clojure the right choice?
09:31AnderkentI believe it has some plugins for it, but heard that refactoring is very buggy
09:32Anderkentthe common alternatives are emacs+slime, vim+vimclojure/slimv, or eclipse + counterclockwise
09:34shafireThank you, Anderkent
09:34ro_stor emacs + nrepl.el
09:35ro_stminimal config for clj nrepl.el in emacs work: https://github.com/robert-stuttaford/.emacs.d
09:36ro_stthe disadvantage is that you have to learn some emacs (and therefore emacs lisp)
09:36clgv+1 for counterclockwise
09:36cmdrdatsmeh, i think we need to start a campaign against this notion that "emacs is hard"
09:37ro_stbut it is hard. there's no denying it
09:37ro_stwhen you're used to the visual studio way of thinking, it's a considerable mindset change. and that's hard
09:37ro_stwe can do things to make it easy, but you still have to go through it
09:37cmdrdatsah. I guess.. it's simple though!
09:38ro_stindeed it is :-)
09:38cmdrdats(to a degree)
09:38ro_stespecially if you don't look under the hood once you're productive
09:38Anderkentemacs is hard on your fingers
09:38Anderkent;)
09:39ejacksonAnderkent: get a pedal :P
09:39ro_stor remap capslock
09:39cmdrdatsooh - a pedal… why didn't I think of that.
09:39p_lAnderkent: because you don't know how to use it. Or have shitty keyboard (the latter is common these days)
09:39ejacksonro_st, +1, first move.
09:39Anderkentp_l: I was kidding. I don't really use emacs
09:39p_lejackson: actually, remapping caps lock would be more of a ViM thing ;)
09:40p_lthough I do use remapped caps lock
09:40ejacksonp_l: I use the remapped capslock specifically for emacs. C- is so common
09:41ejacksonbut then I use a Kinesis, so all bets are off
09:41p_lejackson: emacs modifier key use was designed for both-handed input
09:41p_lwith the hand opposite to the "normal" key being used to hit the modifiers
09:42ejacksonbut for the space kadet keyboard, not 101 AFAIK
09:42p_leven 101
09:42ejacksonanyway, do whatever works for you
09:42p_lit's the Unix keyboards that had only one Control :)
09:42ejacksoni did not know that
09:43p_lejackson: iirc the keyboard used with VAX-connected terminals (where Vi was born) had only one Control, located where PC has caps lock
09:44p_lMIT keyboards had rubout (backspace/delete) in the same place
09:44ejacksonhm, live and learn.
09:45p_lof course, modern laptops no longer have any usable keyboard layout :/
09:45p_lwith thinkpads finally dying
10:19alexnixonI 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:20alexnixonI assume it can't be just myself with this problem - has anyone else run into/solved this problem?
10:21Anderkentother than excluding things I don't have any idea
10:23alexnixonyeah 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:24alexnixonif a library isn't backwards compatible then you still end up in a mess
10:24Anderkentdon't think that problem is solvable, if two libraries depend on different versions of a shared library you can't use them together
10:26alexnixon...unless you can come up with a way of loading multiple versions of the same library at once
10:29AnderkentThat would require some advanced java classloader hackery i'm not up to thinking about
10:30sabermanthis is why OSGI was developed, and it's a different kind of hell
10:31alexnixonI know nothing about OSGI
10:33HodappJava web services are an interesting mix of "pretty neat" and "jesus christ, what the fuck"
10:34Hodappon 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:35Hodappon 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:37alexnixonI can imagine
10:37Hodappthe specs are just so damn complex
10:38alexnixonthough 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:38Hodappand 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:39Hodappend 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:40nDuffalexnixon / Anderkent: That classloader hackery exists.
10:40djwonkpprint isn't working the same for me in 1.5 as it did in 1.4 -- at least not from nrepl
10:40nDuffWitness OSGi
10:40nDuff...though it doesn't play well with Clojure
10:40djwonkcould anyone confirm / deny that pprint may have changed somehow in 1.5 vs 1.4?
10:41nDuff(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:41SgeoMaybe there are better runtimes for Clojure >.>
10:41nDuffalexnixon: ...but yes, isolating transitive dependencies is exactly what OSGi is intended/used for.
10:41clgvalexnixon, Anderkent: you could use classlojure for the classloader trickery
10:42jkkrameralexnixon: are you actually experiencing problems or just concerned about its latent potential?
10:42TimMcp_l: What's this about Thinkpads dying? D-:
10:42alexnixonjkkramer: I have problems
10:42alexnixonjkkramer: and a colleague also
10:42nDuffalexnixon: Are those problems surrounding Java libraries, or Clojure libraries?
10:43Anderkentclgv: 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:44nDuff...mmm; shiny. Didn't know that existed.
10:44alexnixonclojure 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:44nDuffalexnixon: ...well, classlojure looks pretty precisely on-point for that.
10:45alexnixonnDuff: it looks like a solid base, but I don't want to be doing this manually
10:46clgvalexnixon: 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:46Anderkentor just push your own version to clojars if they don't want to pull it in, and depend on that
10:46alexnixonclgv: sure, with a bit a of pain I can dig myself out of the hole
10:47alexnixonclgv: 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:48clgvalexnixon: but you wont find a language where you dont get that problem I suppose
10:49llasramOr if there is such a language, I would very much like to know about it :-)
10:49TimMcIf A uses B behind the scenes, sure, a different classloader would work. But if A exposes objects that B creates -- problem.
10:50TimMc(Note: Not the same B as alexnixon's.)
10:50alexnixonyeah it's a hard problem - I guess I'd just been blissfully unaware of what a fragile state my code was in
10:50AnderkentTimMc: 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:50jkkramerthe only time I've had issues so far (fingers crossed) is with unstable internal libs, which was kind of my own fault
10:51alexnixonand when this does bite you, it does it in horribly obscure ways
10:55alexnixonI 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:56djwonkwhen 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:57jkkramerdjwonk: are you using CCW?
10:57djwonkjkkramer nrepl
10:58djwonkI made sure to clean out my targets too before restarting the lein repl
10:59djwonkI wonder if something in the namespacing changed?
10:59jkkramerdjwonk: the auto-referring was causing issues under certain scenarios - e.g., if you have a function named "doc" or "source"
10:59jkkramerdjwonk: https://github.com/clojure/clojure/commit/728972b026a323fc941a5d560b81d37453dc6cad
10:59TimMcAnderkent: 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:03djwonkjkkramer: thanks! so, after looking that over I would hope that nrepl would still work fine
11:04djwonkjkkramer: and, in a fresh project, it does. so something in my current project is different and mucking it up I suppose
11:05jkkramerdjwonk: the fresh project is using 1.5 also?
11:05djwonkjkkramer: yes.
11:05djwonkjkkramer: so here is what I have noticed. in the user namespace, all works fine
11:06djwonkwhen I go into another, I lose doc. is that what you think was intended?
11:06jkkramerI think so
11:07djwonkso if I need to do work in the repl in a new namespace, I'll do (apply require repl-requires)
11:07jkkrameror (clojure.repl/doc …)
11:08djwonksure. but I'm in the REPL for a reason :) typing doc is the way to go
11:08jkkrameror use your favorite tool's shortcut for docs
11:09djwonkjkkramer: thanks for pointing that out. i thought I was crazy for a minute
11:16john3452g'day
11:18john3452Having 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:19john3452so unfortunately, when I try to zipmap the headers to each key, those rows that are too short obviously don't map correctly
11:19S11001001john3452: different csv libs have different options and do different things
11:19john3452does anyone know of a particular csv library that will allow me to get back empty strings for empty fields?
11:20john3452clojure-csv does not
11:34djwonkjkkramer: if you have any additional ideas, I created a question here: http://stackoverflow.com/questions/14282109/missing-doc-in-non-user-namespaces
11:58JulioBarrosFYI 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:07weavejesterJulioBarros: Should be fixed
12:13john3452uuuhmm.. It would appear as though I was wrong about clojure-csv
12:13john3452and empty cells return ""
12:13john3452so nevermind!
12:13JulioBarrosweavejester Thanks. Was just trying to figure out who and how to let someone know.
12:14weavejesterJulioBarros: Just to check, you meant "lein new compojure foo" right?
12:14weavejesterJulioBarros: As in that's the outdated template
12:14JulioBarrosExactly. Then lein ring run and it would complain about vector?
12:14JulioBarrosvector? in leinjacker ....
12:14weavejesterJulioBarros: Yeah. It was an outdated version of leinjacker to blame
13:03peatHey 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:05ravsterhello all
13:21augustltried 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:22nopolabsneed to run it once in an existing project to prime dependencies, known problem, they are working on it
13:22augustlah
13:22augustlRC is RC :)
13:23john3452I'm trying to use Raynes' fs utility
13:23john3452having confusion with dependencies
13:24john3452in project.clj, I have [fs "1.3.3"]
13:24john3452my understanding is that needs no other pre-text, like fs/fs or anything... and lein deps does not return an error
13:25john3452however, in my core.clj, doing a (require '[fs.fs :refer :all]) tells me that fs__init.class cannot be found, etc.
13:25ibdknoxit's fs.core
13:25john3452there is an fs jar in my lib directory
13:26john3452ah
13:26TimMcjohn3452: group/artifact coordinates are independent of namespaces :-)
13:26TimMcFor better or worse.
13:26TimMcI still can't believe he named it "fs".
13:26john3452right... 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:27TimMcjohn3452: A well-written readme will tell you both the lein dependency vector and the main API namespace.
13:27john3452aye
13:27TimMcIf all you have is a jar file... dig in. :-/
13:29pmonksRelated: is there any way to determine the list of available namespaces, *without* requiring/using them first?
13:29pmonksOr do they have to be explicitly require'd / use'd before they're "known" to Clojure?
13:30augustlfavorite part of lein 2 rc1 is that the unencrypted auth config in ~/.lein is no longer deprecated :)
13:31augustlgot that annoying deprecation message all the time..
13:32tpopecemerick: 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:34cemericktpope: yes
13:35tpope\o/
13:40TimMcpmonks: `tree .` :-P
13:40TimMcaugustl: I guess it was reprecated.
13:40john3452is there a prefered way to do a def from within a defn? Like a make-var or something?
13:41TimMcYou don't want to.
13:41augustljohn3452: dynamic vars or with-redefs I'd say
13:42TimMcjohn3452: What's the use-case?
13:43john3452well, 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:44john3452its a little messy, having to run the external executable
13:44dakronestuartsierra: ping
13:44stuartsierrapong
13:44john3452as I really don't care about the intermediate csv file. I just want to get the data into memory
13:46dakronestuartsierra: you haven't responded to https://github.com/dakrone/clj-http/issues/111 yet, is the fix working for you?
13:47stuartsierraI'm just avoiding redirects for now, but thanks for responding.
13:49dakroneokay? I'll leave it open until you can try it again or a few weeks go by
13:49stuartsierraSorry, this was for a client project and I've already moved on.
13:53stuartsierraLooks OK though.
13:53technomancypmonks: the bultitude lib does that
13:54technomancynothing in clojure itself
13:54augustlTimMc: hehe, never heard the word reprecated before :)
13:54pmonksThank guys
13:55pmonkss/Thank/Thanks
13:57dnolentechnomancy: when I try to upgrade to lein 2.0 rc1, it tries to fetch https://github.com/technomancy/leiningen/raw/'preview'/bin/lein
13:57dnolentechnomancy: note the quotes in the url
13:58technomancydnolen: ouch; thanks
14:04ppppaulhow do i stop a jetty server from the repl? (launched in the repl via ring/run-jetty
14:05technomancyppppaul: you have to save the return value of run-jetty and call .stop on it
14:06ppppauloh
14:07ppppaulthanks
14:07technomancyI usually have a ;; (def s (-main)) at the bottom of my main.clj files
14:08ppppaulthat's what i just did
14:08ppppauli'm wondering how to kill my server now
14:15jvyashearing alot about the hammock dev thingy. its this week huh
14:16frozenlockhrm... 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:16tmciverppppaul: (.stop s)?
14:18amalloyjohn3452: every def is in the global scope
14:18TimMcjohn3452: None of that sounds like mucking with dynamic vars is appropriate in the slightest.
14:18amalloyif you want something local, use let
14:18technomancyTimMc: does this make sense to you? https://github.com/technomancy/leiningen/issues/920
14:19TimMcDidn't do it!
14:19TimMcI'll try to reproduce it.
14:21nDuffjohn3452: maybe you want let
14:21nDuffjohn3452: ...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:22TimMcpastebin: http://refheap.com/
14:22nDuffor ideone.com
14:22nDuffthough the latter isn't so useful in cases like the current one (where your code is interacting with external files/executables)
14:26technomancyTimMc: I just merged newnew to leiningen itself
14:26technomancybut fixing it either place would work
14:26TimMcoh god windows
14:27technomancyTimMc: I don't get how you can get that exception out of clojure.string/replace
14:29TimMcCould it have to do with java.io.File/separator being a blackslash?
14:29TimMc*backslash
14:30ppppauli'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:30john3452nDuff: I ended up going with a let. Thanks!
14:31technomancyTimMc: yeah, looks like it needs to be a double backslash? which as a string literal is a quadruple?
14:31sandbagsanyone using LaClojure: can confirm that println ought to appear in the console area where you see the java command being output?
14:32technomancycrazytown
14:32technomancyTimMc: ok, I got a fix
14:33TimMc&(clojure.string/replace "foobar" #"\." "\\")
14:33lazybot⇒ "foobar"
14:33TimMc&(clojure.string/replace "foo.core" #"\." "\\")
14:33lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 1
14:33technomancyayup
14:33TimMcloveliness
14:33technomancypushed a fix and it's ridiculous
14:33TimMc&(clojure.string/replace "foo.core" #"\." (java.util.regex.Pattern/quote "\\")) ;; nooope
14:33lazybot⇒ "fooQ\\Ecore"
14:34TimMc,(doc clojure.string/replace)
14:34clojurebot"([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:34TimMc&(clojure.string/replace "foo.core" \. \\)
14:34lazybot⇒ "foo\\core"
14:34TimMctechnomancy: ^ works
14:35TimMc&(clojure.string/replace "foo.core" "." "\\")
14:35lazybot⇒ "foo\\core"
14:35TimMc^ rather
14:35technomancyhuh; that's a bit nicer than "\\\\"
14:35technomancythanks for checking it out
14:35TimMcalso it's generic
14:36TimMcSo if you're using some crazy-ass OS that uses newlines as path separators, you're good.
14:37ppppaullein ring server-headless isn't reloading when my files change
14:38amalloyTimMc: technomancy: ##(clojure.string/replace "foo.core" #"\." (java.util.regex.Pattern/quoteReplacement "\\"))
14:38lazybotjava.lang.IllegalArgumentException: No matching method: quoteReplacement
14:38amalloyer
14:39amalloy&(clojure.string/replace "foo.core" #"\." (java.util.regex.Matcher/quoteReplacement "\\"))
14:39lazybot⇒ "foo\\core"
14:39p_lTimMc: 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:39amalloyiirc though, clojure 1.5 makes that quoteReplacement behavior become the default so you might want to be careful. i'm not sure
14:39technomancyp_l: resisting the urge to rant about screen resolution in the X series
14:39technomancybut it's hard
14:40p_ltechnomancy: yeah
14:40technomancythe fact that old thinkpads last forever and are easy to repair makes it more bearable
14:40tpopemy old thinkpad recently died and I didn't know what to buy :/
14:40technomancythere's a guy in #emacs who lives on a sailboat and hacks CL on a pair of X41s
14:40tpopeended up doing a W series :/ :/
14:40p_lbut 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:40p_ltechnomancy: ...drewc?
14:40technomancyp_l: the response mechanism hasn't changed though has it?
14:40technomancyyeah drewc
14:41TimMcp_l: Haven't seen it. Don't want to. :-(
14:41chrstphrhrtanyone 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:41TimMcThey finally added a way to switch Ctrl and Fn in teh BIOS, so R-Ctrl is back to its rightful place...
14:42technomancyTimMc: the corner is the wrong place
14:42technomancydon't be silly
14:42TimMcp_l: And I did have to yank out some keys they put around the arrow keys...
14:42technomancyctrl goes next to A
14:42p_lTimMc: without the pure awesomeness that was full keyboard (with 4-grouped F-keys!), and lack of power... >_>
14:42TimMctechnomancy: Don't worry, I also remapped CapsLock.
14:43p_ltechnomancy: not necessarily, at least for emacs. OTOH, proper emacs keyboard requires mirrored modifiers so you can use your thumbs for them
14:44seangrovechrstphrhrt: 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:46chrstphrhrtseangrove: 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:46TimMc...the fuck did they do with PgUp and PgDn?
14:47amalloychrstphrhrt: 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:48chrstphrhrtamalloy: thanks yeah that expression makes perfect sense
14:48chrstphrhrti guess what seems confusing about "loop [n n…" syntax is really a matter of "where's my operator?"
14:48amalloy*shrug* it's just where it is in a while loop: inside
14:48mattmossGive 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:49TimMcmattmoss: So, carry that keyboard with you, or what?
14:49mattmossNot yet.
14:49loganlinnif i cons onto a lazy seq, does the seq get realized?
14:49chrstphrhrtamalloy: well, usually a while loop has some condition like (x > 4)… but "[n n…" why two n ?
14:49amalloyloganlinn: try it and see
14:50amalloychrstphrhrt: (loop [x y] (...)) is very much like ((fn [x] (...)) y)
14:50amalloyit's (sorta) shorthand for an anonymous recursive function, which of course has no termination conditions
14:51amalloythe body of the function itself decides what to do, including whether to keep going
14:51chrstphrhrtamalloy: OHH now i get it. jeez.. was just the repeated arguments that threw me off
14:51chrstphrhrtthanks!
14:53loganlinnactually, i dont think it should… otherwise idioms like, (cons n (lazy-seq (inc n)) wouldn't be lazy, right?
14:54amalloywell, that particular formulation of the idiom is a classcastexception :P
14:54hiredmananything inside a lazy-seq is lazy, anything outside is not
14:54hiredmancons will not force a lazy seq, but cons is not lazy
14:54TimMc&(cons 3 (range))
14:54lazybotjava.lang.OutOfMemoryError: Java heap space
14:55TimMc&(take 5 (cons 3 (range)))
14:55lazybot⇒ (3 0 1 2 3)
14:55hiredman(lazy-seq (cons … …)) is lazy
14:58TimMcp_l: When my current Thinkpad breaks, I'm just gonna quit programming and become a farmer.
14:59technomancyTimMc: just stock up on spares while they're still available on ebay/craigsist
15:04p_ltechnomancy: the problem is when the thinkpad you have doesn't have the power nor mobility potential
15:05p_lI 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:05TimMcI had a Clevo. It did not end well.
15:06TimMcAll sorts of little pieces falling off...
15:06TimMcand the screen failed after a few years.
15:12p_lTimMc: well, depends exactly what kind (and who assembled it)
15:12p_lEurocom tends to do a quality job
15:13p_l(A big part of their market is engineers/scientists/hi-end content creation etc.)
15:18sandbagsi realise not using emacs maybe puts me at a disadvantage but is using IntelliJ & LaClojure regarded as ghetto Clojure?
15:18technomancysandbags: it's certainly behind CCW from what I can tell
15:19sandbagsi'm a sometime Vim user also
15:19sandbagsnot really looked into the Vim options yet
15:19ibdknoxsandbags: just used vim
15:19ibdknoxuse*
15:19sandbagsi use AppCode for Objective-C so Intellij&LaClojure seemed a reasonable option
15:19sandbagsibdknox: how's editing support there? does it handle indentation well?
15:19sandbagsnDuff: i can't get on with emacs (i have tried, more than once)
15:20amalloyagreed, use vim if you like it
15:20ibdknoxsandbags: yes
15:20ravsterhow do I solve a 'REPL server launch timout' when I do a 'lein repl'?
15:20sandbagsibdknox: is there a best link for getting started with Vim & Clojure? A quick google seems to turn up quite a lot of hits
15:21amalloysandbags: foreplay is supposed to be good; i'm not sure if that's instead of, or in addition to, vimclojure
15:21sandbagsamalloy: ah a tim pope production, that sounds hopeful
15:21sandbagsthanks
15:22sandbagsseems like it goes with VimClojure to provide editing support
15:22sandbagslooks like i'm good to go, thanks :)
15:25edtsechsandbags: guide for VimClojure http://clojure-doc.org/articles/tutorials/vim.html
15:30sandbagsedtsech: ta
16:06TimMcI'm trying to build org.clojure/java.classpath -- what's the magic incantation?
16:06TimMcIt appears to use Mavne.
16:06TimMc*Maven
16:06tomojlikely `mvn install`
16:08amalloymvn package would work too if you don't want it installed
16:08TimMcI guess I can always remove it from my m2 afterwards...
16:08TimMcamalloy: Thanks, that seems to do it.
16:09sandbagsanyone here used foreplay.vim?
16:09tomojoh, I always vaguely wondered why I was installing when I just wanted to build
16:09clojurebotCool story bro.
16:11bbloomtpope: the location list is frickin brilliant.
16:13sandbagshrmmm... cq just went bang... took MacVim with it (and no crash report either which is odd)
16:13sandbagsnot sure if this is because I'm using MacVim rather than regular Vim
16:15bbloomsandbags: i think macvim reports it's crashes a little differently than regular vim
16:15bbloomputs them in ~/Library or something mac-like
16:15sandbagsbbloom: oh it circumvents the usual crash reporter? odd choice
16:16bbloomsandbags: well vim runs on non-osx platforms and provides vim-specific dump information
16:16sandbagsah
16:16sandbagsgood point
16:16bbloomso i dunno if they explicitly turn off the mac crash reporter
16:16bbloomor simply recover before osx ever sees the error and then writes to file
16:16sandbagsoccasionally an app does die with no crash report but its usually a bad sign when that happens
16:17sandbagsfor some value of bad sign, e.g. "ominous portent" etc..
16:17bbloomi have no idea, i'm just kinda making wild-ass guesses
16:17sandbagswell i guess tpope's not going to be debugging my vim dumps files :)
16:18bbloomno, but somebody over in #vim might
16:18bbloom:-P
16:18sandbagsi'm not clear if foreplay.vim is prime time or something he's still hacking on
16:18bbloomor, presumably #macvim exists
16:18bbloomi've been using foreplay for full time clojure work since he released it
16:18sandbagshrmmm
16:18bbloomit's been rock solid for me
16:19sandbagsso 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:20sandbagsi'm guessing even if i did something wrong vim shouldn't have exited stage left
16:22TimMcI 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:23TimMcThis is for the java.classpath contrib, mind you, not clojure core.
16:24dnolenTimMc: yeah the project lead should get an email.
16:24TimMcOK, great.
16:35ibdknoxbbloom: what does the location list give you?
16:36bbloomibdknox: if an evaluation causes an exception, :lopen will give you the stack trace in the location list
16:36bbloomibdknox: so you can read the stack trace & jump to the line that failed
16:37bbloomand then navigate around the stack
16:37ibdknoxcool
16:37ibdknoxI just did something similar for LT the other day :)
16:38bbloomit's pretty useful, but i don't rely on stack traces that much, i much prefer tracing output
16:38bbloomonly inserting random print lines gets messy
16:38bbloomluckily, 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:39bbloombut 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:39bbloomie the further back in time, the less information it keeps
16:39bbloombut closer to NOW it would keep every single value at every single step
16:39bbloomwith persistent/immutable data structures, that'd be crazy useful and reasonably memory efficient
16:40ibdknoxsounds like a slight augmentation to the instarepl :)
16:40TimMclog log
16:40bbloomibdknox: well then what are you waiting for? :-)
16:40ibdknoxhaha more hands :p
16:41Raynesibdknox: When are you going to have people? Haven't you been hiring forever?
16:41bbloomRaynes: hiring is crazy fucking hard.
16:41RaynesSure, but I would have expected *someone* to get a job there by now.
16:41ibdknoxRaynes: especially hard for what we're doing
16:42TimMcThe company I work at has been looking for a web dev for like 6 months now.
16:42TimMcA *web dev*.
16:42bbloomheh
16:42ibdknoxRaynes: I have two potentials, but going after the best takes time
16:43nDuff...happily and busily employed right now, but planning to move up that way in a year or so.
16:45ibdknoxRaynes: 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:45TimMcnDuff: OfficeMax tried to recruit me to that area. Why would I leave the Boston area for the Chicago area? *Why?*
16:46TimMcRaynes: 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:46bbloomtpope: 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:47nDuffTimMc: *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:48TimMcThose are both some pretty good reasons.
16:48nDuff(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:48TimMcanhidrosis?
16:49nDuff...as a side effect of spina bifida, yes.
16:49TimMcThat would *suck*.
16:49TimMcOf course, I grew up in Virginia, where the humidity is so high that sweating doesn't help anyway.
16:57jweissone 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:58jweissi could write a validator function, but seems like overkill at runtime to keep calling it.
16:58jweisswhere should the 'canonical schema' (if you will) be kept?
16:59bbloomjweiss: you don't need to call the validator at runtime all the time
17:00bbloomjweiss: you can insert calls to it where you need them during development, or assert the subets of the data individual functions depend on
17:00amalloyjweiss: 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:00amalloythat 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:01jweissamalloy: yeah, i'd end up with a lot of functions like (def result :result)
17:01snowylikesorry to bust in, but when i read the part about data structures, it blew my mind
17:01frozenlockIs there a built-in variable in nrepl.el to prevent the popup window on error?
17:03jweissbbloom: 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:04jweissi 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:04bbloomjweiss: the problem is that the solution is often very domain specific
17:04bbloombut the simplest and most general solution is a single global validator function
17:04TimMcsnowylike: ...how so?
17:04bbloomthe other sort of approach is to serialize your data structure to html or something so you can visually inspect it
17:05bbloomsee the Thinking In Data talk by stuart siera for an example of that with a poker game
17:05snowylikeTimMc: I was 17 at the time, maybe 18, and i'm more a mathematician than a programmer
17:05bbloomjweiss: alternatively, there is some ongoing work for a schema system
17:05snowylikehadn't programmed much up until then
17:05bbloomwhich would basically just be a declarative bag of predicates that could give you a sensible collection of validation errors
17:05bbloomas opposed to throwing an assertion on the first error
17:06TimMcsnowylike: But what part of it blew your mind?
17:07snowylikei'd read about OOP and things like that before, but never quite saw the point in it
17:07amalloyneither have most OOP programmers
17:07TimMcAh, I see.
17:07callenI...am going to dissent here. This is *some* value in OOP.
17:07callenno one approach wins the whole treasure chest.
17:07amalloythat's not dissent at all?
17:08callenamalloy: I am dissenting from the silent majority that is #clojure
17:08snowylikei, personally, don't think OOP in itself is bad
17:08snowylikejust some vocal subset
17:08amalloyi 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:08snowylike(of the users, i should add)
17:10jweissbbloom: 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:11bbloomjweiss: if all you care about is that it has the right keys, (= (keys prototype) themap) would do the trick :-P
17:11jweissbbloom: i care about more than that,but that is probably the first thing the validator will check.
17:18justin_smithI 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:19technomancyjustin_smith: how can you not have control of versioning in deployment?
17:19justin_smithbecause someone else admin's the machine
17:19justin_smithparanoid client
17:19technomancyyou don't need admin access
17:19technomancynothing in Clojure is installed system-wide except possibly lein itself
17:19justin_smiththey ask for source. They write the compilation script
17:20justin_smithwe provide a pom.xml, they refuse to run lein
17:20technomancyok, still with a pom it doesn't matter
17:20technomancyyou don't need admin access
17:21justin_smithso 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:21technomancywhatever you put in project.clj will come out in pom.xml
17:22technomancyplus transitive dependencies will be pulled in of course
17:22justin_smiththe 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:22justin_smithn/m sorry for the noise
17:26TimMc$latest clojure.data.json
17:26lazybotNo project by this name exists on clojars.
17:27TimMc$latest org.clojure/data.json
17:27lazybotNo project by this name exists on clojars.
17:27TimMcUgh, right -- I need to check central.
17:27TimMc0.2.1 -- yeah, I wouldn't rely on that having a stable API
17:29justin_smithyeah, 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:29justin_smithor how to force it to update and upgrade all our code to the new namespace
17:29technomancyjustin_smith: if you get lein2 you can do `lein deps :tree` to see where transitive deps come from
17:29TimMcDo you rely on a SNAPSHOT version of anything?
17:29technomancymakes it a lot easier to debug things like this
17:30technomancyalso relevant: http://nelsonmorris.net/2012/07/31/do-not-use-version-ranges-in-project-clj.html
17:31justin_smithlet me double check on the SNAPSHOT thing
17:31justin_smithnot directly, but some library may be suspect...
17:32justin_smithyeah, it is probably because of one of our in house libs requiring a SNAPSHOT, thanks for the tip
17:34TimMcThat'll do it.
17:37estebannI 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:38eggheadgosh, core.logic is so nice -- I just wrote a simple ~remove member~ relation, think I'm getting the hang of this :)
17:38eggheadhttps://www.refheap.com/paste/8391
17:40TimMcestebann: lein should be fetching your dependencies for you when your plugin is used.
17:40eggheadlooking 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:40eggheadsometimes it just seems like the right name...
17:40estebannTimMc: is there anything I need to do to make that happen?
17:41estebannbecause right now, its not
17:41TimMcNo, it should just work. Got public source I can look at?
17:41estebannhmmm... not sure. I'll ask
17:43TimMcestebann: Even a project.clj with faked strings might turn up some clues.
17:44technomancyestebann: have you read doc/PLUGINS.md?
17:46estebanntechnomancy: not completely, ... I loook there again
17:48estebannTimMc: it's a little proguard helper plugin project.clj is here http://pastebin.com/MpFt2rw3
17:49estebannnDuff: what's preferred?
17:50nDuffestebann: refheap.com is ideal
17:50nDuffestebann: ...but anything that's not full of annoying ads is at least good enough to avoid snark.
17:50estebannok, i'll use that in the future
17:51nDuff(refheap.com -> maintained by Raynes, so it's not far to go to complain if anything breaks)
17:57RaynesBut nobody ever complains because I'm cool like that. Right nDuff? RIGHT?
18:00clojure-newbhey guys, anyone know how to compose transformations in a defdocument with laser ?
18:01clojure-newbI see an example '((comp (l/classes "foo") (l/id "bar"))' but I'm having trouble translating this across to a defdocument
18:01RaynesRaynes might know.
18:02RaynesI'll ask me.
18:02Raynesclojure-newb: comp should work fine. Can you show a piece of problem code?
18:02clojure-newbRaynes… does Ryanes know ?
18:02clojure-newb:-)
18:02eggheadugh, I hate projects like laser where you can never get a hold of the author
18:02eggheadabandonware
18:03RaynesIt's ridiculous, egghead.
18:03clojure-newbI guess I'm having problem applying two transformations against two selectors
18:03clojure-newbin my case just putting some data in a ul, and writing a text val into a div
18:04RaynesDo you have an example you can show?
18:05eggheadhttp://clojurewest.org/sessions some nice stuff here, looking forward to bbloom's talk
18:05eggheadsome of the stuff, like stuart halloways talk on simulation testing is such a tease
18:05bbloomegghead: i'm also looking forward to my talk.... i've got to go write it :-)
18:05egghead"This talk will introduce simulation testing, walking through a complete example using Simulant, an open-source simulation library." -- open source? -- WHERE
18:08Raynesyogthos: technomancy inlined lein-newnew in leiningen itself.
18:08Raynesyogthos: Just a heads up so you know where to look now.
18:08bbloomis there a refer-as type construct?
18:09callenRaynes: he annexed it. LIKE SIE GERMANS
18:09bbloomi can refer to a namespace :as something, but can i refer to a function :as something?
18:10amalloy&(doc refer)
18:10lazybot⇒ "([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:11clojure-newbRaynes: 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:11bbloomahhh rename
18:11bbloomgot it
18:11bbloomthanks amalloy
18:12amalloythe one-stop shop for all your (doc x) needs
18:21stuartsierraegghead: It hasn't been released yet. Should appear before Clojure/West.
18:22eggheadfigured as much stuartsierra :D
18:59clizzini 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:00eggheadclizzin: they are passed to the main "method"
19:00clizzinegghead: where is that if i'm using lein-ring
19:01clizzini haven't defined a :main in my project.clj, i've only defined a :ring {:handler ...}
19:02justin_smithanyone know off the top of their head the new name for clojure.data.json/read-json-from?
19:23clojure-newbRaynes: any luck… did my refheap help ?
19:24Raynesclojure-newb: Oh, I'm sorry. I forgot all about it. Give me a few.
19:24clojure-newbRaynes: no worries
19:26Raynesclojure-newb: Okay, so you want to compose transformations, run that on a node, and replace the node with the output of that?
19:26RaynesWhat about … (l/element= :tbody) #(l/on % (trans1) (trans2) ..)
19:27clojure-newbRaynes: it will be one transformation per selector
19:27clojure-newbRaynes: if possible
19:27RaynesI don't know what you mean by that.
19:27clojure-newboperating on different parts of the document
19:27RaynesYou're trying to run different transformers for different :tbody elements?
19:27clojure-newbso rather than multiple transformations on one element selector, I want to change different bits of the document
19:27clojure-newbyes
19:28RaynesYou'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:28clojure-newbHow do I put more than one selector/transformer pair into the defdocument ?
19:29Raynes(defdocument foo (some-readable-thing) [args] selector1 transformer1 selector2 transformer2 ..)
19:30clojure-newbthat simple ? haha
19:30RaynesIndeed. :p
19:31clojure-newbcool
19:31clojure-newbthanks for the help
19:32Raynesclojure-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:32clojure-newbok thx
19:32RaynesNote 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:32Raynesaffect*
19:33clojure-newbnoted, I'll have a play with this tomorrow morning, will yell if I get stuck
19:33clojure-newbthx
19:34devnCall 608-729-4573 -- It's a dial-a-clojure-doc service
19:45pmonksJenny? Is that you?
19:45tpopebbloom: you could probably rig it up with :match, but that's kind of manual
19:45pmonksOh wait, that's 867-5309
19:45eggheadseven two nine four five seven threeee ee e
19:49bbloomone more bug to fix & then i have a cool bit of code to release :-)
19:49bbloomand probalby a copy-edit pass on the docs heh
19:49bbloomprobalby <- see why i need it?
19:49eggheadpro balby? what is balby and why are you so supportive of it?
19:50bbloomheh
20:11brainproxybinding cmd key to Emacs meta on a Mac can have funny/frustrating consequences, especially after long stretches of programming
20:12brainproxyi keep pressing cmd-w to copy text in apps other than emacs, and thereby closing the windows :-/
20:13technomancyapps ... other than emacs?
20:13brainproxyyeah like web browser :p
20:13technomancyyou mean like grep?
20:13eggheadhaven't heard of it
20:13brainproxyhehe
20:13nDuffbrainproxy: You mean w3? That's part of emacs.
20:13nDuffhttp://www.emacswiki.org/emacs/w3
20:14nDuff(or emacs-w3m, for those who aren't purist enough to want software written in elisp)
20:14pandeirobrainproxy: 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:15brainproxypandeiro: lol
20:18mattmossUsing homebrew, I just typed 'man brew' at the console. That's just wrong.
20:23bbloomthere are plenty of good man puns
20:24bbloomman less, man which, man man, etc
20:25tpopeman -a tee
20:53pmonksman -k ini
21:11bbloomis 6pm on a friday a good time to release a project? probably not...
21:11bbloom*shrug* oh well
21:14bbloomhttps://github.com/brandonbloom/fipp
21:16tomojcool
21:16tomojI guess I can easily make one that doesn't print the contents of Vars?
21:16tomojand doesn't recurse into DbIds
21:17bbloomtomoj: the extensibility model isn't 100% fleshed out yet, but i accept patches :-) should me *much easier* to work with than clojure.pprint
21:18bblooms/me/be
21:18frozenlock&(re-matches #"[A-Z]" "This is a Test")
21:18lazybot⇒ nil
21:18frozenlockI was expecting to get ["T" "T"] :(
21:19bbloom(doc re-find)
21:19clojurebot"([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:19bbloom(doc re-seq)
21:19clojurebot"([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:19tomoj&(re-matches #"[A-Z]" "A")
21:19lazybot⇒ "A"
21:20frozenlockOh I see, it must be a perfect match.
21:22bbloomthat dopey project took me about 3 days longer than i expected it would...
21:22bbloombut i'm happy with how it turned out :-)
21:23bbloomibdknox: i expect somebody from LT to implement code-dispatch for me :-P
21:49frozenlockOk this is driving me crazy... how does one replace an uppercase letter _not_ at the beginning of line?
21:50frozenlock (defn from-camel [string] (str/replace string #"[A-Z]" #(str \- (str/lower-case %))))
21:52tomojfrozenlock: https://github.com/flatland/useful/blob/develop/src/flatland/useful/string.clj#L22
21:53xeqi&(.toLowerCase "AsdaSDF")
21:53lazybot⇒ "asdasdf"
21:54frozenlocktomoj: thanks! I should have guessed I wasn't the first to convert camel
21:57frozenlockhurmf... (dasherize "ThisIsATest") --> "this-is-atest"
22:05tomojfrozenlock: my attempt once: https://www.refheap.com/paste/0b91c4905a3207ab1dbc35119
22:05tomojcaps> (lisp-case :ThisIsATest)
22:05tomoj:this-is-a-test
22:05tomojcaps> (lisp-case 'THIS_IS_A_TEST)
22:05tomojthis-is-a-test
22:07frozenlockWow, that's specialized
22:08tomojI don't understand split-term anymore :(
22:11frozenlock(defn from-camel [string] (-> (str/replace string #"[A-Z]" #(str \- (str/lower-case %))) (#(str/replace % #"^-" "")))) Is dirty but it works :)
22:12TimMcClojail must apply dotify after macroexpansion time, yeah?
22:18mattmossI think there's clj-identifiers that has a few like that.
22:19mattmosshttps://github.com/joodie/clj-identifiers
22:21headshothowdy
22:22headshotan anyone comment on leiningen? (good, bad, appears to be supported, etc)
22:23frozenlockheadshot: leiningen is the alpha and omega
22:23frozenlockEvery project starts with it, and end with it :p
22:23headshotokay, 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:24frozenlockheadshot: On the contrary, technomancy just released a new version yesterday
22:25technomancyand a new one tomorrow; what more could you ask for? =)
22:25hyPiRionyeah, leiningen's blooming now.
22:25technomancybloomin' crazy
22:26xeqilike a fox
22:27xeqiI hear the book isn't very good though https://twitter.com/leiningenhaters
22:27bbloomdid somebody say bloom?
22:28amalloyyour bloom filter must be working beautifully
22:28bbloomamalloy: nah, there are some false positives
22:28bbloom*zing*
22:28amalloyyou win this round
22:28amalloybut i'll be back with more bits
22:38frozenlockIn regards to leiningenhaters twitter.. did I miss an event or something?
22:44xeqifrozenlock: I think some people are forced to read it in school
22:50headshotokay, need an opinion: lein self-install or brew?
22:52technomancyit's a single file, and it updates itself; brew doesn't really buy you much
22:52frozenlockxeqi: Oh wow! I was sure it was leiningen VS ant.... you, java stuff...
22:52headshothttp://stackoverflow.com/questions/14281215/leiningen-install-issues-on-osx-mountain-lion
22:52headshoti'm experiencing this
22:53nightfly_Dumb question, does getting the number of items in a sorted-hash (count) require iterating through the whole structure internally?
22:53technomancyheadshot: https://github.com/technomancy/leiningen/issues/915 or use the 2.0.0-preview10 tag
22:53headshotkthx
22:53technomancyor wait till tomorrow when RC2 comes out
22:53tomoj&(counted? (sorted-map))
22:53lazybot⇒ true
22:53tomojnightfly_: that means no
22:54headshottechnomancy: thanks, i'll have patience and find another toy to play with tonight.
22:55nightfly_tomoj: Neat! thanks.
22:55tomoj(doc counted?)
22:55clojurebot"([coll]); Returns true if coll implements count in constant time"
23:11devn,(counted (range))
23:11clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: counted in this context, compiling:(NO_SOURCE_PATH:0)>
23:12devn,(counted? (range))
23:12clojurebotfalse
23:12devn,(counted? (range 0 10))
23:12clojurebotfalse
23:13frozenlockIf I have the choice, should I use eval or a macro?
23:14amalloychoosing between eval and X, the answer is generally X
23:15frozenlockWell that was my rule for macros :P
23:16amalloyheh. yes, i thought that too while answering
23:16amalloybut it's only true when choosing between macros and functions, not macros and X
23:16Hodapp"You have a problem. You think, 'I know, I'll use eval!' Now you have two problems."
23:16SgeoBetween macros and repetitive boilerplate, you should choose macros
23:17SgeoIf you were using Tcl, eval would be a reasonable choice I think
23:18HodappThe sum of my involvement with Tcl is that the Tcl website has a paper about why scripting languages are good.
23:18Hodappand I think it's a rather good paper.
23:22bpris there a canonical way to check if a value is an array? Or do I have to deal directly with java types?
23:23amalloy&(.isArray (class (.getBytes "sdff"))) works, or something close to it
23:23lazybot⇒ true
23:23bprok, thanks
23:24CaffeineIs 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:25bbloomCaffeine: that's not eval, it's part of the reader
23:25Caffeinearfff ok sorry .. read-line
23:26bbloomCaffeine: are you only reading an individual number?
23:26Caffeineyes!
23:26bbloom,(Integer/parseInt "010")
23:26clojurebot10
23:27Caffeineok thanks!
23:40headshotbeh, i give up
23:47tmciverHow do I kill nrepl in emacs?
23:48tmciver(other than (System/exit 0))
23:49Hodapptmciver: you can C-x k in the buffer
23:50tmciverHodapp: does that kill the server too?
23:50Hodapphmmmmm, I'm not sure
23:50Hodappit'll ask I think
23:50tmciverdoesn't look like it
23:53bprtmciver: M-x nrepl-quit
23:54tmciverbpr: OK, that seemed to do it - though it prompted me twice to kill a process.
23:55bprhrm. you may have connected two times? I've gotten things into that state before, and had to restart emacs to fix it
23:56bprin normal state it will only ask once
23:57tmciverbpr: yeah, I think you're right. Tried it again and it worked fine. Thanks.
23:57bprtmciver: if you hit C-x k in the repl buffer, that may have corrupted the state
23:57bprok. great
23:58tmciverI miss swank-clojure's M-, (or whatever that was)
23:59bprnrepl's got M-. :]
23:59bprbut, yeah that's very nice
23:59tmciverah, yes.
23:59bpri also miss the slime-who-calls/refrences/etc. functions