#clojure logs

2012-06-21

00:40brainproxyanybody here using clojure to work w/ JSON-LD?
00:46bbloomhold on wait… i saw someone do this the other day….
00:46bbloom$anybody
00:46bbloom$anybody$
00:46bbloom$anyone
00:46bbloom$anyone$
00:46bbloomhm… guess not
00:47bbloomoh well
00:47wmealingLD ?
00:47wmealingfirst time ive even heard of that
00:48brainproxyyeah, just learned about it tonight, read an interesting paper:
00:48wmealingi see http://json-ld.org/
00:48brainproxyhttp://ws-rest.org/2012/proc/a4-2-lanthaler.pdf
00:48wmealingand it mentions "web scale"
00:48wmealingsets off my bullshitometer
00:48brainproxyheh, sure
00:48brehaut~anyone
00:48clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
00:49brehautbbloom: ^
00:49bbloomdamn. wrong control character
00:49bbloomi can never remember them all
00:49bbloomnext time, i'll check the source rather than guess :-)
00:49brainproxybrehaut: well in this case the question I really want the answer to is whether there is someone in chan working w/ JSON-LD, because I'm trying to grok it and would like to bounce some ideas of someone who understands it
00:51brainproxywmealing: it seems to be one of a number of attempts to extend JSON as a hypermedia type
00:51brehauti think ~ is just a shorthand for addressing clojurebot in full?
00:51brehautclojurebot: anyone
00:51clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
00:51brehautyeah there you fo
00:51amalloybbloom: it won't be in the source
00:52bbloomamalloy: i know not they keyword, but won't the control character be?
00:52amalloyoh, probably
00:52bbloom:-)
00:52amalloy$ activates lazybot, and i don't think it's in his source that way
00:52amalloybecause he reads it in from a config file at startup
00:53brehaut~arrows
00:53clojurebotarrows is http://ro-che.info/ccc/12.html
00:53technomancycan we use the word "plist" to refer to [:key "value" :other-key "value2"] structures?
00:54technomancyor is that gauche?
00:55brehautthats almost like a common lisp associative list right?
00:56amalloyno, i think it's a common lisp property list :P
00:56brehauthah ok
00:56technomancyright-o
00:56brehautoh i see, it has both
00:57technomancyI'm gonna call it a plist
00:58amalloytechnomancy: doesn't macos have this "plist" thing that's all xml nonsense?
00:58brehauta plist in mac os x can be many things
00:58technomancyI believe so
00:58wmealingbbloom, it doesn't look like it'd be too hard to hack on from clj-json
00:58technomancywell, xml if you're lucky
00:58brehauttheres at least an xml and binary repr
00:59brehautit inherited that madness from next step, its effectively weird arse json
01:00adutechnomancy: I think they have about a zillion names
01:01adubrehaut: Apple plist = JSON+Date+Bytes
01:02brehautadu let me be more precise then, plists are to objective-c/cocoa what json is to javascript
01:02brehautonly weirder
01:02adukinda no
01:04aduI think plists(text) were used at NeXT before obj-c was invented (don't quote me). ObjC could exist without plists. Apple invented the xml and binary serializations of plist much later. JSON on the other hand, was inspired by an existing language
01:06aduthe textual form of plists is very similar to json, and I'm sure people convert to/from plists and json all the time
01:08aduto make a paralell to java, Info.plist=build.xml, and java and ant could exist independant of eachother
01:11tomojcan an analogy ever be precise?
01:11brehauti had presumed that it wasnt a requirement at least
01:12adusorry for nit picking
01:13aduecosystems fascinate me
01:13tomojimo nits being picked (with reasonable volume) on irc is generally positive, since you can just not read it if you don't care, and often someone will
01:13brehauttomoj: are you comparing us to a bunch of uncivilized jungle apes?
01:15technomancywho's scruffy-looking?
01:15brehautthat would be those of us who do not have office jobs :P
01:16aduI have an office job & I'm scruffy-looking
01:16tomojjungle apes? I don't follow
01:16technomancythe correct answer is "Han Solo"
01:17brehautcrap, so it is
01:18adulol
02:26TheBusbyany tricks to apply a type hint to "this" when doing proxy-super to avoid reflection warnings?
02:41amalloyTheBusby: i tried to figure it out a while ago and couldn't do it
02:43TheBusbyamalloy: doh, thanks for the heads up!
02:55ro_stanyone using cljs have a solution for OAuth/OpenID in place?
03:17ro_stis there a channel on here for users of the google closure library?
03:20ro_stin compojure, is there a way to set the root route to load up a file that would be resolved by route/resources? i have a static index.html that i want to make the home page
03:21ro_stso "/" -> index.html
03:22xeqiyou could stick middleware in that alters the :uri
03:24muhooi'm pretty sure there's a ring middleware that checks resources/ for static files
03:26muhooro_st: compojure.route/resources ?
03:41msapplerhey, is it a bad idea to have nested refs
03:42madsymsappler: Nested how?
03:44msapplerRight now I have robots with (ref {:position :goal :meeting-point :internal-grid})
03:44msapplerfor multi-robot exploration
03:45msapplerand for performance reasons I want to have every cell of the internal grid an ref itsself so I can traverse it faster
03:45msapplerlike caching neighbour cells
03:47amalloythat sounds like an optimization made with no particular evidence that it will make things faster
03:48amalloymake get-neighbor-cells a function, and then in the unlikely event that you find a ref dramatically speeds up your app, you can just change its implementation without affecting anything else
03:49msapplerI know it will speed up because I did it before
03:49msappler10x
03:51madsymsappler: I didn't even know you could have refs inside refs. What would happen if you update parent and child inside the same transaction?
03:51madsySounds unsafe to me.
03:52madsyClojure is smart enough to do partial updates anyhow
03:54msapplerSo I rather do {:state (ref {:position :goal :meeting}) :internal-grid (grid-with-refs-as-cells)}
04:05ro_stmuhoo: i am using route/resources. i want to map the root route "/" to automatically load up /index.html - like Apache's default document
04:06ro_stxeqi thanks, i'll try that
04:32ro_stxeqi, muhoo: fyi: (GET "/" [] (ring.util.response/resource-response "public/index.html"))
04:44amalloyro_st: https://github.com/4clojure/4clojure/blob/develop/src/foreclojure/ring.clj#L33 is more general
04:44michaelr525hello!
04:44amalloyi mean, i guess that's for doing a slightly different thing. but you've only mapped / to /index.html, not also mapped /foo to /foo/index.html
04:45amalloybut the point is if you want to treat URL x as if it were URL y, wrap your routes with something that transforms x to y before calling the rest of your server
04:45ro_stthat makes sense
04:47ro_stturns out i can restrict tomcat to /api/ within apache, which means i can serve the client side stuff 100% static
04:48ro_stand get all the benefits of the html5boilerplate apache config
04:48ro_st98/100 for pagespeed, that way!
04:51ro_stwhole frontend for the app loads in under 100k with gzip et al. that includes webfont and a 150kb (uncompressed) js 'binary'
05:21augustlhi folks. I'm building a HTTP that works with JSON data, and connects to a postgres db. Currently making some attempts in rails and nodejs, but struggling with the integration testing. I.e. doing http requests and resetting the DB in between tests. Anyone know of some solutions for this for clojure and/or the JVM in general?
05:28kjetilvaugustl: why don't you just reset the DB between tests? drop schema, then re-run table create statements
05:31augustlkjetilv: for some weird reason I didn't think of that. Been struggling with "DROP DATABASE" which requires all connections to be closed first. thanks :)
05:32kjetilvaugustl: easy does it :-)
05:33kralhi
06:13clojure-newcomerhi guys… anyone had an experience putting together Facebook login integration in a clojure web app ? particularly interested in Noir
06:14clgv augustl: the usual approach is "to mock out" the DB, if not the DB functionality is to be tested
06:14michaelr525clojure-newcomer: i'm doing it right now :)
06:14michaelr525clojure-newcomer: using this: https://github.com/metadaddy-sfdc/facebook-template-clojure
06:14clgvmichaelr525: which oauth lib are you using?
06:14clojure-newcomermichaelr525: very interesting, I'd love to hear about how you go about it
06:15clojure-newcomerhttps://github.com/cemerick/friend looks interesting
06:15clgvclojure-newcomer: friend is for authentication and authorization of your own webapp
06:16michaelr525clgv: the link i pasted is a full solution, it's using https://github.com/DerGuteMoritz/clj-oauth2
06:16clgvbut someone mentioned an oauth plugin for friend
06:16clgvmichaelr525: ah ok
06:16clojure-newcomermichaelr525: thanks for the link, interesting
06:16michaelr525yeah, no problem
06:16clgvmichaelr525: didnt see it in the project.clj
06:16clojure-newcomeryeah, friend looks like it has room for this kind of thing
06:17michaelr525clgv: it's using this, https://github.com/maxweber/clj-facebook-graph and this is using the oauth
06:18michaelr525actually i have a problem with it connecting to facebook https, trying to solve by converting to the latest versions of all libraries used
06:18clojure-newcomerI'll watch your updates so I benefit from your solutions :-)
06:19michaelr525SSLPeerUnverifiedException peer not authenticated sun.security.ssl.SSLSessionImpl.getPeerCertificates (SSLSessionImpl.java:371)
06:19michaelr525i get this shit ^^
06:19michaelr525clojure-newcomer: it's not my solution, i'm using it as well :)
06:20clojure-newcomersorry.. I should have been clearer… when you iron out the problems, I'll just follow along :-)
06:31clgvmichaelr525: there was a discussion on the clj-oauth2 yesterday in #clojure.de
06:40michaelr525clgv: hmm
06:41michaelr525clgv: what's the deal with it?
06:41clgvmichaelr525: if I remember correctly, the-kenny wanted to use it and ran into several problems - I think he mentioned that he is going to fork it
06:42michaelr525clojure-newcomer: solved this problem. had to add the certificates to the local key store. follow this post if you get a similar problem: http://davidjb.com/blog/2012/02
06:43michaelr525clgv: so far it's working well for me, i'm building a site with facebook integration.
06:45michaelr525clgv: maybe i should not have said that because i immediatly got this stacktrace :)
06:46clgvlets give you better karma ;)
06:46clgv(inc michaelr525)
06:46lazybot⇒ 1
06:46michaelr525hehe
07:00clojure-newcomermichaelr525: sweet, good to know
07:03edoloughlinAny compojure users out there? I'm upgrading from 0.4.0 to 1.1.0 and it no longer likes my destructuring: (POST "/interviews/:id" [{{id "id"} :params} {{interview :interview} :params}] …) — I get "Unexpected binding: {{id "id"} :params}" when compiling.
07:03edoloughlinOther bindings that use :params are accepted.
07:18clgvedoloughlin: how about [{{id "id", interview :interview} :params}] ?
07:22Rakin05hey guys. i've got a question. i hack java for about 5 years now and wanna learn a new language concept without loosing the jvm. is clojure a good bet for that task?
07:22clgvRakin05: definitely
07:22Rakin05clgv: what about scala?
07:23clgvRakin05: could be - didnt read much of it, yet
07:25Rakin05are there any bigger industry projects build with clojure?
07:27clgvRakin05: with clojure you can learn lisp and function programming
07:27clgvRakin05: twitter uses clojure
07:30matessimjoin #arch-linux
07:36dabdis there a better wrapper for jfreechart than incanter support? I think incanter jfreechart interface does not allow full customization of charts but I may be wrong.
07:37edoloughlinclgv: Thanks, will try it. Eclipse/CCW is acting up at the moment so I've got to fix that first...
07:38clgvedoloughlin: oh, what version? with leiningen-plugin?
07:38clgvdabd: yeah it does not
07:38edoloughlinIndigo with the CCW lein beta. Was working fine all morning and now it times out waiting for the REPL to start...
07:39clgvdabd: but you can come pretty far by starting with incanter.charts if it has your desired chart and then modify it with JFreeChart API via Java interop
07:39clgvedoloughlin: oh. refresh your whole workspace
07:40clgvedoloughlin: there is still an issue with missing "classes" folder although it gets generated and such
07:41dabdclgv: ok seems viable
07:42edoloughlinclgv: Thank. That worked even though restarting Eclipse didn't!
07:42edoloughlinclgv: s/Thank/Thanks/
07:45edoloughlinclgv: No luck with the destructuring change though :(
07:45edoloughlinI've tracked it down to a change between compojure-0.5.3 and 0.6.0
07:50cshellcemerick: What tool do you use to create the flow charts like the one for how you choose between defrecord, protocol, etc?
07:51cemerickOmnigraffle.
07:53cshellah very nice
07:53cshellthanks
07:53cshellif you werne't using a mac, do you know what you'd use?
07:54cshellcemerick: also, are you using someting that detects when someone uses your name in chat? You're always quite responsive
07:54lpetitIt's official, Counterclockwise (Eclipse plugin for Clojure) now ships with Leiningen 2 support!
07:54cshellyay!
07:54lpetitSee http://t.co/PGvOAbcc and http://t.co/SQ9fWqqw
07:55logaan1i'm looking for a function that tests a value against a predicate and returns that value if the predicate returned true, otherwise returns a fallback value
07:55logaan1does something like that exist in core?
07:55cshellthere's identity
07:55cshellwhich returns the value
07:56lpetitlogaan1: not that I'm aware of
07:56logaan1(ifpred empty? "me" "fallback") ; => "me"
07:56logaan1(ifpred empty? "" "fallback") ; => "fallback"
07:56logaan1lpetit: thx. guess i'll roll my own
07:57edoloughlinlpetit: Congratulations and thanks! Is there any reason to keep on the beta version now or do you recommend switching back to STABLE?
07:57lpetitloogan1: do you want something special? Test for true true, or truethiness ?
07:58lpetitedoloughlin: thanks. As you want. I've already upgraded the beta "channel" with a 0.9.1beta which is really just the 0.9.0 with updated metadata
07:59lpetitthe beta channel is not fed by CI, and if you also don't have automatic upgrade from software updates enabled in your Eclipse installation, I guess you're quite safe staying on the beta channel.
07:59logaan1lpetit: sorry i don't understand
08:00lpetitlogaan1: do you consider nil as a false value, as does clojure ?
08:01lpetitlogaan1: if so, what you're after don't deserve a function: (if (pred x) x :default)
08:02patrkrishi folks. inspired by SICP, I wrote the sqrt approximation function using newton-rhapson. i've used loop-recur, but is it better/more idiomatic to rewrite using reduce somehow? here it is: http://patrkris.dk/~patrick/code/newton_sqrt.clj
08:03logaan1lpetit: yep that's exactly what i've been doing. was just hoping to avoid the repetition of x. by moving that if statement into a function that takes two values and a predicate I can save myself needing to use let to bind x.
08:04lpetitlogaan1: oh yes
08:53the-kennymichaelr525: Ping. Still there?
08:54the-kennyclgv: Yeah, I forked it. There were some issues in combination with Google.
08:56the-kennyOh, his problem is solved. Nevermind :)
08:56clgvlpetit: great! is something like :project-init supported?
08:57clgvlpetit: in general I mean executing custom code before the repl starts and begins to load namespaces...
08:58michaelr525the-kenny: i'm here
08:59Chiron_Hi all! would you please have a look at this: http://pastie.org/4126179
09:00the-kennymichaelr525: I was just pinging you about the clj-oauth2 problem
09:01lpetitclgv: is :project-init in Lein2 ? not supported yet, but would be easy to do so, IMHO
09:02michaelr525the-kenny: oh, it wasn't a problem with clj-oauth2 :). just clgv asked which oauth lib i'm using so it looked like i have a problem with oauth
09:02michaelr525hehe
09:02foxdonut"Clojure: The Definitive Guide" book review: "Sadly, unrelated to breaking up... I thought I'd get some kind of relief from reading this. But no, it's about some computer thing. Sad. Guess I'll have to go back to stalking..."
09:02clgvlpetit: it was in lein1 - I do not know if there is an equivalent in lein2. I hope so and I am wanting this for Eclipse since a while.
09:02foxdonutReply: "If you need to find a new girlfriend and have issue talking to people: 'Smalltalk Best Practice Patterns.'"
09:03foxdonut*Closure
09:03clgvlpetit: advanced repl search with partial lines of code didnt make it into stable builds yet?
09:03cshelllol
09:03lpetitclgv: please find its lein2 equivalent, and create an issue for this with some detail you can thing of
09:03lpetitclgv: still in cemerick's todo list, afaik
09:05lpetitclgv: I don't see :project-init in lein2's sample project.clj: https://github.com/technomancy/leiningen/blob/master/sample.project.clj
09:05clgvlpetit: yeah, I do not as well :(
09:06lpetitclgv: oh, there's :repl-options
09:06clgvyeah but :project-init was different from :repl-init afaik
09:07lpetitclgv: see, that's not really clear atm. Feel free to start recording the state of this by creating an issue and starting accumulating knowledge.
09:08clgvlpetit: but that feature could be implemented independent of lein2 in Eclipse as well.
09:12clgvlpetit: hmm maybe the :repl-options :init is sufficient. I have to check that.
09:12clgvlpetit: but that is not supported at,?
09:14lpetitclgv: atm, :repl-options :init is not supported. What is supported is launching "clojure applications". And you can modify the associated launch configurations so that you start any code you want
09:14lpetitclgv: for instance, start from the project's root a repl. then find the associated aunch configuration via run > run as …
09:15clgvlpetit: ah. good to know. where the thousands of run configuration superseeded by a single one?
09:15lpetitclgv: and then, open the "arguments" tab, and in the "program arguments" for the JVM, enter -e "(require 'clojure.string)" and voila, -e … will be added to the command line used by eclipse to launch your repl
09:15clgvlpetit: I still have one for every file in my workspace ;)
09:16lpetitclgv : well, you'll have to test it :)
09:21clgvlpetit: tested with println. works! but would be neat to have it on the clojure page with a clojure editor :)
09:21lpetitclgv: no, still as many launch configurations as "selected resources" when asked to launch
09:22lpetitclgv: didn't understand
09:22lpetit"to have on the … with a … " ???
09:22lazybotlpetit: Oh, absolutely.
09:22clgvlpetit: executing code with the jvm argument "-e"
09:22lpetitoh :)
09:23clgvlpetit: ah, the clojure tab of the run configuration
09:23lpetitWell, indeed currently, let's say it's the "most generic" solution :)
09:23clgvyeah.
09:24lpetitclgv: if I add support for lien's :repl, I'm not sure I will also work more on the launch configurations
09:25clgvlpetit: yeah. that would be redundant. having it in lein's :repl is a single source of configuration :)
09:27clgvlpetit: now that I deleted the thousands of run configurations, finally "load file in repl" works like it is supposed to :)
09:27ohpauleezThanks for everyone who came last night to ClojureNYC
09:27lpetitclgv: thousands, really ? ;)
09:27clgvlpetit: they did not fit on one page. ;)
10:24AWizzArdI would like to use Clojure as a scripting language (JSR 223) in a JavaFX app, to be specific: in a .fxml file.
10:26lpetitAWizzArd: good luck
10:26AWizzArdIn that file I can specify <?language javascript?> and this is accepted. When I say however <?language clojure?> I get a NPE. Is some specific "definiton file" required to be on the CP to let the JVM know that a JSR 223 compatible language is available?
10:34AWizzArdlpetit: it seems something such as http://code.google.com/p/clojure-jsr223/ would be required as a dep.
10:37Chiron_I'm calling map (that its function calls str function) inside doseq , why the result of map isn't displayed on repl?
10:41tbaldridgeChiron_: doseq doesn't return anything IIRC
10:43tbaldridgeChiron_: look at doall, I think that's what you're looking for
10:43Chiron_wrap do all around map?
10:43tbaldridge(doall (map #(do (print %) %) (range 10)))
10:45Chiron_not working for me: http://pastie.org/4126713
10:47tbaldridgeI think you're missing a println there, something like this? http://pastie.org/4126726
10:47tbaldridgeI guess I'm not exactly sure what you want this function to do, is it supposed to print data, or return data, or both?
10:48Chiron_true, missing println
10:48Chiron_it is a prototype
10:49Chiron_I want to extract data and insert into db
10:51N8Dawghelp, does anyone here have experience with swank-cdt?
10:52N8Dawgi'm using lein 1.7.1 and swnak-clojure 1.4.2
10:54the-kennyChiron_: If you want to iterate over a seq for side effects, you should use "doseq". It's like for, but throws away the result and is not lazy.
10:54N8Dawgwhen i run (use 'swank.cdt) I get the error: com.sun.jdi.Bootstrap [Thrown class java.lang.ClassNotFoundException]
10:54Chiron_i feel bad to use deseq inside another doseq
10:56the-kennyChiron_: doseq supports the same "nesting" as for: (for [x (range 3), y (range 3)] [x y]) -> [[0 0] [0 1] [0 2] [1 0] [1 1], ...]
10:56the-kennyfor ist list comprehension :)
10:56VickyIyerHi there I am newbe to the clojure language, just wanted to know how common is it that we have inter-ops apps where we have clojure code embedded into the java code. or is the common sense approach to use only pure clojure code and call java library functions when required.
10:57jsabeaudryVickyIyer, I'd say pure clojure calling libs
10:58the-kennyBut you can easily generate classes out of namespaces for use in Java.
10:59VickyIyeryeah, but I just thouught that might be difficult, cause would a function name my-name in clojure get translated to java as - is not valid for a function name in java
11:03TimMcVickyIyer: It gets converted into my_name or somesuch.
11:05TimMc&(munge 'my-name*!?)
11:06lazybot⇒ my_name_STAR__BANG__QMARK_
11:06jsabeaudryVickyIyer, keep in mind that you can name your clojure functions MyName if your objective is to have them fit in the java world
11:07TimMcYou can also use gen-class and defrecord and such to ease interop from the Java side.
11:17gfredericksVickyIyer: you might find lib-2367 interesting
11:17gfredericks$google lib-2367
11:17lazybot[fredericksgary/lib-2367 · GitHub] https://github.com/fredericksgary/lib-2367
11:22TimMc&(apply str "lib-" (repeatedly 4 #(rand-int 10)))
11:22lazybot⇒ "lib-9791"
11:22gtrakibdknox: do you have any thoughts on light-table plugins/api guidelines yet?
11:26VickyIyerThanks a lot all, it was very helpful
11:33gfredericks&(format "%04d" (rand-int 10000))
11:33lazybot⇒ "7235"
11:33gfredericks&(format "lib-%04d" (rand-int 10000))
11:33lazybot⇒ "lib-7198"
11:34TimMchrmph
11:35gfredericksTimMc: I've been doing this for a while
11:38Shambles_I'm using Eclipse with Counterclockwise for Clojure support. Is there some way I can get it's REPL to use Clojure 1.4.0 rather than 1.3.0? I'm using the latest version of Counterclockwise (0.9.0).
11:39timvisher|workShambles_: It doesn't honor the version of clojure defined in your project?
11:41Shambles_timvisher|work: I've made a 'hello world' project, and have this in my project.clj ([:dependencies [[org.clojure/clojure "1.4.0"]]]) When I "Run As" and pick "Clojure Application" I still get the 1.3.0 REPL.
11:42timvisher|workis that all you have in your project.clj?
11:42Shambles_timvisher|work: I wouldn't be surprised if I was doing something wrong, since I've had some significant difficulty getting this far, but I had to give up with this problem because Googling and trying to figure it out myself wasn't working.
11:42timvisher|workthat doesn't look valid
11:43timvisher|worksomething like this would make more sense
11:43timvisher|workhttps://gist.github.com/2966538
11:43Shambles_That's all I have in there yes. It's the same thing it started with as a default Leiningen project, only the version number was originally 1.3.0.
11:44timvisher|worki use emacs, so i'm not sure the nuances of counterclockwise, but the REPL defaults to 1.3.0 I believe
11:44timvisher|workhave you run lein deps?
11:44timvisher|workit's possible that counterclockwise doesn't update your dependencies automatically, though that would be counterintuitive
11:44Shambles_timvisher|work: I have not run lein deps yet.
11:45timvisher|workyou should never have to
11:45timvisher|worknot with the latest versions of leiningen, which i understand counterclockwise just upgraded to
11:46timvisher|workare you sure it's 1.3.0?
11:46timvisher|workwhat's *clojure-version* end up as?
11:46Shambles_timvisher|work: The REPL says this: ;; Clojure 1.3.0
11:47Shambles_=> *clojure-version*
11:47Shambles_{:major 1, :minor 3, :incremental 0, :qualifier nil}
11:47Shambles_Running lein deps had no effect.
11:49Shambles_You mentioned he had 'just upgraded to the latest version'. Perhaps me using leiningen 1.7.1 (the last stable version) is the problem.
11:50Shambles_I am running the latest Eclipse and Counterclockwise and Clojure, so that's all I can think of, given I'm not using anything else at the moment.
11:54dgrnbrghow do I write a lein1 plugin that gets executed during init for every plugin?
11:55lynaghkping: ohpauleez
11:55ohpauleezlynaghk: pong
11:56lynaghkhey dude; how did your talk go yesterday evening?
11:56ohpauleezReally well, slides are up on my blog. dnolen kovasb and I talked about the "process problem" and getting better concurrency in the browser
11:57ohpauleezA lot of great questions about ClojureScript in production - concerns, risks, things I would have done differently
11:58lynaghkohpauleez: rad! Yeah, I am thinking I need to get a blog and start writing that kind of stuff down
11:58ohpauleezShowed some demos of Shoreleave-enabled apps
11:58ohpauleezlynaghk: For sure, it helps for personal docs too - I used to swear by my research notebooks. But now I just do a quick search on my blog to pull something up
12:00lynaghkohpauleez: are you planning on submitting your TodoMVC to the core project? I was thinking about doing that, if only to see what their reaction would be to something so completely different
12:01dgrnbrgDoes anyone have any idea why a simple project.clj with :eval-in-leiningen and 3 :dependencies in lein1, would not include those dependencies in the jar when I do "lein uberjar"?
12:01timvisher|workShambles_: even leiningen 1.7.1 should honor what's in your project.clj file. sorry to say i'm at the end of my ability to help. :(
12:01timvisher|workdgrnbrg: best to paste your project.clj file up somewhere
12:01ohpauleezlynaghk: I was on the fence leaning towards no, but if it got a lot of traction, I would consider it
12:02ohpauleezI would hate for it to navy,Z"
12:02ohpauleezwow, apple, stop auto typing
12:02ohpauleezX, Y, Z*
12:02dgrnbrgtimvisher|work: I can't paste all of it, but with just one dep, it's (defproject foo "1.0.0" :eval-in-leiningen true :dependencies [[conch "0.2.1"]])
12:02lynaghkohpauleez: you mean Shoreleave traction?
12:02dgrnbrgit's extremely minimal
12:02ohpauleezok, second take: I would hate for the conversation to spin off into - "Why the hell does CLJS do X, Y, Z"
12:03ohpauleezlynaghk: Yeah. Because the TodoMVC just highlights my opinions about how to build CLJS apps, not how CLJS should be used to built TodoMVC
12:03timvisher|workdgrnbrg: if you uberjar a fresh project, does it include what you expect?
12:03scriptorwait, there's a cljs TodoMVC?
12:03dgrnbrgtimvisher|work: it appears to be due to the :eval-in-leiningen
12:04ohpauleezlynaghk: (my opinions, as expressed via Shoreleave)
12:04lynaghkohpauleez: ah, right. Yeah, I wanted to run my version by some folks before submitting
12:04dgrnbrgif i remove that, it uberjars everything
12:04dgrnbrgunfortunately, i need both :/
12:04lynaghkto see if they thought it's idiomatic cljs (or as close as something like that could be)
12:04timvisher|worki've never used that feature of lein so i can't tell you anything about what's happening
12:04timvisher|work:(
12:04ohpauleezscriptor: lynaghk and I both are working on TodoMVC demos of our CLJS stack technologies
12:04timvisher|work0/2
12:04scriptornice
12:04ohpauleezlynaghk: exactly
12:04lynaghkscriptor: https://github.com/lynaghk/c2-demos/tree/master/todoMVC
12:04scriptorI'd be so happy if I could figure out a way to use cljs here
12:05scriptorlooking at backbone for now
12:05ohpauleezI abuse protocols, and I force this weird pubsub thing - etc. I'm not sure that's worth showing the JS community at large
12:05lynaghkohpauleez: well, mine is pretty much all standard CLJS except for data-binding from C2.
12:05ohpauleezscriptor: I would say it's VERY possible to use CLJS in place of Backbone
12:05scriptorhow weird? I thought pubsub was generally used for updating models
12:06ohpauleezscriptor: Weird as in - not a normal interaction you'd see in CLJ perhaps. But definitely a nicer way to bind up the internals of a CLJS app (again, totally my opinion)
12:07ohpauleezFar superior to littering event related code in your functions
12:07ohpauleezWhich is a tax on cognition when building sizable apps
12:07scriptorhmm, one issue I have with cljs is that even with advanced optimization on, compiling a simple alert() leads to a 114kb js file
12:08ohpauleezRight, then gzip that file
12:08ohpauleezand it's 32kb'
12:08ohpauleezWhich is 1/3 the size of jQuery
12:08ohpauleezthrough the same compilation process
12:08scriptortrue, but backbone's only 5kb :/
12:08ohpauleezThat's not true
12:08ohpauleezwhen you glom on all the other libraries you need to make it go
12:09ohpauleezyou end up with 100's of kbs
12:09ohpauleezeasily
12:09scriptorhmm
12:09lynaghkscriptor: if you are working with a designer, they will probably just put an unoptimized JPEG on the page that's 700kB anyway, so don't sweat the JS =P
12:09ohpauleezAnd really, if you have a CDN, does 50-100 KB for one request, that's going to be cached client side matter?
12:09ohpauleezAlso, what lynaghk said
12:10scriptoryea, size won't be that big of an issue in the end
12:10scriptorit's more the training people to move away from jquery and learn cljs
12:10ohpauleezI've found the easy path to CLJ and CLJS is using JavaScript as the mind-migration language
12:10scriptoralso, I've only been here less than 2 weeks, so I don't think I have much influence :)
12:11ohpauleezPython/Ruby + JavaScript is enough for people to get over the hump with Clojure. At least in my experience
12:11ohpauleezscriptor: Just shout louder than everyone else
12:11ohpauleezhaha
12:11ohpauleez:)
12:16technomancyclgv: :injections does what :project-init used to do, but better
12:19clgvtechnomancy: oh interesting. gotta tell lpetite ;)
12:19clgvtechnomancy: thanks for the info :)
12:20nDufflpetit: I'm using clojure.aav updated to 1.4.0; should I fork/rename? Submit the updated manifest back? ...?
12:21Shambles_timvisher|work: I tried updating to the latest Leiningen code on github, and it solved the problem. I'm sorry to have troubled other people with it. I just couldn't figure out the source of the problem. I normally run stable versions is all.
12:22timvisher|workShambles_: no problem! glad you got it sorted out. don't be afraid to ask questions! :)
12:22technomancydgrnbrg: what's the use case for :eval-in-leiningen together with uberjar? I've never heard of anyone using the two in the same project.
12:22Shambles_timvisher|work: I'm not used to friendly IRC channels, though it seems /some/ of the Lisp channels are okay. It's just taking some getting used to.
12:23timvisher|workyou should see some of the things i've asked here :)
12:23timvisher|workclojure's community is maybe its best feature
12:24cgagyeah i don't think i've seen anyone be anything but nice since i started hanging out in here
12:25technomancythere are a few you have to watch out for; I don't want to name any names but it starts with cloj and ends with urebot.
12:25timvisher|worktrue-
12:25timvisher|workno one likes dealing with that guy
12:25timvisher|workcantankerous to the core
12:25gfredericks~botsmack
12:25clojurebotOwww!
12:26technomancynothing like this guy thankfully though: http://groups.google.com/group/comp.lang.lisp/msg/4c95766a8bdda347
12:28Shambles_I suspect I may have some trouble installing all these libraries I've found. I've managed to figure out that leiningen is what you use to build things with, but some of the packages don't have instructions for building them, and I'm not exactly sure what happens when I "lein install" something. I suspect it will involve having to change my CLASSPATH though.
12:28technomancyShambles_: the goal of Leiningen is to ensure you never have to think about your classpath
12:28timvisher|workShambles_: Have you gone through https://github.com/technomancy/leiningen/blob/c155dd1e25f7db756787f630b33504f2b79ca649/doc/TUTORIAL.md ?
12:29technomancy^ aka `lein help tutorial`
12:29timvisher|workmight be worth your time
12:29timvisher|worktechnomancy: you tricky devil you
12:29technomancytimvisher|work: even just `lein tutorial` on the latest
12:29technomancypartially-applied aliases ... <3
12:29uvtcShambles_, maybe have a look at http://www.unexpected-vortices.com/clojure/brief-beginners-guide/ to explain how things fit together.
12:30timvisher|workShambles_: unfortunately, clojure startup is still really rough
12:31Shambles_technomancy: I skimmed it, mostly to find out that what I wanted to know wasn't in there. I have had to do a lot of CLASSPATH fiddling, and even write a 'cute' batch file (doing something I didn't know could be done) just to get to where I am. Clojure and tools don't install that easily on Windows.
12:31uvtctimvisher|work, if you see any improvements that could be made to the Brief Beginner's Guide, ^^ please let me know.
12:31Shambles_technomancy: From what I can tell installed things end up somewhere under .m2 or .lein in my profile directory.
12:32technomancythat's a local cache, yeah. you shouldn't have to think about that unless things go horribly wrong though
12:32technomancywhat did you find missing from the tutorial?
12:32timvisher|workShambles_: install puts local projects into your local .m2 and can get in the way of repeatability
12:32timvisher|worktechnomancy: `lein help repeatability` ?
12:32technomancytimvisher|work: not a bad idea
12:33technomancyat first it felt a bit too ranty for the official docs, but it comes up so often
12:33timvisher|worki'll get right on that after i make my other contribution…
12:33timvisher|work:)
12:33Shambles_technomancy: To get Clojure and Leiningen working I had to manually modify my CLASSPATH to point to the directories of the appropriate JAR's. I learned the hard way that you could not include the JAR's themselves in the classpath. That made Clojure easy to run, but made Leiningen throw an exception.
12:34technomancyShambles_: that's awful. so I guess there are some serious problems with the Windows installation instructions?
12:34timvisher|workShambles_: You shouldn't have to install any jars at all
12:34Shambles_technomancy: After getting that settled, I had to write a batch file to launch Clojure. The trick was finding some way to make the batch file only care about the /relative/ path. The 'cute' part of that was finding out that variable expansion can occur within double quotes (necessary to handle the spaces in the pathnames).
12:34timvisher|workthe bat file should just work. does for me any way
12:34technomancyyou needed a batch file to launch Clojure?
12:35technomancyyou mean to launch a Clojure repl?
12:35Shambles_Then I had to add them manually to my path variables, not that that's anything unique to this experience, nor was it hard to figure out. The former *did* take a while though.
12:35Shambles_technomancy: Yes, to the needing a batch file.
12:35technomancysure; I don't think there's any way around the PATH issue
12:35timvisher|workShamles_: something is going very wrong with your system. :)
12:35timvisher|workShambles_: ^
12:35technomancyShambles_: why did you need to "launch Clojure"?
12:36technomancyClojure is not an end-user application, it's a library
12:36Shambles_technomancy: So I could type (+ 2 2) at the REPL and see it working before moving on to greater things like getting Eclipse working with it.
12:36technomancydid you try `lein repl`?
12:37Shambles_Also, I might someday want to run it from the command line. People do this sort of thing all the time with most Lisps.
12:37Shambles_lein wasn't on the system at the time. I didn't even know it existed until I found stuff I wanted to install requiring it.
12:37Shambles_Namely, seesaw.
12:37technomancyoh, ok; so this is before you found lein.
12:38timvisher|workShambles_: most people I've heard at this point recommend just using lein or cake and not bothering to write all your own bootstrapping code
12:38timvisher|workif you had to do all of that bootstrapping work yourself i definitely appreciate your pain
12:38timvisher|worki'd recommend getting rid of all of it and just using lein
12:38technomancyif you have any details about the specifics of the install instructions that didn't work it would be great if you could open a bug report
12:39Shambles_timvisher|work: Oh I've learned more than I expected to need to to be able to type stuff at Clojure. Cake, for instace, has been integrated into Leiningen, and seems to no longer be recommended for that reason (thank God... the last thing I need is more stuff to install just so I can install stuff that I actually want :P ).
12:39technomancyclojurebot: yo dawg I heard...
12:39clojurebotjava.lang.SecurityException: You tripped the alarm! def is bad!
12:39technomancyo_O
12:39timvisher|workand in fact all of that goes away as far as i know if you're using ccw. i don't think you're even supposed to be required to have clojure or lein on your system
12:40timvisher|workcake got integrated in to lein?
12:40Shambles_Well, here's how I got to this point...
12:40timvisher|workwhen'd that happen? :)
12:40technomancytimvisher|work: announced at the last conj
12:40timvisher|workgood stuff
12:40timvisher|worki've still yet to watch all the videos
12:41timvisher|workso how awesome was bodil's video, eh?
12:41Shambles_Once upon a time I wanted to mess with a Scheme, with nice I/O facilities. Unfortunately, I ran into some snags... things it just couldn't do, or be made to do, without dealing with the FFI and (if I want the patch accepted) writing code for a OS I don't have access to.
12:41timvisher|workpretty freaking awesome
12:42technomancystill need to watch that one
12:42timvisher|workhaha! i'm watching cemerick's what sucks video _literally_ right now and _literally_ he's talking about crossing the chasm of installing clojure
12:42timvisher|workapropos…
12:43Shambles_Eventually I settled on something that would run on the JVM or CLR. While there's several Lisp and Schemes that do this, a lot of them have /other/ limitations. Eventually I ended up picking Clojure.
12:43Shambles_So I go to the Clojure website, download it, and try to make it do something.
12:43Shambles_Hence the BAT adventure.
12:43timvisher|workyep
12:43timvisher|worki don't think anything you did was non-sensical
12:43foxdonuttimvisher|work: link to video list?
12:44timvisher|worki think you just got unlucky with your search results and got some bad starting advice
12:44timvisher|workfoxdonut: http://www.infoq.com/presentations/What-Sucks-about-Clojure-and-Why-You-ll-Love-It-Anyway
12:44Shambles_Then I start looking for something with acceptable paren matching that doesn't randomly hang on Windows like the Cygwin EMACS port has done for about 2 years. Extra points for the ability to do things like display trees without resorting to ASCII art.
12:44timvisher|workbut the full 2012 conj is up on blip, no? http://blip.tv/clojure
12:44cgagyou should just run linux in a vm
12:44uvtc~getting-started
12:44clojurebotMaybe have a look at http://dev.clojure.org/display/doc/Getting+Started .
12:44Shambles_Then I find out all these nifty libraries, like the one I found before picking Clojure which adds continuations back in, require this Lein thing...
12:45Shambles_So... more 'fun'. :P
12:45timvisher|workShambles_: why don't you just use emacsw32?
12:45timvisher|workit's stable as all get out and works great within the whole eco-system
12:45foxdonuttimvisher|work: thanks! combination of two links is what I was hoping for :)
12:45timvisher|worki do full slime/swank/lein clojure all the time on windows
12:45timvisher|workfoxdonut: yessir
12:46technomancyoh nice; when did vimeo start offering video downloads without logging in?
12:46Shambles_timvisher|work: I do believe it would have the same 'hangs at random' issues the Cygwin port does, since I think it is in fact the Cygwin port. Also, it doesn't do the "displays trees without resorting to ASCII art" and other such things. It does a dandy job matching parens and auto-reformatting code, at least.
12:46timvisher|worktechnomancy: always had if uploader allowed it, i thought
12:46metajackI'm watching a vimeo video now and it doesn't have a download link. So it must depend on something other than login state.
12:47foxdonuttechnomancy: I always just find the videos in the browser's cache ;)
12:47timvisher|workShambles_: what feature displays trees?
12:47timvisher|workand it's definitely not the cygwin port
12:47technomancytimvisher|work: oh, so now I know who to blame =)
12:47technomancyfoxdonut: there's a trick you can do with the RSS feed
12:47technomancyor maybe that's blip.tv
12:47foxdonuttechnomancy: vimeo, blip.tv, youtube, whatever, it doesn't matter, I just find them in the cache!
12:47timvisher|workit can't be because cygwin is emulating linux system calls to it's sub-processes
12:48Shambles_I could run Linux in a VM, but I have a Linux box next to me. I just happen to like to be able to develop on whatever I please. Really "switch operating systems" isn't a great answer for something that's supposed to have write-once run-anywhere as a feature. :P
12:48Wild_Catalso, blip.tv currently fails miserably with recent versions of Chrome dev.
12:48technomancyfoxdonut: handy
12:48cgagShambles_: ha i know, sorry... it just sounds so much more painful on windows
12:48timvisher|workShambles_: that's one of the big reasons i chose emacs, because it does work so seamlessly across my windows box and my mac
12:48Shambles_timvisher|work: There's some elisp code to display trees in EMACS to make it closer to a modern IDE. It has to do it with ASCII art.
12:49timvisher|workis that CEDET?
12:49timvisher|worki've never gone back to wanting trees even since i found textmate-minor-mode's find-file-in-project
12:49timvisher|workso much faster
12:49technomancyfor the record, I've never claimed Leiningen is write-once-run-anywhere =)
12:50timvisher|workbesides when i was using eclipse, I inevitably configured it to hide the project tree because clicking through that is just so darn inneficient
12:50timvisher|worktechnomancy: but it's been that so far ;)
12:50technomancytimvisher|work: it's more like "it currently happens to mostly work on Windows due to the efforts of some volunteers"
12:51Shambles_timvisher|work: I don't recall. I haven't attempted to use EMACS for anything more complex than editing text files in quite some time. I do like it for that. I just don't like it much for anything that actually needs more than text mode.
12:51timvisher|workShambles_: more than acceptable, of course. whatever tool fits you best is the tool you should use. my major point from before this discussion is that all of the tools, ccw/lein/cake/etc. are all trying to stop you from ever having to write your own bat files to run a repl
12:52Shambles_When working in IDE's I tend to double click the title bar of the code window when I want to edit code, then double click again to get the various browsing windows back. Avoids the whole inefficient use of space thng.
12:53timvisher|worki got very used to navigating to them via their various alt-* hotkeys if i needed them to pop up and navigating around my source with things like their class or symbol search functions
12:53Shambles_timvisher|work: Given Clojure doesn't come with anything to allow you to use it, and tells you itself that to get a REPL you can work with you can type <long command line>, its really a pretty obvious thing to do.
12:53timvisher|workwhich is basically what find-file-in-project gets me
12:53Shambles_timvisher|work: On my adventures I encountered 'Lispbox' equivalents, but all were horribly out of date.
12:54cgagthat long command was a pretty big turn off when i first tried to get started with clojure, before lein
12:54Shambles_timvisher|work: But hey, you can do GUI's and sound with them, at least! ;)
12:54timvisher|workyou can do guis and sound with clojure too. :)
12:54Shambles_Well, my 'long command line' is now "clojure", so it acts just like the Python I'm used to. :P
12:54technomancyClojure needs to stop telling people to launch it with java -cp [...]
12:54Shambles_Though I'm told I probably should have named it "clj".
12:55technomancythat's a crappy experience
12:55timvisher|workwatched the overtone presentation from the conj?
12:55hiredmantechnomancy: it works fine
12:55timvisher|workShambles_: better might be `lein repl`
12:55timvisher|workand possibly having an alias set up or a bat file
12:56technomancyhiredman: discerning hackers insist on rlwrap-brand console interaction.
12:56cgagShambles_: yeah, i didn't know much about writing bash scripts/functions at the time, or anything about classpaths, it took me forever to get to the point of being able to just run "clj"
12:56hiredmantechnomancy: that's just not true
12:56Shambles_technomancy: It would be crappier if there was no REPL at all. What would be better is saying "Clojure is meant to be run through one of these fine interfaces <big list>" and for those 'fine interfaces' to come pre bundled with nice installers/packages, or at least with a explanation of the necessary CLASSPATH fiddling.
12:56timvisher|workand pomade for their hair
12:57Shambles_I mean, after getting past writing the batch file, it's easy enough to use, it just doesn't /come/ with a reasonable batch file or shell script.
12:57timvisher|workShambles_: lein doesn't require any CLASSPATH fiddling
12:57timvisher|workall the batteries are included
12:57cgagnow i pretty much never run clojure outside of lein though
12:57hiredmandiscerning hackers started using clojure before there was any tooling
12:57technomancyif the word classpath appears on the splash page of clojure.org we might as well go home =(
12:57Shambles_timvisher|work: lein definitely *does* require CLASSPATH fiddling to get set up.
12:57hiredmantechnomancy: as you know I work from home
12:58technomancyhiredman: convenient, innit? =)
12:58timvisher|workdid you follow the install via the bat file?
12:58hiredmanpeople complain and complain
12:58Shambles_timvisher|work: Try running it on Windows without having your CLASSPATH aimed at the directory you unzipped Clojure in. For extra fun, try running it with the CLASSPATH aimed at the JAR, rather than the directory.
12:58timvisher|workwithout having your CLASSPATH set, which you should almost never do anyway on a systemwide basis?
12:58hiredmanand guess what, they would complain and stumble around no matter what
12:58timvisher|workShambles_: that is how i run it every day
12:58timvisher|worki've never directly downloaded the clojure jar files
12:59timvisher|worki don't have them anywhere but in the .m2 directory of my home directory
12:59Shambles_timvisher|work: I just spent several hours getting it to work on Windows XP, so I'm quite convinced it's necessary.
12:59timvisher|worki'm on windows xp too
12:59technomancyShambles_: for the record you're the first person to report so
12:59clojurebotRecords (and, long ago, structs) are "advanced features", which can cause significant pain if you don't get all the subtleties. If you're using them to create "classes" because classes are awesome, then you are probably better off just using plain old hashmaps, possibly with a :type key if you want to be clear about what type they are.
12:59timvisher|workif you're system is working for you, that's great. i'm just saying that it doesn't have to be quite so complicated. :)
12:59hiredmanso going on and on about the classpath and hiding it is such a waste
13:00timvisher|workclojurebot: always a contributor
13:00clojurebotexcusez-moi
13:00timvisher|workclojurebot: exactly
13:00clojurebotHuh?
13:00timvisher|workclojurebot: i know right. talked to elisa lately?
13:00clojurebotExcuse me?
13:00technomancytimvisher|work: he's like the kid who's trying to be part of the conversation so he interjects because he hears a word he recognizes even though it's not relevant.
13:00hiredmanit is a basic feature of the runtime
13:01timvisher|worktechnomancy: you're making fun of me again, aren't you…
13:01technomancytimvisher|work: no, it just literally reminds me of my kids
13:01Shambles_I'm aware that the CLASSPATH is just how the JVM works. I haven't used many Java applications before, and the few that I have used actually got launched via a batch file or shell script that came with the program.
13:02timvisher|worklol
13:02tbaldridgeThe classpath stuff delayed my Clojure experience by about half a year. I picked it up, got insanely frustrated, and gave up. Once I found lein, I picked it up again.
13:02timvisher|workShambles_: the CLASSPATH is maybe one of the least understood and there-be-dragons part of the java start up experience in any language on the jvm
13:02S11001001,'[a: b]
13:02timvisher|workthus most tools desperately try to hide you from it
13:02clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: a:>
13:03timvisher|worktake Eclipse and how it works
13:03S11001001,'[a : b]
13:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Invalid token: :>
13:03timvisher|worklein does a great job of making it totally unnecessary, on any system, to mess with your classpath directly
13:03foxdonut(inc timvisher|work)
13:03lazybot⇒ 1
13:03timvisher|worktechnomancy: actually, if your CLASSPATH _is_ set, will that mess with lein or does it ignore it?
13:04technomancytimvisher|work: newer versions ignore it entirely because nearly 100% of the people who set it are confused.
13:04timvisher|workit sounds like Shambles_ had already set the CLASSPATH up before trying to get in to lein, so perhaps that's one of the problems?
13:04Shambles_I don't give up easily. I can generally get through anything, no matter how bad the UI. So far I've survived X-Window during the time it required manually written modelines, set up pppd and diald when it had to be done manually, used ML-Donkey (worst UI I've ever seen, even worse than X's old configs), and gotten rather good with Blender.
13:04timvisher|workwhat about 1.7.1?
13:04technomancyI think 1.7.1 still checks it
13:04timvisher|workShambles_: you said you started with 1.7.1?
13:05technomancybut yeah, if there was stuff that was interfering it already in the env var then you would have to mess with it to get things working
13:05timvisher|workmy favorite window manager remains toms
13:05technomancywhich is why it's best just to skip it entirely
13:05timvisher|workthat gorgeous green they chose is wonderfully soothing
13:05Shambles_timvisher|work: Yes, I was trying to use 1.7.1. After switching to the 2.0.0-preview6 it solved my problem of forcing me to use Clojure 1.3. It now uses whatever I tell it to.
13:07timvisher|workShambles_: so it sounds, perhaps, like the progression was: 1. Download clojure and follow core's awful instructions for getting set up. 2. Realize you need your CLASSPATH set and set it in your environment. 3. Realize that it's crazy to do that and find out about lein. 4. Use 1.7.1 which honors the CLASSPATH which is probably at this point in an undefined state. 5. Use lein latest which ignores the CLASSPATH and now everything
13:07zach_Can anyone recommend a good clojure noir project to look to for testing inspiration? I'm a bit new to testing in general, and would love an example.
13:07timvisher|workso i bet now if you were to unset your CLASSPATH completely and run lein repl, you'd be right as rain
13:07timvisher|workzach_: what kind of testing are you doing?
13:08zach_timvisher|work: at the moment, pretty basic unit
13:08zach_timvisher|work: eventually integration
13:08Shambles_timvisher|work: Close. You left out the "decided I needed a reasonable IDE" and flailing about until I decided on Eclipse and Counterclockwise.
13:08timvisher|workof what part of the code?
13:08timvisher|workunit testing the pages themselves or your functions?
13:08zach_models
13:08Shambles_timvisher|work: Also, something I haven't mentioned yet, just for fun...
13:08gfredericksanybody have an opinion on if (def-wrapper-macro ...) would be an appropriate addition to clojure.tools.macro?
13:08zach_so, functions
13:08timvisher|workhave you looked in to simply using http://richhickey.github.com/clojure/clojure.test-api.html
13:08lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.test-api.html and try to stop linking to rich's repo.
13:09Shambles_timvisher|work: Counterclockwise actually has extensions for working with Leiningen, but will only offer to install them if it can find Leiningen *already installed*. ;) Yes, I found this out by having to reinstall it.
13:09timvisher|worklazybot: good job
13:09timvisher|workduckduckgo: bad!
13:09timvisher|workShambles_: ah! i thought it was fully integrated at this point
13:09foxdonutduckduckgo?
13:10timvisher|workhttp://duckduckgo.com/
13:10zach_timvisher|work: Yes, I was planning on using clojure.test :). I was more thinking along the lines of organization, etc; but maybe I don't need to be worrying about that.
13:10timvisher|workif you simply do a `lein new`, that gives you a pretty good organization to start with
13:10timvisher|workbut it doesn't provide great names for your test namespaces
13:10Shambles_So basically apparently what you're supposed to do is magically know you need this weird installer thing (that particular weird installer, not any of the less popular ones). Put it on. The 2.x ones, not the 1.x ones, because they're busted with Counterclockwise. Then put on Eclipse. Then put on Counterclockwise. If you do that, maybe you'd only have to fight your PATH, which isn't so bad.
13:11foxdonuttimvisher|work: geez, ok.. :)
13:11Shambles_I haven't figured out what to do about installing these fun addons yet, so I may be in for more adventures.
13:11technomancyShambles_: I hope the 1.x/2.x confusion can be reduced soon; I recently switched over the docs to point all new users at 2.x
13:11timvisher|workfoxdonut: what you don't like it? ;)
13:12zach_timvisher|work: What kind of namespacing would you recommend? project.test.models.model, for example?
13:12foxdonuttimvisher|work: don't get me wrong, I love ducks!
13:12zach_timvisher|work: Or is that getting too specific?
13:12Shambles_technomancy: In my opinion if lein is going to be this vital, and supposed to be installed before everything else, Clojure should just ship with it.
13:12timvisher|worki've been writing things ilke project.test.it-should-allow-users-to-authenticate
13:12timvisher|workfollowing BDD a bit more, perhaps
13:12technomancyShambles_: it's more a question of getting the right links on clojure.org I think
13:13zach_timvisher|work: Interesting, okay. Thanks for the ideas :)
13:13timvisher|workbut the standard project.foo tests being located in project.test.foo gets you pretty far
13:13technomancysince "ship with it" doesn't really make sense; clojure.org shouldn't ship anything
13:13Shambles_technomancy: I also think it should ship with working batch files and shell scripts so you can just run Clojure without having some other environment, to at least let you know it's working (e.g. that your JVM isn't horribly out of date or something).
13:13technomancyShambles_: most of the wiki pages that are editable by the community already point you to the right place, but clojure/core has been very slow in getting updates to clojure.org and doesn't seem to prioritize "getting started" issues very highly
13:14Shambles_If you don't like the word "ship", how about "include it in a installer".
13:14timvisher|workzach_: do keep in mind, if you're newer to clojure, that namespaces with `-`s have to have all of them translated to `_` in the file itself
13:14timvisher|worki shoot myself in the foot with that semi-regularly
13:14arrdemis there some way I can make the Clojure compiler ignore unbound symbols?
13:15arrdem*not ignore, but not error on.
13:15timvisher|workShambles_: the thing is that clojure isn't really an installable thing
13:15timvisher|workat least not at this turn
13:15timvisher|workalthough i'd agree with you if you said that that's a bit confusing
13:15technomancymaybe someone should write a setup.exe wizard installer type thing for leiningen
13:16technomancyhaving to manually hunt down curl is kind of silly
13:16timvisher|worktechnomancy: it shouldn't really be needed. the bat file works fine
13:16timvisher|workwell-
13:16timvisher|workthat's true
13:16timvisher|worki do think it's more of a question of the clojure.org pointers all being outdated at this poin
13:16timvisher|workpoint*
13:17zach_timvisher|work: oh, cool! Thanks for the tip
13:17dgrnbrgtechnomancy: is there a way in lein1 to have a plugin run stuff when init.clj is run, even if that plugin wasn't chosen?
13:17technomancydgrnbrg: no, closest thing is adding hooks
13:17technomancydgrnbrg: it's on the table for 2.x though
13:18dgrnbrgtechnomancy: what is a hook? you mean to robert.hooke some random init fn?
13:18Shambles_timvisher|work: I know every language has the right to do its own thing, like Smalltalk thinking that OS's shouldn't exist, so it provides its own window manager and is rather filesystem hostile... but really, when someone says "I want to install Python (or Perl, or Ruby, or whatever)" they go download a installer or .rpm or .deb, stick it on, then there's /at least/ a command that brings up a REPL or spews a help page (for
13:19dgrnbrgtechnomancy: I did add-hook to the function I wanted to hook in my plugin, which should modify the behavior of eval-in-subprocess, but it doesn't get loaded unless I explicitly call
13:19timvisher|workShambles_: I really couldn't agree more. i'm just saying that so far clojure hasn't chosen to do that, and it leads to conversations like this if the person wasn't lucky enough to find leiningen first
13:19technomancydgrnbrg: yeah, no way getting around the explicit :hooks declaration so far
13:19dgrnbrgis that in project.clj?
13:19Shambles_timvisher|work: At no point when starting out with any other language would a package installer be the first thing I thought about. I wouldn't have said, you know, py2exe is really kick ass... Then install it, and realize... "Oh, I need that Python language thing, so I can write programs in it." It's kind of like picking out nice wagon wheels before you own a horse.
13:19technomancyyeah
13:20technomancyShambles_: even if that's the right way to do it, that would require buy-in from clojure/core who have been very resistant so far. plus it would mean improvements on that would all have to go through the slow CA/patches-on-jira process; yuck
13:20timvisher|workShambles_: agreed, again, but i would say that lein is much more than a package installer
13:21timvisher|workit's like gem + rake combined, or something
13:21timvisher|workor gradle or maven if you've used those
13:21S11001001interesting, I always look for build tools first
13:21timvisher|worki think that may be a source of confusion for you
13:21dgrnbrgtechnomancy: is the :hook namespace in a :dependency of the project, not a lein plugin? and do I need to set eval-in-leiningen to true if the hook is coming from a project I have listed as a dependency?
13:21Shambles_technomancy: Since Clojure is very distributed (not necessarily a good thing... everything in one place, like CPAN, makes it easy to browse), maybe the best solution would be a installer that queried (at least) the Clojure and Leiningen websites, and downloaded/installed them in the appropriate places. Then no cooperation would be necessary.
13:22foxdonutJust use lein. It does everything. It even keeps your coffee hot and your beer cold :-)
13:22Shambles_After that, the rest wouldn't be that painful.
13:22technomancyI don't get it; why would you want that?
13:22timvisher|workfoxdonut: it makes great table conversation with my wife and kids, as well
13:23dgrnbrgtechnomancy: to me or Shambles_ ?
13:23technomancydgrnbrg: that was to Shambles_; I don't follow your question.
13:23foxdonuttimvisher|work: yeah, but nothing beats Smalltalk for that!
13:23Shambles_technomancy: Why would I want Clojure to come with Leiningen?
13:23technomancythe namespace for the :hooks entries need to come from plugins
13:23technomancyShambles_: it already does
13:23Shambles_technomancy: Let me reword that.
13:24Shambles_technomancy: "Why would I want it to be impossible to install Clojure without Leiningen?"
13:24S11001001I don't see an issue with that
13:24timvisher|workShambles_: simplicity ;)
13:24Shambles_technomancy: The answer is "to avoid what I went through, because I didn't psychically know I needed a obscure piece of software I would never have installed willingly otherwise".
13:24timvisher|workit's not impossible, any way, you appear to have succeeded in doing so
13:25timvisher|workbut the tool does make it much nicer
13:25S11001001I think obscure might be a little extreme
13:25technomancyShambles_: sounds like a documentation problem to me
13:25dgrnbrgtechnomancy: i need to hook eval-in-subprocess to use lein in my environment, which requires running java classes with a weird, custom jvm-ish thing that needs a bunch of arg-munging. I have an init.clj that does the "right thing" and makes lein work, but i want to bundle it up into a lib/plugin, so that it's repeatable for everyone else in the firm. Since I can't force a plugin to get loaded every time lein is loaded, i need to use a hook. Is
13:25dgrnbrg:hook referring to a namespace in the :dependencies of the project (so that my init.clj code can be in a separate project)?
13:25S11001001you know, typesafe did a super-fancy installer package for scala
13:25Shambles_technomancy: Honestly I'm a fan of 'download a file, and run the installer'. I wouldn't go looking for programs to fetch stuff off remote repositories and build it. I know Clojure does things that way now. I know it would have avoided me needing to do some work. But it's extremely unintuitive.
13:25S11001001they also left out scala; it just installs the build tool
13:26timvisher|workS11001001: you're name is the one i fear most while i'm here typing into web irc
13:26foxdonutShambles_: what piece of software are you referring to?
13:26timvisher|workbut i'm getting pretty good at typing it nonetheless ^_^
13:26technomancyit's hard enough to get clojure/core to pay attention to issues when they're focused on making clojure a library. if you turn it into a user-level application too that just puts more work on their plate that they've repeatedly shown they're not interested in.
13:26Shambles_technomancy: Criticizing is really like yelling at the guy for not having bought nice wagon wheels before he bought a horse off you. It's irrational. If Leiningen is necessary to use Clojure, it should come with Clojure. Maybe you don't wanna deal with the Clojure guy directly for every little thing. The 'fetch and install the latest version of both' installer would avoid the need.
13:27timvisher|workShambles_: the thing is that it's not necessary
13:27Shambles_foxdonut: Leiningen. It's not something I knew about until later on. It's not something I would ever have wanted normally.
13:27timvisher|workclojure works fine without leiningen
13:27timvisher|workit actually works like all the other java library out there, where you need to muck with your classpath and get your dependencies right etc.
13:27timvisher|workyour criticism is more of the jvm and how it works, which sadly isn't changing any time soon
13:28foxdonutShambles_: it's not hard to run clojure without lein. With or without lein, the vast majority of people don't seem to have a problem getting up and running. So I wouldn't say it's "extremely unintuitive".
13:28technomancyI agree the instructions on clojure.org are not very good, and I wish we could do something about them.
13:28Shambles_timvisher|work: So long as you don't want to install anything that uses it, yes. Also, mind you you didn't think you should be able to use the REPL without some other environment (Clojure is a library), so without other software Clojure would be a nice file taking up space on your hard drive.
13:28timvisher|workShambles_: you mean without the jvm?
13:29timvisher|workbecause as long as you do have the jvm, installing other libraries for clojure to use is as intuitive as anything else on the jvm without a tool
13:29Shambles_timvisher|work: I mean without a batch file or shell script to make it into a reasonable command you could use to bring op the REPL.
13:29timvisher|workbut things like ant, maven, gradle, etc. exist because everyone hates that
13:29timvisher|workShambles_: like i said, that's just not what clojure is trying to be
13:29technomancythis is bigger than clojure anyway; the `java` command-line launcher is a joke to begin with
13:30timvisher|workyou need a tool to make it nicer, as you do with most things in java
13:30foxdonutI wouldn't call Leiningen an "obscure piece of software", either.
13:30Shambles_foxdonut: You may need to read scrollback.
13:30timvisher|worktechnomancy: exactly
13:31Shambles_foxdonut: To someone that "wants to write in Clojure" Leiningen is likely to be the last thing on their mind. Downloading Clojure, and some IDE for it, is likely to be the first order of business. Doing that before Leiningen results in the problems I was trying to talk about, but seems nobody here wants to here it so I'll quieten down.
13:32dgrnbrgtechnomancy: if I want to use an ns with :hooks in lein1, can that ns be provided by a package in my :dependencies or :dev-dependencies?
13:33technomancydgrnbrg: it has to be visible to leiningen's process, so :plugins or :dev-dependencies
13:33dgrnbrgtechnomancy: do I need to set :eval-in-leiningen to be true in the package containing the hook?
13:33timvisher|workShambles_: it's fine to gripe. i don't think anyone here thinks that clojure startup is all that intuitive
13:33technomancydgrnbrg: no, :eval-in-leiningen is only relevant when developing on that project itself
13:33timvisher|workthe point is that there are things that make it nice and there aren't many good ways to fix what lead you to here
13:33technomancyonce you're consuming it as a dependency it's ignored
13:34Shambles_timvisher|work: Rather than agreeing with me All I heard was you, technomancy, and now foxdonut criticizing me for not psychically knowing I should have installed something I would have had no reason to look for.
13:34foxdonutShambles_: "Doing that before Leiningen results in problems"-- again, I disagree, because many, many people have done that successfully. Now, being familiar with Java, the JVM, and the classpath certainly helps, and that is probably the target of your discontent, not Clojure itself.
13:35technomancyuh no, I said it sucks that the documentation is bad and I wish I could fix it.
13:35dgrnbrgtechnomancy: I have the :hooks set, and the project as a dev-dependency, but I do not think that the hook is running when i do "lein nailgun"
13:35dgrnbrgis there a way to debug the hooks?
13:36technomancythrow a few printlns in the hook defn I guess
13:36Shambles_timvisher|work: There's good ways to fix what lead me here, yes. Python has Eggs. You download a file, then run the built in (comes with Python) egg installer. Racket has the (planet path/packagename:major:minor:file) 'inclusion' that goes and fetches packages off the central repository if it's not in your cache... All these work out of the box with little to no effort.
13:37Shambles_timvisher|work: The package handler needs to come with the basic programming environment, however the problem is solved.
13:37Shambles_That doesn't mean it has to be in the same file, or that the authors have to cooperate much, but both need to end up on the user's system at the same time.
13:38foxdonutShambles_: at the very basic, you could just download clojure.jar and run "java -cp clojure.jar clojure.main" to get a REPL. Done. What's so hard about that?
13:38Shambles_foxdonut: Try making it work on Windows such that you aren't dependent on the directory name.
13:39Shambles_foxdonut: And that it can be launched by including whatever directory it's in, in your path.
13:39Shambles_foxdonut: Though again that only solves the getting the REPL working, not all the rest of this stuff, which was due to me not installing Leiningen first.
13:46TimMcBasically, clojure.org is a complete mess.
13:46TimMcfoxdonut: Nice try.
13:46dgrnbrgShambles_: it is a shame that clojure.org doesn't refer to leiningen
13:47dgrnbrgit's the most awesome tool i've ever used
13:47foxdonut(inc TimMc)
13:47lazybot⇒ 8
13:47Shambles_So far I've been fairly pleased with the language itself. The stuff it didn't come with that I wanted, I was able to find libraries for. It's just the installation that's been painful.
13:47arrdemShambles_: which is where lein comes in...
13:48arrdemwith beer and deps.
13:48dgrnbrgShambles_: once you rock out with lein, you'll realize how productive you can be. With lein vimclojure, lein test, lein deps, lein swank
13:48dgrnbrgor lein clojars, lein hadoop, lein guzheng (shameless plug)
13:48dgrnbrgi just listed deployment, testing, code coverage, and repl tools
13:49TimMcShambles_: Unfortunately, clojure.org is controlled by folks who don't have the time+inclination to maintain it.
13:49arrdemOkay. so it's nailgun for EMACS
13:50Shambles_Things I liked that I found on clojure.org was a description of how it differs from other Lisps, the cheat sheet, and the special forms list (mostly due to the discussion of the threading operator, which I haven't seen elsewhere).
13:50dgrnbrgShambles_: have you seen clojuredocs.org?
13:50dgrnbrgthat's better for documentation, imo
13:50Shambles_dgrnbrg: I haven't.
13:50dgrnbrgit's my favorite for user contributed examples + good organization
13:50arrdemclojuredocs is way better... mostly due to the examples
13:50dgrnbrgbut it's only useful for the core
13:51scriptorclojuredocs has good search too
13:52Shambles_I know about Clojars. It's your rough equivalent to CPAN, Python Cheese Shop, or PLaneT. Hadoop is familiar for some reason, but I don't know why, and I haven't seen that last one.
13:52Shambles_Clojars should be a lot more 'visible' IMO, but that'd require clojure.org cooperation.
13:52redwireI'm having some trouble with some code. http://pastebin.com/ZaxzTixE For some reason when load this I get java.lang.Exception: Unmatched delimiter: ) (wordtree.clj:17) though I'm sure the parens are matched and everything runs when I take out the println call.
13:53hiredmanredwire: 't'
13:53aaelonyuse one single quote
13:53redwireOh shoot it's \t in Clojure, isn't it?
13:53hiredmanalso 'a'
13:53hiredmanand 't' again
13:53hiredmanand use of structmaps
13:53uvtcTimMc, re. "time and inclination to maintain it", that doesn't make sense to me --- wouldn't they just delegate it to whomever's interested in getting it updated?
13:53redwireWhat's wrong with the use of structmaps?
13:54dnolenredwire: deprecated.
13:54redwireReally? I see. Normal maps, then?
13:54dgrnbrgShambles_: clojars is just a maven repo--it's very hard/impossible to search for content, as it's just a thin view of maven. Plus, lein automagically searches it for you, so you almost never need it
13:54dgrnbrgand if you use lein outdated, it'll tell you which libs have newer version available
13:55uvtcShambles_, btw, re. Python eggs, they're going away I think.
13:55arrdemredwire: deftype if possible...
13:55dnolenredwire: normal maps work great, also defrecord
13:56dnolenarrdem: defrecord closer to what structmap provides.
13:56arrdemdnolen: can you extend a deftype? I know that defrecord will let you spec a minimum key set..
13:57TimMcuvtc: I dunno, it seems like they don't trust the community to be a good resource. clojure.org is so self-contained, insular... I don't recall seeing any outbound links to community resources.
13:57TimMcSO that's a factor as well.
13:57dnolenarrdem: deftype is primitive, defines nothing.
13:57Shambles_uvtc: They've talked about the setuptools being replaced for quite some time, but in practice, nothing seems to ever be done. If that does happen, something else egg compatible will replace them. There's too much on the Python Cheese Shop to just get rid of support for it.
13:58redwireThanks for the help, guys. Works just fine, now.
13:58ystaeldgrnbrg: i'm trying out lein-guzheng ... would you have any insight into a Exception in thread "main" java.lang.RuntimeException: No such namespace: color , given that nothing named "color" appears anywhere in my code?
13:58uvtcShambles_, should change once 3.3 is released.
13:58foxdonutredwire: cool nick
13:58raekarrdem|lunch: you can assoc as many key-value pairs as you like with records
13:58redwireThank you.
13:59raek(so they are not limited to the ones you declare)
13:59dgrnbrgystael: could you post the whole stack trace on paste bin?
13:59arrdem|lunchraek: thanks that's what I thought.
13:59uvtcTimMc, Ah. Hm. Reminds me ... I think I recall discussion on clojure-dev about removing the link to the wiki.
13:59dgrnbrgystael: how are you invoking it?
13:59dgrnbrgusually you want something like "lein guzheng myproject.core -- test"
14:00ystaeldgrnbrg: yes, precisely, though with 'midje' in place of 'test'
14:00dgrnbrgystael: i've never tried it with midge, but i don't know why it wouldn't work...
14:00dgrnbrglein1 or lein2?
14:00raekmidje uses colored text output by default
14:00Shambles_uvtc: I see mention of new packaging tools, but nothing saying packages are going away. Sane package management supplied with the language is a pretty popular feature.
14:01raekso the color thing could be from midje
14:01ystaellein2.
14:01uvtcTimMc, yeah, here: http://groups.google.com/group/clojure-dev/browse_thread/thread/8ec1a5fc5e5f1a2f#
14:01raekystael: you use the 2.0.0-SNAPSHOT version of lein-midje?
14:01ystaelraek: yes
14:02dgrnbrgystael: i'm going to open an issue on guzheng to add a test for midje
14:03dgrnbrgif you'd like to follow it: https://github.com/dgrnbrg/lein-guzheng/issues/2
14:04Shambles_dgrnbrg: Do you have plans for using guzheng?
14:04ystaeldgrnbrg: cool, thanks much
14:04TimMcuvtc: Hmm, that's not so bad. And I just found that I can find out about Lein in 2 clicks from the main clojure.org page, although it should only be one click.
14:05ystaelstack trace is at https://gist.github.com/2a56d48f9e771c6d3b64
14:05dgrnbrgShambles_: what do you mean? I wrote it for giving test coverage info, and i use it in my projects
14:05Shambles_dgrnbrg: I wasn't sure if you had a particular use in mind. I can think of something to use it for, but that wasn't it, though that's a good use too.
14:06dgrnbrgShambles_: guzheng is a tool for writing clojure transformations by hooking into the loader
14:06Shambles_dgrnbrg: I was thinking about something like http://groups.csail.mit.edu/pag/daikon/
14:06dgrnbrgi wrote a branch coverage analyzer for it, and a lein plugin to use it
14:06uvtcThere should be a note at the top of http://clojure.org/downloads saying, "though, for regular use, install [Leiningen] and have it take care of getting Clojure for you".
14:06TimMcOof, that too.
14:07Shambles_uvtc: Yes. What you just said would have avoided a lot of difficulty on my part.
14:07Wild_CatI gotta admit leiningen is fairly awesome.
14:07Shambles_What uvtc said is exactly what's needed.
14:07technomancyShambles_: maybe if you make some noise on the clojure mailing list it would help
14:07dgrnbrgi suppose it'd be doable to do so, but i'm probably going to stick with the branch analysis--it's all i need, and i have other projects
14:07Wild_Catcompared to most languages' built-in dependency managers/build utilities, it's the only one that comes close to maven.
14:07cmajor7is there a way to get both {:published "2008-02-13" :title "clojure is the best lisp yet"} in a single call to "xml->" from http://bit.ly/NnT3mE? e.g. I can easily get one as "(xml1-> books :entry :title text)"
14:09Shambles_technomancy: I'm still getting used to being able to do basic things in the language, and I tend to be both a bit uncomfortable on mailing lists and not real pleased with the mail volume. I could deal with it, but I'm not sure how much good I'd do at this point, especially since it sounds like the person in charge of the website doesn't care about the issue.
14:09technomancypart of the reason they don't care is probably that they don't understand the newcomer's perspective
14:10uvtcWill post that to the ML right now.
14:10TimMcThanks, uvtc!
14:10Shambles_I can't really be the first one that's come here wondering what's up with the classpath mess, or how everything seems to require lein, or how installing anything before lein tends to not work very well (e.g. that Counterclockwise behavior I mentioned).
14:10TimMcShambles_: You're not.
14:11redwireI've been there. I've been very frustrated sometimes about only being told "use lein" when my first install of clojure via aptitude didn't work well.
14:11TimMcI don't think anyone's arguing against you, there...
14:12xcliteShambles_: Those same thoughts annoyed me when I tried to dive in recently - been on the back burner since due to other priorities
14:13Shambles_Well, since I've battled through that on my own, and someone here (I now forget who, I think it was timvisher) helped me figure out why I couldn't launch a REPL in anything but 1.3.0... will I be able to build/install most anything with "leiin install", even if it doesn't come with instructions?
14:14gtrak`looks like the riddell guy took down his site finally
14:14lazybotThe riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.finally
14:14Shambles_For example, this: https://github.com/swannodette/delimc
14:15raekShambles_: are you going to hack on the delimc code or just use it?
14:15TimMcShambles_: lein install doesn't do what you think it does -- see `lein help install`
14:15Shambles_raek: I'd like to just use it, for now at least.
14:16foxdonutShambles_: sorry if you've been having some trouble, and for my coming off negatively earlier. that wasn't cool and I apologize.
14:16uvtcTimMc, y/w!
14:16raekthen you don't need to install anything. you add it to your :dependencies in your project.clj
14:17Shambles_foxdonut: I'm used to getting worse on other programming channels. I'd just decided I was either a jerk, and/or most programmers were, and you sort of have to grin and bear it to get the information you need. I've been pleasantly surprised on a few channels, though I haven't figured out why they're different from others.
14:17raekis "lein install" mostly used by library authors to try a library before publishing it
14:18raek*"lein install" is
14:18Shambles_raek: I see.
14:18gtrak`lein install is equivalent to mvn install, Shambles_ lein has a lot do with maven in java-land
14:18foxdonutShambles_: we'll never be the worst as long as there is #hibernate ;-)
14:19gtrak`a lot to do*
14:19Shambles_I was basing that on this: Clone Seesaw from github. Fork if you like. Switch to the "develop" branch. In your Seesaw checkout, run lein install to build it In your project's project.clj file, change the Seesaw version to X.Y.Z-SNAPSHOT to match whatever's in Seesaw's project.clj. Run lein deps
14:19Shambles_So I thought it was for building. I still don't have much experience with it yet.
14:20Shambles_gtrak`: I know very, very little about Java. I'm more here for "a lisp with really good I/O support" than the Java aspect.
14:20gtrak`Shambles_: yea.. github pages might assume you already know how everything works
14:22gtrak`Shambles_: I hope you're ready to learn a little java :-D
14:23gtrak`a lot of things will make more sense that way
14:24Shambles_gtrak`: I got the impression I'd only need to know what to call in the standard library. I've used C++, so I doubt it'd be very difficult. I'd just rather not spend much time on it beyond the "what I need to know to call things" part.
14:25gtrak`gotcha, yes, it's much less soul-crushing than C++ but there's a lot to think about as well
14:26TimMcShambles_: Clojure is not stand-alone -- you still ahve to live with some poor choices from Java-land. THe nice thing is that you get to build cleaner abstractions over them.
14:26Shambles_gtrak`: I like Lisp macros, but I hope to never have to deal with any code using template metaprogramming again, or preprocessor macros for that matter.
14:27gtrak`yes, gawd...
14:28Shambles_TimMc: I know about the "have to tell it when you want tail recursion" part, and that there's no restarts like in most Common Lisp (but you can add that back if you can get continuations going...). Is there anything else I should know about?
14:29gtrak`&(macroexpand '(let [[a b] [1 2]] [a b])) ; Shambles_ , wheeeeeeeeeeeee
14:29lazybot⇒ (let* [vec__8134 [1 2] a (clojure.core/nth vec__8134 0 nil) b (clojure.core/nth vec__8134 1 nil)] [a b])
14:29Shambles_Mostly it seems to be really hard to find any Lisp with pretty complete GUI and sound support, and Clojure should have that nailed for me.
14:29TimMc~pitfalls
14:29clojurebotIt's greek to me.
14:29borkdudeI don't like GUIs
14:29TimMcOh, that was for something else, bad fn names.
14:32gtrak`Shambles_: you'll probably want to check out overtone and upshot at some point
14:33Shambles_TimMc: Bad function names due to Java? You mean worse than cadadaaadaadr ? ;)
14:34TimMcShambles_: Nope, in Clojure! Look at the definitions of contains?, for instance.
14:34TimMc&(doc contains?)
14:34lazybot⇒ "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constan... https://www.refheap.com/paste/3277
14:35Shambles_TimMc: I guess you mostly see those in the macroexpansions?
14:37TimMcShambles_: I wouldn't say that. Dunno if I've used it in my code, though.
14:37TimMcclojurebot: contains
14:37clojurebotcontains is gotcha
14:37TimMc~gotchas
14:37clojurebotPardon?
14:37TimMc~gotcha
14:37clojurebotgotcha is contains
14:37TimMc>_<
14:37TimMcgfredericks: Is this your fault? ^
14:41Shambles_Some of the weird names can be fun, at least. I approve of "uberjar". :P
14:42nDuffHrm.
14:43nDuffIt's a bit unfortunate that clojure.core.incubator shows up in package clojure.core -- in an OSGi context, it's expected that each package is provided by one and only one jar, and that doesn't apply here.
14:46TimMcnDuff: 1-1 package and jar? o.O
14:46arrdemdoes anyone here know a good tutorial on detecting and loading jars in Clojure?
14:46nDuffTimMc: n:1; each jar can provide multiple packages, but each package must be provided by only one jar.
14:47TimMcOh, got it.
14:47TimMcSo what's happening with incubator then?
14:48nDuffTimMc: since packages are mapped by directory structure, clojure/core/incubator.clj is part of the clojure.core package
14:48nDuffTimMc: ...and clojure.core, of course, is provided by Clojure itself.
14:49Shambles_uvtc: The Brief Beginner's Guide is nice.
14:49uvtcShambles_, thanks. Share and enjoy. :)
14:50TimMcnDuff: Not getting it. The clojure.core.incubator package comes in as a separate jar from clojure.core, but is a subpackage, that's the issue?
14:50nDuffTimMc: That's the problem; it's *not* a subpackage inasmuch as OSGi is concerned.
14:50nDuffTimMc: ...so an OSGi loader tries to find clojure/core/incubator.clj in the primary Clojure bundle, ignoring the fact that a separate core-incubator bundle is installed.
14:51TimMcWhy does it try to find it there? Prefix?
14:51nDuffTimMc: ...now, if it were clojure/core/incubator/.clj, this would be a non-issue...
14:52nDuffTimMc: the manifest for OSGi bundles specifies which packages (in the Java sense) that bundle provides. Only one bundle can be wired to a given package in a single context.
14:52TimMcOh! I think I see. clojure/core/incubator.clj is a resource in clojure.core, whereas clojure.core.incubator.init (or whatever it is) is a class in the clojure.core.incubator package.
14:52nDuffRight!
14:55nDuff...given as clojure.osgi is already wrapping load-resource, it'd actually be pretty easy to modify it to also search clojure/core/incubator/.clj, but then I'd have to put together build infrastructure to create jars munged that way in the first place, and it seems a really ridiculously awful hack.
14:56cmajor7is this the best way to combine several seqs in a map with given keys (e.g. :title :published)? https://www.refheap.com/paste/3278
14:57cmajor7feels to verbose.. might have overlooked a known builtin
15:05tbaldridgeShambles_: I agree, I'd love to see better Clojure GUI support. The bad thing is, it's hard to do functional programming with GUIs
15:07Shambles_tbaldridge: Well, all of AWT and SWING should be accessible by Clojure out of the box, and then there's SWT. There's even wrappers like Seesaw. That's far better than most Lisps.
15:07pandeirocmajor7: you could eliminate a pair of parens and brackets by using hash-map instead of zipmap, but that's all i got
15:08tbaldridgeAgreed, but you still end up getting into more of a OOP situation than I would like
15:10cmajor7pandeiro: how would switch it to hash-map?
15:10Shambles_tbaldridge: As for functional GUI's, I'm not sure it's important. I don't think a lot of bugs exist because of mutable values within GUI's. It may be a bit of a PITA to hook everything up, though, and Cells is probably what you want there. There seems to be a dataflow DSL for Clojure named dgraph you could use to implement something like that.
15:10pandeirocmajor7: (map #(hash-map :title %1 :date %2) titles dates)
15:11TimMcnDuff: So when you're running in an OSGi context (I hope "context" isn't jargon for anything surprising) Clojure tries to load a namespace clj file for on-the-fly compilation, and fails. Is that what's happening?
15:12cmajor7pandeiro: was has-mapping over %1 %2 together… makes sense => thx, it is indeed cleaner
15:12nDuffTimMc: correct.
15:23solussdI know this is vague, but I'm getting a classnotfoundexception in a namespace$function only when running via 'lein run', works fine in the repl. I can verify that the namespace and function exist and I'm not AOT compiling… any ideas?
15:24solussdfurther, I do not get the error when running 'lein test'
15:24gtrak`solussd: are you importing before requiring somewhere?
15:24solussdgtrak`: probably. :D
15:24gtrak`perhaps some records have not yet been code-gen'd
15:24gtrak`or protocols?
15:24solussdill check
15:27ibdknoxHow do I change the context of macroexpansion? binding *ns* doesn't seem to do it
15:28solussdgtrak`: sadly, that doesn't seem to be it. :/
15:28TimMcibdknox: Example?
15:29ibdknoxTimMc: (binding [*ns* (create-ns 'woot)] (postwalk macroexpand-1 '(defmacro m [] `q)))
15:29gtrak`solussd: weird
15:30TimMcibdknox: Where is postwalk again?
15:30ibdknoxclojure.walk
15:31ibdknoxno matter what I do that seems to always expand into (quote user/q)
15:31amalloyibdknox: what would it mean to change the context?
15:32amalloyoh, no, of course you can't do that. syntax-quote happens at read time, before macroexpansion
15:32ibdknoxah
15:32ibdknoxhm
15:32TimMcOoh, that'll do it.
15:33amalloy(defmacro m [] (read-string "`q")) ;; lol?
15:33ibdknoxlol
15:33ibdknoxI wonder how that ends up working in a repl then
15:34TimMc&'`q ;; I think this would turn into '(syntax-quote q) in Scheme.
15:34lazybot⇒ (quote clojure.core/q)
15:34amalloyibdknox: at the repl, *ns* is bound while reading
15:34amalloy,(binding [*ns* (create-ns 'woot)] (read-string "'q"))
15:34clojurebot(quote q)
15:34amalloy,(binding [*ns* (create-ns 'woot)] (read-string "`q"))
15:34clojurebot(quote woot/q)
15:35ibdknoxgot it
15:35ibdknoxthanks :)
15:36lanceroI'm trying to encode a string to base64 with this: http://pastebin.com/h29BuhEp
15:36lanceroI get this error: clojure.lang.LineNumberingPushbackReader cannot be cast to java.io.InputStream
15:37gtrak`lancero: call input-stream on it?
15:37amalloydnolen: so it's my understanding that negation is somehow "hard" in logic programming. is implication hard too, because P->Q is effectively ~P v (P ^ Q)?
15:42lancerogtrak`: not sure what you mean
15:42gtrak`lancero: actually, from looking at clojure.java.io, I suppose you can't
15:43dnolenamalloy: implication is easy, otherwise you would haven't logic programming at all. negation is hard.
15:43dnolenamalloy: tho I read a pretty interesting paper today about getting negation into CiaoProlog ...
15:44amalloyi was thinking a solver for http://rooms.jmpup.com/#manual would be a fun first logic program, but i'm hoping to find out whether it's impossibly ambitious first :)
15:44cmajor7is there a way to parse a section of XML selectively into a map? with "xml->" I can get to the end values/tags, for the "first", for "all", but am looking to get e.g. a 3rd (whole) section.
15:47amalloythere's negation, but it's all limited enough that i think i could get around it be explicitly specifying "x is true implies XYZ" and "x is false implies [the opposite of XYZ]"
16:02gtrak`lancero: there's this though: http://commons.apache.org/io/apidocs/org/apache/commons/io/input/ReaderInputStream.html
16:05dnolenamalloy: that looks like fun. sounds like a reasonable approach.
16:05amalloythanks!
16:05dnolenamalloy: my Prolog chops are not that great - but my experience it that Prologists are fiendishly clever at getting Prolog to do interesting things.
16:05amalloyhaha
16:07dnolenamalloy: which is to say there's probably a good approach - worth popping in the Prolog channel if you're looking for tips on approach. Also Stack Overflow hasn't been bad.
16:08hiredmanthere is a prolog irc channel?
16:08dnolenhiredman: yes, pretty friendly too if not very chatty.
16:08amalloydnolen: are you saying that core.logic lacks some feature prolog has that would help with this and i should use prolog, or that prologgers would have good advice that applies equally to core.logic?
16:08borkdudehiredman if you give answers in that channel, they will ask the corresponding questions
16:08dnolensmart cookies in there that mostly get homework questions :P
16:09dnolenamalloy: they would give advice that could be readily applied to core.logic.
16:18arrdemwhat is the standard for writing and naming lein tests?
16:18clojurebotmeh
16:20TimMcclojurebot: You're trouble.
16:20clojurebotI don't understand.
16:20arrdemclojurebot just hates me.
16:21TimMcarrdem: I've never heard of a naming convention for the individual deftests.
16:21arrdemTimMc: I just looked at some git repos to get an idea... seems that you use test/<packages>/test.clj
16:22arrdemthat was all I was asking for.
16:22hiredmantest/first-part-of-namespace/test/other/parts.clj
16:22TimMcSort of. Namespace a.b.c is tested with a.b.test.c
16:22hiredmanlein new will generate test/projectname/test/core.clj
16:23TimMcAnything other than putting test at the end.
16:23arrdemduely noted.
16:23arrdemand makes sense from a naming standpoint.
16:31TimMcIt's a little irritating to work with when you want to rename namespaces (e.g. right after project setup), but not much trouble after that.
16:31amalloyTimMc: bash, find, and perl are your friends there
16:34TimMcmerrr
17:10nDuffHrm.
17:12solussdany ideas what might cause a NoClassDefFoundError only when skip-aot: true is set w/ leiningen? never get the error in the repl though. :/
17:13TimMcAre you defining any protocols, using gen-class, defrecord...
17:14solussdyes to protocols and defrecords. I made sure records are imported last in my ns macros at the top of each file…
17:14solussdi'm extending protocols in several places as well.
17:14hiredmanhave you restarted your repl recently?
17:14solussdyes, and I can reproduce on another system w/ a clean checkout of the repo
17:15hiredmanhow are you loading the code in to the repl?
17:15hiredmanand how are you loading it when you get the exception
17:15solussd(require '[my.namespace :as blah]
17:15solussd)
17:15solussd(in the repl)
17:16solussdlein run -> access page via web browser that kicks off some code
17:16solussdit works with AOT enabled though..
17:16solussdbut then I have all kinds of issues w/ clojurescript [but that's another story]
17:22brehautPeregrinePDX2: do you know about https://github.com/Sagelt/Dungeon-World ?
17:23brehautwrong channel sorry
17:24solussdbrehaut: ha. didn't stop me from clicking the link and checking it out.
17:25brehautsolussd: incase its confusing, its a tabletop roleplaying game that happens to have its source in github
17:25solussdbrehaut: yeah, i see that now-- I was at first confused by the lack of source-code.
17:54Chiron_Guys check this http://stackoverflow.com/questions/11139041/better-ways-to-traverse-a-map-of-maps amalloy is amazing!!
17:56Raynesamalloy: Did you hear that? You're amazing and stuff.
17:57RaynesI think amalloy is less awesome than Chiron_ is overly excitable.
17:57RaynesCocaine is bad for you, just fyi.
17:57amalloyclojure, man. clojure is the awesome thing
17:59Chiron_amalloy: Thanks :D I need a lot to learn this functional style . clojure is awesome but you too
18:13TimMcChiron_: 'for is a pretty excellent macro to know, too.
18:15Chiron_but I really needed a lot of time to understand the snippets
18:15Chiron_extremely terse. imagining doing that with imperative language
18:34gtrak`dnolen: heather from baltimore betascape sent ktcoders an e-mail yesterday. She totally found you guys independently, I swear :-). We had a meeting yesterday and I laughed about it.
18:34dnolengtrak`: haha, funny :)
18:35gtrak`i think she was looking around for microcontroller hackers
18:35dnolengtrak`: yeah the other ktcoder Ted Hayes does a lot of that. Arduino & Raspberry Pi
18:37gtrak`well, it should be fun, but it's the sat/sun before strange-loop so I'll be having a busy few days
18:38technomancywho was in here asking about a step-by-step guide to building a clojure web app earlier?
18:39beffbernardHow do you turn on debugger info for the reader?
19:31zach_Could anyone give me some advice on dynamically binding vars for the sake of testing? Here's what I'm currently trying to do (https://www.refheap.com/paste/3282), but it's erroring out because 'collection' was defined in a different context.
19:35brehautzach_: you probably dont want dynamic vars for testing. theres function specifically for modifying a var for testing
19:35zach_brehaut: Okay, cool -- probably found in clojure.test?
19:35brehauterr
19:35brehauti dont think so
19:35brehauttechnomancy ussually pipes up with the answer
19:36zach_:)
19:36technomancyyou mean with-redefs?
19:36brehautthats what i mean!
19:37brehaut(inc technomancy)
19:37lazybot⇒ 25
19:37zach_technomancy: brehaut: Awesome! Thanks guys
19:37brehautzach_: i dont know if it will fix your problem though
19:38zach_brehaut: It's a start. I'll come back complaining if it doesn't ;)
19:39brehautzach_: it probably doesnt help that you were trying to bind 'collection' rather than 'd/collection'
19:40brehautzach_: its also good style to slap earmuffs around any dynamic var you do create
19:40brehauteg *collection*
19:43technomancybut don't make it dynamic just for testing purposes
19:44RickInGAtechnomancy: do you have a minute to help with a swarm coding setup question?
19:45technomancysure
19:46RickInGAthanks… I have run the script and it says launch TERM=xterm-256color tmux
19:46RickInGAI do that, and it looks like it works, but when I ssh in, and try to attach, it says no seesions found
19:46RickInGAI am using a mac, if that makes a difference
19:47technomancythat should work
19:49RickInGAwhen I ssh in, I get a message telling me to run TERM=xterm256color tmux attach, whether I type that or just tmux attach, I just get no sessions
19:50RickInGAis there a way from within the host process I can confirm that a session is running?
19:51technomancyyou can always grep through ps awx
19:53RickInGAok, I can see that it is running. Do you know, is there someway I have to identify the session I want to attach to?
19:53technomancyonce you've already attached, you can change sessions with C-z S
19:54technomancyI don't know about before you've attached
19:54wkellytmux list-sessions
19:55RickInGAi wonder if I am getting a permissions problem… list-sessions worked in host window, not in remote
19:55RickInGAgot 'failed to connect to server: connection refused"
19:55zerokarmaleftor `tmux ls` for short
19:55technomancyare you running the client and server as a different user?
19:56technomancyI would not recommend that for swarm coding
19:56RickInGAfor server, I am running as 'swarm' that I got to with sudo -u swarm -i
19:56RickInGAfor client, I am as me, then did ssh swarm@host
19:56wkellythe tty is likely owned by the original login user
19:56RickInGAso in both windows, I should be running as swarm
19:57wkellyssh in directly as swarm and start a tmux session, and your life will be good
19:57technomancyodd that it would make a difference, but yeah I always SSH in
19:57RickInGAah, you are saying do both 'remotely' I will try it.
19:59RickInGAok, cool, now I am in same sesson
19:59RickInGAhmmm, typing 'emacs' at that point was apparently not the right thing to do
20:00technomancywhat? typing emacs is always the right thing to do
20:00aperiodicyeah, you should try 'vim'
20:00RickInGAI got some error, FAILED TO establish the default connection to the Window Server
20:01RickInGAmy emacs icon is bouncing, but I can't switch to it
20:01RickInGAmy terminals are blocked
20:01technomancyoh, maybe a macintoshy issue
20:01aperiodicwell, you'll need to use a terminal version of emacs
20:01technomancytry emacs -nw
20:01y3diis anyone else getting spammy pms?
20:05RickInGAwow, cant kill emacs… rebooting....
20:05technomancyo_O
20:05brehautmaybe emacs has expanded to replace his OS
20:05RickInGAthat wouldn't be all bad :)
20:06brehautid hoped it would happen after they got multithreading sorted
20:06gtrak`brehaut: you mean like python?
20:06brehautgtrak`: i most assuredly do not ;)
20:07technomancybrehaut: apparently there's a library floating around that does async futures in a subprocess
20:07technomancyonly 0.3s overhead
20:07brehauttechnomancy: for emacs or python?
20:07technomancyemacs
20:08brehautthats kind of amazing
20:08gtrak`i think generally it's easier to do threads upfront than tack it on later
20:09brehautgtrak`: yeah that would be my though too
20:09gtrak`hey look guys, now we're 'multi-threaded'! awesome, huh? nope
20:09technomancybrehaut: what's amazing is it's 100% elisp and can send closures to subprocess
20:10brehauttechnomancy: that is actually amazing
20:10technomancyelisp has serializable-fn built-in
20:10brehautnice!
20:10technomancyeven works with byte-compiled defuns
20:10RickInGAThanks guys for helping me get this running. 2 key points were to even have the 'host' ssh in to swarm and then emacs -nw
20:10brehautfor some reason i think even erlang doesnt have that?
20:10technomancyoh snap; take that erlang
20:11RickInGAAnd there will be swarm coding happening in Atlanta on monday night!
20:11technomancyRickInGA: I hope to put together a better blog post on doing your own swarming
20:11gtrak`RickInGA: you met my buddies Jesse Bickel or Eric Caspary down there?
20:12gtrak`the atlanta clojure?
20:13gtrak`I used to go to GaTech, but I didn't know of clojure then :-/
20:13RickInGAgtrak`: yep, met Jesse at the first meeting (monday is the 2nd) and I have met Eric a few times now
20:13gtrak`awesome! they're both really cool
20:14gtrak`I roomed with Jesse
20:14RickInGAtechnomancy: my plan was to get this working, and then in the next week or so write some instructions, and then submit them to you to either approve before I posted it somewhere, or post yourself if you would rather
20:15gtrak`I was talking to another GT grad I knew at conj about heightened GT crime rates, and Eric's ears perked up, that's how I met him, haha
20:15technomancyRickInGA: are you building off anything in particular, or just my notes from my talk?
20:16RickInGAtechnomancy: notes from your talk, the seajure repository and a respoitory called nuclearsandwich/swarming, which is a fork from seajure
20:17technomancythanks; I'll take a look at that
20:18nuclearsandwichhey RickInGA I started that on a plane. Still lots of work to do with it, I got distracted
20:18RickInGAeverything takes me a little longer because I am clueless on osx… for example, the instruction 'use this key' for the encryption, took me about 20 min :)
20:19RickInGAnuclearsandwich: that gave me some guidence, but neither your script would work for me initially, because I was running emacs 23, without package manager… switched to the seajure one at that point, because it seemed to have fewer moving parts
20:20RickInGAafter upgrading to emacs 24.1, of course :)
20:20technomancyyeah, 23 screwed up a few people at the conference; I hadn't even thought of it
20:21goodieboyI have a question about function argument pre-conditions. It feels redundant to define a bunch of pre-conditions, and then check arguments before calling the function. Is it better to not check the args when calling the function, but wrap in a try/catch for assertion errors? OR, always check the args before calling?
20:22RickInGAtechnomancy I was running 23 at the conference, but I was not a host
20:22nuclearsandwichRickInGA: yeah, I was trying to modularize the swarming stuff a little bit to make it easier to use non-emacs editors
20:25technomancynuclearsandwich: dude... I just got a siphon pot =D
20:26RickInGAthanks again for the help…. brain fried from talking to recruiters all day *shudder*
20:26RickInGAsee you guys next time
20:26nuclearsandwichtechnomancy: niiiiice have you tested it out yet?
20:27brehauttechnomancy: aeropresses are available in new zealand again :D
20:27technomancynuclearsandwich: I'm still figuring it out. seems like it has a lot of ... variables involved.
20:28technomancybrehaut: sweet
20:28technomancynuclearsandwich: I haven't really made a cup I'm happy with yet
20:28zerokarmalefttechnomancy: do you order beans online?
20:29nuclearsandwichtechnomancy: for sure, I've pretty much fallen back on the simpler methods. French Press and chemex
20:29technomancyzerokarmaleft: no, I pick them up from local roasters when I work out of their shops.
20:29nuclearsandwichand espresso when I'm at the office
20:29technomancynuclearsandwich: yeah, the siphon is definitely more work. lots of fun to watch though.
20:29nuclearsandwichbut espresso is only simple because I worked at it every day for five years
20:29technomancyheh
20:29nuclearsandwichtechnomancy: put your siphon in a window and be a mad coffee scientist!
20:30technomancyyessss
20:30goodieboyI guess I'm generally wondering how useful pre-conditions are to most clojure programmers? Are ya'll using them? When to use them?
20:30nuclearsandwichyou also need a bright white lab coat which will, in time, turn brown with coffee spills
20:31technomancygoodieboy: I think people are still figuring out how they fit into the big picture
20:31nuclearsandwichtime to hit the train. technomancy sometime soon I want to pick your brain about using mosh insecurely instead of having an insecure ssh pair for swarming
20:31amalloygoodieboy: i don't
20:32technomancyyeah
20:32brehauttechnomancy: do you play the portal theme while making siphon ?
20:32technomancyheh; next time
20:32goodieboyinteresting ok, glad I'm not alone in trying to figure out where/when they fit in
20:37djurWould anyone be up for looking at a little Clojure program I wrote and giving me some tips on how to make it more idiomatic?
20:38gtrak`djur: sure I can spare a couple mins
20:39djurgtrak`: Thanks! The code is here: https://github.com/mboeh/mass-download
20:39djurgtrak`: And my rationale is halfway down through here: http://mboeh.com/2012/06/21/development-notes.html
20:40gtrak`idiom 1: write tests :-)
20:41djurgtrak`: I ended up approaching it by passing a lot of functions as callbacks, but I feel like it would be easier and clearer with seqs... but I'm not sure how to apply them here
20:41djurI'm not even sure how to test this
20:42djurI literally just picked up Programming Clojure yesterday and banged this out based on an existing chunk of code I have
20:42gtrak`umm, if you use an editor that handles indentation and closing-parentheses for you, you won't have to manually do them. Doing the unnesting like curly-brace langs is bad.
20:42djurOK, good to know. I'm not doing them manually
20:42gtrak`like this: (dorun (map action (line-seq rdr)))))))
20:42wmealing_which reminds me, i must find rainbow braces that look clear for emacs.
20:42wmealing_not sure if current theme or just font that sucks.
20:43steveo_Does ring have websockets support? I've seen lots of talk about adding it but I don't know what the results of those threads were.
20:43djurI figured out I was using the wrong paren style by the time I wrote the blog post, but haven't amended the original code yet
20:44weavejester_steveo_: Ring is a HTTP abstraction, and websockets are a separate protocol with very different properties. There are libraries like Aleph that can cater to both, however.
20:44gtrak`djur: you can just use slurp on the file to get a string, or make-reader to make a reader
20:45gtrak`java.io/make-reader
20:46gtrak`urls-from-file is misleading, it's doing too much and isn't named right. I'd call it map-on-urls or something
20:46steveo_yeah aleph looks cool, I'll check it out, thanks
20:47djurI feel like I should be able to dispense with urls-from-file entirely and work directly with line-seq instead -- have that argument being a seq of URLs instead of a function which generates them
20:47gtrak`sure
20:48gtrak`in general, the callback-style is hard to follow
20:49gtrak`if you want asynchrony, consider agents or futures
20:49djurMy next goal is to make it download the files in parallel, though, and I'm not clear if there's a way to have multiple threads pulling work off a seq
20:50gtrak`agents or futures do that
20:50gtrak`maybe switch to push instead of pull
20:51djurI know how I'd implement this with a blocking queue and a big mess of mutable state. I'm not sure how to keep track of the result of a lot of little jobs without maintaining a lot of state
20:51gtrak`if you want to compose functions and handlers, consider just using lazy seqs instead of doing it yourself
20:52gtrak`ie... (defn a [args handler]) is kinda the same as (map handler (map a urls)) or (map #(comp handler a) urls)
20:52gtrak`oops... forget the #
20:53gtrak`(map (comp handler a))
20:53djurGreat, I thought there'd be something like that
20:53gtrak`if it's just a tail recursion anyway, it's equivalent
20:54gtrak`that'll get it down to like 5 lines...
20:54gtrak`:-)
20:55djurThanks! I'll go hack on that for a while. I appreciate the help!
20:55gtrak`no problem
22:58metajackis there something like xml-seq or xml/parse that doesn't require the whole input in memory at once? I basically wan to handle top level children individually.
22:58metajack(aside from using SAX in java directly)
23:03benoleecoming from ruby, and having no background with java, how best to learn the java stdlib for interop?
23:06cmajor7metajack: in case you worry about the XML file size, there is "lazy-xml" (http://bit.ly/LkuIzy), as well as "clojure.data.xml" (http://bit.ly/LkuWH0) which is its successor
23:07metajackbenolee: I make judicious use of "!java foo" search modifies at DuckDuckGo for that. It generally works pretty well.
23:09metajackcmajor7: thanks!
23:10cmajor7sure