#clojure logs

2011-08-09

01:08bognerAnyone know whether http://dev.clojure.org/display/design/Android+Support is up to date?
01:13hiredmanbogner: the status of android support isn't very fast changing, so it seems likely to be up to date
01:14bognerhiredman: Fair enough. Is there anywhere I should go/anyone I should talk to if I'm interested in trying to help?
01:14hiredmanmailing list I guess, dunno
01:14bognerCool.
01:14hiredmanyou have a ca?
01:15bognerdefine ca
01:15hiredman~ca
01:15clojurebotCA is Contributor Agreement: http://clojure.org/contributing
01:15hiredmana decent first step, kind of a pain
01:15bognerNo, haven't forayed into hacking on clojure yet.
01:16bognerThanks.
01:44amacis there a symbol that lets anonymous fns catch variadic args?
01:45amacalong the lines of &%
01:47amalloyamac: good guess
01:47amalloy%&
01:47amacerr, scratch that, will just use fn instead of #(
01:47amacoh, really?
01:47amachandy
01:48amalloythat said, i use fn instead. i don't think i've ever actually used %&
01:49kencauseyyeah one would think rest args are going to require a bit more than a line of code or two, unless the are simply passed onto another function as is I guess
01:50amacthey're being dumped into a partial fn so don't really need to be named
01:51amacI'd rather save 5 keystrokes than have maintainable code! /s
02:22thorwilin dnolen's announcement, i read "mad patterns" at first 0.o
02:24depywhat's a "mad patterns" ?
02:25leonidpatterns that are mad
02:25depyO_ô
03:07depyAny1 has link to dnolens tweeter? Somebody said he tweeted about some interesting pattern matching?
03:07amalloy@swannodette
03:40ejacksonmorning good people
03:51depymorning
03:52amac4am here, why can't I sleep like normal people :(
03:52ejacksoni think that may be locally normal
03:53amactrue.
03:53amacits the others that are weird, not us.
03:53depy10am here... At work already.. :/
03:53ejackson9 here, work is at home :)
03:53depylucky u :)
03:53amacare you in the UK by any chance?
03:54depySlovenia actually
03:54amacah, probably for the best -- I was wondering what the status of the riots in London were.
03:55depyI'm really frustrated... :/ I hate when people take some open source solution and think that they have a golden hammer that can solve everything...
03:58ejacksonamac: yup
03:59ejacksonbut not in London, happily.
04:02amacsadly, reporting on european issues is spotty over here (Canada)
04:03ejacksonits spotty here too... nobody seems to be owning up to the reason for these riots.
04:12depyWhat was the reason for these riots? O_ô
04:15amacsomeone got shot by the police, but the details on it are fuzzy
04:16depyI see. I'm reading about it but there nothign concrete on it ye...
04:20ejacksonyup, if the Met has managed to kill yet another innocent dude its going to be ugly
05:04fhdIs anybody using a mocking framework? If so, which one?
05:04fhdCouldn't find much. Midje looks like a test framework + mocking framework, but I'm quite happy with clojure.test and a bit reluctant about switching.
05:07clgvfhd: what do you want to mock? functions only?
05:10fhdclgv: Mocking java objects would be cool, too
05:11fhdclgv: Something like Mockito for Java (mocking and stubbing etc.)
05:11clgvfhd: for functions have a look at this macro: https://github.com/joyofclojure/book-source/blob/e9f8e99b76e575371c1e927eb22840f258e54783/src/joy/misc.clj#L146
05:51robonobohi
05:51robonobois there a Right Way to add local jars to a leiningen project?
05:51robonoboi've copied two into libs, but lein doesn't seem to pick them up
05:52ordnungswidrigrobonobo: I'd put them into a local repository and reference them like every other dependency
05:53ejacksonlein deps ?
05:53robonoboejackson: running lein deps removes them from the lib directory
05:53robonoboordnungswidrig: isn't that a bit overkill?
05:54ordnungswidrigrobonobo: where do the local jars come from?
05:54ejacksonrobonobo: i'm confused. List the deps in your project.clj file, and then run lein deps. It will copy them from ~/.m2/... to ./lib
05:54ejacksonor it should :)
05:54robonoboordnungswidrig: they're form the zxing library
05:55robonoboi downloaded them, but clojars doesn't have them
05:55ejacksonaaah, then you need put them into your local repository
05:55robonobohow? do i just copy the jars into the m2 dir,
05:55robonobo?
05:56ejacksonor somehow inform lein of the repo where they can be found
05:56ordnungswidrigrobonobo: http://code.google.com/p/zxing/issues/detail?id=88
05:56ordnungswidrigrobonobo: there is actually a maven repository having these libs.
05:56robonobosweet
05:57ordnungswidrigrobonobo: https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md
05:57ordnungswidrigrobonobo: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
05:57ordnungswidrigrobonobo: the rest is on you :-)
05:58ejacksonthe last ling is how to get the jar into your local repo, from which lein can find it
05:58ejacksonthat's what i'd do
05:59ordnungswidrigejackson: I'd refer to the existing repo, because there is one :-)
05:59ejacksonordnungswidrig: how do you tell leiningen about remote repos other than clojars ?
05:59clojurebothttp://github.com/technomancy/leiningen
05:59ejackson(i'm a recent refugee from maven)
06:00ordnungswidrigejackson: the first link above (...DEPLOY.md) shows you
06:00ejacksoncool, thanks.
06:01ejacksonha :repositories
06:08robonoboi got it to work with the repo you sent me, ejackson, thanks guys
06:09ejacksongroovy
06:21BorkdudeGuys, I just got a fresh Macbook Air and installed Aquamacs. What is the common way to get Clojure working, with Slime/Swank, etc?
06:22tufflaxSay I have a map with lots of entries in it, and I want a map where I keep just a few of them, maybe it could look something like this: (keep-entries :a :b :c) is there a function that does something like this already?
06:23tufflaxBorkdude though I don't use emacs myself, I guess leiningen with lein swank or whatever it's called is reasonable
06:23Borkdudetufflax: what do you use?
06:23tufflaxvim
06:23tufflaxbut emacs is more popular
06:24ordnungswidrigtufflax: ,(select-keys {:a 1 :b 2 :c 3} [:b :c])
06:24clgvtufflax: select-keys solves your problem
06:24ordnungswidrig,(select-keys {:a 1 :b 2 :c 3} [:b :c])
06:24clojurebot{:c 3, :b 2}
06:24tufflaxok thanks guys
06:25tufflaxoh, i forgot the map in my imagined keep-entries :p
07:59thorwili still wonder if it would be a good idea to handle articles and comments as a single entity in my blog
08:00thorwilso the journal view (list of articles) could also render an article-with-comments view, perhaps
08:02thorwilthe relation between article and 1st level comments would be the same as between nth and (inc nth) level comments
08:17robonobohi
08:18robonoboi don't think i fully understand how lazy-seq works when reading from disk
08:18robonoboi have this https://gist.github.com/1133895 code
08:19robonobothat takes a list of java.util.File-objects and that should lazily make them in to bufferedimages using imageio
08:19robonobobut even if i go (first (imgs-from-files ...)), when the filelist is long, it throws an OutOfMemoryException
08:20robonoboshouldn't it be reading and converting the first file only?
08:32clgvrobonobo: depends on how exactly you use it
08:32robonoboclgv: what do you mean?
08:32clgvrobonobo: if you hold on to the head of the lazy sequence all its elements will be kept in memory
08:33opqdonutwell he's not hanging on to it
08:33robonoboand if i just do (first (lazy-sequence ..))
08:33robonobo?
08:33opqdonuthmm, that is weird
08:34clgvopqdonut: where do you want to see that? there is no call to that function in the snippet.
08:34opqdonutI mean, if he's calling (first (imgs-from-files ...))
08:34robonobohmm, i seem to have it working now
08:34depywhat was wrong?
08:34clgvrobonobo: if you do (first (imgs-from-files ...)) you are only evaluating the first entry
08:34robonobothe problem might have been that i didn't reload (stupid)
08:34clgvso that one might consume too much memory.
08:35depylol, :D
08:35robonobothat always gets me
08:35raekrobonobo: I don't see any problem with the definition of imgs-from-file, but you can also write it as (defn imgs-from-files [files] (map load-image files))
08:36robonoboraek: ha, yes, ofcourse
08:36raekbut the lazy iteration looks like what you would get if you expanded the map call
09:31mdrogalisIs there a function in Clojure similiar to Python's zip? Takes two sequences and returns them in pairs. Example: [1 2 3] [4 5 6] => [(1 4) (2 5) (3 6)]
09:32chousermdrogalis: (map vector v1 v2)
09:35mdrogalisAh, nice. Thanks chouser!
09:36chousernp
09:39solussdis there an easy way to remove all symbols in my current namespace brought in with 'use' ?
09:39solussdlike (unuse 'some.namespace)
09:40chouserhuh, interesting. That's a very reasonable request that I'd never considered.
09:41depywhy is that usefull?
09:42solussdI'm working in a repl and i've moved some stuff around in my namespaces and completely removed one namespace and would like to avoid having to restart my repl to remove the referred symbols from my now nonexistent namespace
09:42chouserfor when you accidentally type a naked 'use' when you meant "use only ..."
09:42chousersolussd: I don't think it can be done perfectly because use'ing can overwrite an existing refer in a way that can't be restored.
09:43solussdI figured a naked 'use' is acceptable when experimenting / building libraries
09:43chouserThis is, a perfect "undo" isn't currently possible, I think.
09:43chouserbut remove-all-vars-used-from-foo should be
09:46solussdI guess I can (ns-unmap 'user 'sym) for each one for now
09:46chousersolussd: yep. Gimme a sec.
09:46solussd:)
09:51hugodsolussd: you could also use remove-ns on the namespace and reload it
09:52solussdhugod: the polluted namespace is user
09:52solussdjust poling around on the repl
09:52solussd*poking
09:52chouser(defn un-use [ns-sym] (doseq [[k v] (.getMappings *ns*) :when (and (var? v) (= ns-sym (.name (.ns v))))] (ns-unmap *ns* k)))
09:53chousershould use ns-map instead of .getMappings
09:56solussdnice
09:56solussdthanks chouser!
10:02wastrelGood morning.
10:07manutterHmm, this is interesting: http://goo.gl/yHWie
10:08manutterTitle is "Google Closure: How NOT to write JavaScript"
10:09manutterCouple years old though, hopefully Google has shored up the weak spots since then.
10:13chouserThis is better, no undocumented object interop: (defn un-use [ns-sym] (doseq [[k v] (ns-map *ns*) :when (and (var? v) (= (str ns-sym) (str (:ns (meta v)))))] (ns-unmap *ns* k)))
10:14Scriptormanutter: that piece got ripped apart a bit :) http://news.ycombinator.com/item?id=937175
10:15manutterScriptor: well, he is kind of asking for it :)
10:51manutterIs cemerick around? I have another Spring Security question.
10:52manutterOr anybody else would be welcome to answer too: does Spring Security presume that you are running in Tomcat or some similar container
10:52cemerickNo.
10:53cemerickHrm. Well…
10:53manutterI'm thinking if I convert my app to Spring Security and then want to deploy on, say, heroku...
10:53cemerick*spring* doesn't assume that — spring-security, yes, it does. At least, it's typical deployment is via a servlet filter, which assumes a servlet container.
10:54manutterbut even just jetty has me wondering, because I don't know if jetty reads web.xml to get the filtering
10:54manutterok, that's what I was thinking
10:54cemerickIf your deployment environment uses/respects the web.xml, then spring-security will work.
10:55manutterOk, that's what I thought, thanks for the confirmation
10:55cemerickIf it doesn't (i.e. you're deploying using embedded jetty and wiring things up programmatically without any reference to a web.xml that includes the spring-security filter), then you're going to have a hard time.
10:55cemerickSuch arrangements bother me though, insofar as I don't want to waste programming cycles on such guff.
10:56cemerickDoes heroku not just pick up a war file and run with it?
10:56manutterNo, you basically push it a git repo
10:56chouserheroku uses source-deployment
10:57manutterOr I should say, I'm a heroku noob too, so I don't know what it would do if you offered it a web.xml file
10:57cemerickand there's a file somewhere that specifies what var holds your top-level ring handler or something?
10:57manutterYeah, there's a procfile that calls lein run
10:57chouserthere is a class of problems for which heroku is beautiful
10:57cemerickcertainly
10:58manutterYeah, it's a nice hammer, I'm just looking for the right nail ;)
10:58cemerickor, I can imagine so :-)
10:58chousermanutter: you may be able to deploy tomcat to heroku ... somehow... :-/
10:58cemerickRight, so heroku is Ring-only then.
10:58manutterCould be, but I'm thinking that heroku might not be your first choice if your product is a WAR file.
10:59manutterchouser: ^
10:59chousermanutter: that's probably true. Have you looked at CloudBees?
10:59manutterOo, a new name, googling now....
10:59lnostdalhi, anyone noticing quite severe memory leaks using emacs-snapshot? ( http://emacs.naquadah.org/ .. i'm using the one from the ubuntu natty repo)
11:00cemerickIf deployment options are being tossed out, see Elastic Beanstalk
11:00cemerickmanutter: ^^
11:01manuttercemerick: yeah, I've looked at the AWS stuff, it's attractive too
11:01manutteralso checking out rackspace options
11:01chousercemerick: heroku is a layer of service on top of AWS
11:02cemerickchouser: Yeah, I knew *that*. ;-)
11:02chouseroh, ok.
11:03chouserDunno if CloudBees uses AWS or not.
11:03cemerickI'm mostly suspicious of pure PaaS options.
11:03chouserbut they've got *eleven* "Elite Developers" on their team, so that's something.
11:03ejacksonyeah even matlab has got the AWS thing working nicely now. Virtually transparant for embarrasingly parallel problems.
11:04cemerickI have a draft post flaming Rackspace. Not sure if I should bother publishing it though. Scary stuff.
11:04ejacksonoooh, elite developers.
11:04ejacksonmust be black belt
11:04cemerick4th degree, even :-P
11:04chouseractually, they're all elite developers *and* architects.
11:05chouserI wonder who builds the thing if the entire technical staff is architects.
11:05ejacksonno way ! where did they find these ninja dragon lords ?
11:05manutterflaming rackspace? (pretty vivid mental image, btw) What's the issue or issues?
11:07ejacksonmanutter: a flaming elastic beanstalk is also amusing....
11:07manutterlol
11:07cemerickJust a smattering of security-related WTFs. It was enough to keep me from bothering with them after an hour or so.
11:08manuttercemerick: hmm, that'd be an interesting post to read
11:09cemerickI'd want to have someone else that isn't an idiot w.r.t. security proof it before I started yelling Fire!
11:13TimMccemerick: Have you tried sending your concerns to them?
11:16TimMcNot that it will *necessarily* do any good, but there might be one or two items that they can address to your satisfaction or confirm their ignorance on. :-)
11:16cemerickTimMc: Beyond a WTF-flavored tweet, no. It's obvious stuff, fundamental to how their cloud servers handle root passwords, API keys, etc. It's a widely-used service, and apparently acceptable enough that there hasn't been a post about it AFAIK already.
11:17danlarkinit's always polite to go behind the scenes first
11:17cemerickAnyway, it creeped me out enough that I killed the node I started and walked away. AWS spoiled me, I guess.
11:17danlarkinI know if I were on the RS security team I'd appreciate it
11:18danlarkinAND it can save you public embarrassment if you're wrong :)
11:18cemerickdanlarkin: True, noted. Exactly why I didn't bother publishing so far.
11:18cemerickClearly, it's not a problem for a lot of other people, presumably more security-conscious than I. So, perhaps I am just flat-wrong. :-)
11:21cemerickejackson: I need it! Turns out my headphones sometimes pick up CB traffic (faintly!) from the nearby highway when I'm in the right room. I thought I was going nuts for a few nights.
11:21ejacksonlmao !
11:21pdki had that a few times like 10 years ago
11:22pdki recall my old tiny speakers picking up a barber shop quartet on the radio
11:39wastrel~/win 7
11:39clojurebotIt's greek to me.
11:40chouserThe clojure ggroup had double the number of messages in Jul as Jun, the most messages since March 2009
11:46dnolenchouser: I noticed that the other day. Though some really contentious threads contributed to that as well :)
11:48chouseryeah. I thought perhaps clojurescript, but that wasn't announced until lat in the month, right?
11:51wastrelwhat's clojurescript?
11:52cemerickwastrel's afternoon just got nuked ;-)
11:52cemerickclojurescript?
11:52clojurebotclojurescript is Chouser's baby
11:52cemerickoy
11:52cemerickclojurescript?
11:52clojurebotclojurescript is Chouser's baby
11:52cemerickclojurebot: ClojureScript is https://github.com/clojure/clojurescript
11:52clojurebotYou don't have to tell me twice.
11:52cemerickwastrel: ^^
11:53wastreloh that is super cute
11:53cemerickdoes clojurebot have `X is not Y` support?
11:53pjstadigclojurebot: forget clojurescript is Chouser's baby
11:53clojurebotYou don't have to tell me twice.
11:54pjstadig~clojurescript
11:54clojurebotclojurescript is Chouser's baby
11:54pjstadigusually works
11:54pjstadigclojurebot: forget clojurescript |is| Chouser's baby
11:54clojurebotI forgot that clojurescript is Chouser's baby
11:54pjstadig~clojurescript
11:54clojurebotClojureScript is https://github.com/clojure/clojurescript
11:54pjstadigthar
11:56cemericknice
12:11clgvWhen using delay & force is the delayed computation only calculated ones when multiple threads force it at the same time?
12:11hiredmanyes
12:12clgvso the first calling thread to delay calculates the result and the others wait for it?
12:12hiredmanyes
12:13hiredmanhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Delay.java#L30
12:13clgvah ok
12:33dnolenhey match on HN front page.
12:34joegallowho do i talk to about getting a jira account? i have a confluence account, but no jira account, or so it seems :/
12:35MenthyDoes anyone know if ClojureQL supports functions like max(field) or lower(field), or what the general expression is to create such function ?
12:36joegalloah, found it on my own
12:39ambrosebsdnolen: +1ed :)
12:46crazyFoxWhen i do (unchecked-remainder a b) at the REPL, i get an exception: CompilerException java.lang.RuntimeException: Unable to resolve symbol: unchecked-remainder in this context, compiling:(NO_SOURCE_PATH:14). Im using clojure-1.3.0-beta1. Any thoughts what the reason is?
12:47arohneribdknox: I have an idea for noir: optionally naming pages.
12:47hiredmancrazyFox: there is no function called unchecked-remainder
12:47arohneribdknox: I'd like to do something like (defpage [foo :get "/"] {id :id}), so that somewhere else, I can do (link-to (url-for foo) "a link")
12:48crazyFoxhttp://clojuredocs.org/clojure_core/clojure.core/unchecked-remainder what about this one? is it only 1.2.0?
12:49hiredmancrazyFox: open up core.clj and look
12:49dnolencrazyFox: some of the math stuff changed in 1.3.0.
12:50dnolencrazyFox: you have unchecked-remainder-int now.
12:51dnolencrazyFox: also (set! *unchecked-math* true) followed by (rem ...) will probably do what you want.
12:51crazyFoxthats a nice pointer. it works. thank you!
12:52crazyFoxdnolen: so, are all math ops after (set! *unchecked-macht* true) unchecked, until i set it to false again?
12:53crazyFox*math
12:53raekcrazyFox: I think it is a compiler flag, like *warn-on-reflection*, that is read when the defns are compiled
12:54dnolencrazyFox: yes
13:02clgvI have several instance files that are loaded into my programm and then an algorithm is repeatedly executed on those instances. when the execution is sequential in one thread it lasts about 14secs when I use 4 parallel threads I get the results of all 4 of them after around 37secs. what might I do wrong?
13:03clgvcurrently I load the files via a memoized like approach with delay & force so that only one thread has to access the filesystem
13:06clgvah the machine the program is running on has 12 physical cores
13:15clgvany idea?
13:27manutterAnd NetBeans 7 once again decides to fall over and die because I allowed it to upgrade itself. Sigh.
13:27manutterYet another reason why I love working in PHP at my day job.
13:28clgvtry eclipse ;)
13:28cemerickmanutter: what does "die" mean, specifically?
13:29manuttercemerick: It tells me that it could not install a module (lucene something) and that therefore 61 other modules must be disabled, including all my PHP functionality
13:29cemerickah
13:29manutterplus arbitrarily deleting some of my preferences and saved settings.
13:30cemerickNetBeans was segfaulting for me and others circa 6.8. I'd +1 the eclipse suggestion.
13:31manutterWell, I've got a couple reasons why that's an appealing alternative now
13:31manutterThe other reason is I'm running the Zend server, and have a licensed copy of Zend Studio
13:32manutterbut it's a hog (on my machine at least)
13:32cemerickI just finished eliminating the last vestige of PHP in my control. </relief>
13:33manuttero rub it in :P
13:33cemerickJust empathizing ;-)
13:33TimMccemerick: Did you do it by replacing the PHP or ceding ownership? :-P
13:33cemerickreplacing/eliminating
13:34TimMcbless you, then
13:34cemerickThat also means I have no more apache or lighttpd instances under my control, which is nice
13:34manutterheh, maybe I can just look forward to that some day
13:34manutterno apache? you're all tomcat now or something?
13:34cemerickYup
13:35cemerickI get bashed for that here and there, but I've never quite understood why. Tomcat has always workedforme.
13:35HodappI am using Tomcat here. It's been working quite well.
13:35manutterAny limitations on it in a production environment?
13:36clgvok a different question: how to implement a producer consumer scenario in clojure?
13:36manutterI mean, I'm sure it must have some limitations, everything does
13:36manutterbut anything in particular that bothers you?
13:36clgvI have k producers and 1 consumer
13:37manutterclgv: I thought I recently saw some discussion about that, and IIRC someone recommended using plain old Java queues or something
13:38clgvmanutter: I tired to do it like that as well, but somehow on a 12 core machine 10 threads spent most of the time in monitors...
13:39cemerickmanutter: It was somewhat late to the party with the servlet 3 support (async requests) and such, I think. Maybe that's behind the griping.
13:41manuttercemerick: could be
13:41manutterclgv: I'm out of my depth at this point :/
13:42manutteroh gawd, I fired up Eclipse/ZendStudio since NB is hosed, and it's saying, "Upgrade available!"
13:42manutterGaaaahh!
13:42amalloyclgv: one consumer? sounds like an agent
13:43clgvamalloy: could be an agent. but how to manage the k producers?
13:43amalloy*shrug* depends on your application
13:43amalloysimplest off-the-cuff answer is "start up a future for each of them"
13:44clgvok. or pmap then I guess
13:44amalloypmap doesn't sound like a good plan to me
13:45clgvwhy?
13:45clojurebotwhy not?
13:45clgvclojurebot: kick
13:45clojurebotNo entiendo
13:45technomancyclojurebot: how?
13:45clojurebotwith style and grace
13:46amalloyi mean, how would you use it? pmap never has more than N active threads at a time (for some N)
13:46amalloyif your producers block, or need to run indefinitely, then you can't run them all at once with pmap
13:46clgvok.
14:28crazyFoxwhat are these random answers of clojurebot sometimesß
14:28crazyFox?
14:30manutterclojurebot is monitoring the clojars.org site for new uploads, and reporting them.
14:30manutteror else he's just bored
14:30crazyFoxrandom. who programmed this thing?
14:31manutterhmm, I think clojurebot is hiredman's?
14:31manutterNot sure.
14:31chouseryes
14:32crazyFoxclojurebot: who is your author?
14:32clojurebotauthor is hiredman
14:32crazyFox:)
14:32Scriptorhehehe
14:32manutterclojurebot scares me sometimes
14:33amalloy~guards
14:33clojurebotSEIZE HIM!
14:33crazyFoxmanutter: right on to that
14:33manutterclojurebot: what is skynet?
14:33clojurebotI will become skynet. Mark my words.
14:35manutter~botsnack
14:35clojurebotThanks! Can I have chocolate next time
14:35amalloyi forget who taught him that one. his built-in botsnack response is more entertaining
14:36amalloyclojurebot: forget botsnack is |reply| Thanks! Can I have chocolate next time
14:36clojurebotI forgot that botsnack is reply Thanks! Can I have chocolate next time
14:36manutter~chocolate
14:36clojurebotTitim gan éirí ort.
14:36amalloy~botsnack
14:36clojurebotThanks, but I prefer chocolate
14:36amalloysigh
14:39solussd~botsnack
14:39clojurebotThanks, but I prefer chocolate
14:39solussd~chocolate
14:39clojurebotIt's greek to me.
14:39solussd~don't get fat
14:39clojurebotPardon?
14:41solussd~(reduce + '(12 3 5 1))
14:41clojurebot,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")), :else("nao eh") )] (testar 10 25))
14:42manutterwhat the heck?
14:43solussd,(let [testar (fn [x y] (cond (= (reduce + (filter odd? (range 0 x))) y) (str y " is an square perfect")), :else("nao eh") )] (testar 10 25))
14:43clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
14:51hugoddnolen: congrats on match - looking very useful
14:51hugoddo you have plans on pushing a jar for it?
15:06arohneribdknox: I made a longer post to the clj-noir group about url-for
15:08ibdknoxarohner: yeah, that's not an uncommon request
15:08ibdknoxarohner: I'm not opposed to being able to name a page
15:08arohneribdknox: do you have opinions on syntax?
15:09ibdknoxarohner: I think I like this one the best: (defpage foo [:get "/foo/:id] {id :id}
15:09arohnerk
15:10ibdknoxarohner: or the same (depage foo "/foo/:id" {id :id} ...)
15:10Vinzentbtw, jaco already has named routes
15:10Vinzenthttps://github.com/dnaumov/jaco
15:11ibdknoxarohner: I think it should be optional though
15:12arohneribdknox: sure.
15:27ibdknoxarohner: did you *want* to take a stab at a patch? I'm happy to do it later.
15:27arohneribdknox: yeah, I want to work on it, this is sort of blocking me. I should have something in a few hours
15:28ibdknoxkidoke
15:28ibdknoxif you just want to be unblocked
15:28ibdknoxyou can call a route via (render)
15:28ibdknoxthough it's not as pretty as what you've laid out there
15:35dnolenhugod: thx
15:35dnolenWould like to get a couple more things in there first before pushing a jar.
15:45hiredmanwe'll have to see if technomancy can get rid of my 'match' on clojars
16:10technomancyhiredman: Do you really want to remove the "match" group and jar? [y/N]
16:10hiredmanYeah
16:11technomancydone
16:12hiredmandun dun dun
16:40arohneribdknox: how do you run the tests?
16:42ibdknoxarohner: lein test
16:46ibdknoxarohner: make sure you do it against the vnext branch
16:46mattmitchellis there a built in function that will tell me if a list of numbers is either all in descending or ascending order?
16:46technomancymattmitchell: < and >
16:46arohner,(< 1 7 10)
16:46clojurebottrue
16:46mattmitchelltechnomancy: awesome! thanks
16:46arohner,(< 3 1 2)
16:46clojurebotfalse
16:46mattmitchellarohner: exactly what i was looking for, thank you
16:47technomancythey should really be thought of as increasing? and decreasing? rather than greater-than? and less-than?
16:53joegallothat's a nice way of thinking about it, technomancy
16:53scottj+1
17:15amalloytechnomancy: going to rename <= non-decreasing too?
17:16manutterDoes Eclipse play nicely with leiningen? I just installed Eclipse/CCW at home for the first time
17:16manutterand I've exhausted the "Getting Started" page at dev.clojure.org
17:17amalloymanutter: shouldn't you be reading help documents for ccw rather than whatever's at clojure.org?
17:17manutterThat's where I started, but it led me on a chain of links to the page at dev.clojure.org
17:18amalloyken wesson would love to hear that you're having trouble finding help with ccw, i'm sure :P
17:18manutterlol
17:18amalloymanutter: really though i've no idea. maybe cemerick can help
17:18manuttereh, I should probably ask earlier in the day, the main CCW guys are in France, aren't they?
17:19amalloymanutter: lpetit is, but i know cemerick does some work on it and is an advocate
17:19manutteryeah, it's partly cemerick's urging that got me here
17:20manutterDunno what's wrong with my setup at work--I started Eclipse, and in 1 hr and 15 minutes I (a) opened a php file and (b) tried to run it in Debug mode
17:21manutterFinally I left to come home, and Eclipse was still cranking away at "Building workspace (75%)"
17:21technomancymanutter: worst case scenario is you do "lein pom" and treat it like a maven project
17:21manutterSounds promising
17:21cemerickmanutter: There is no Leiningen plugin for Eclipse. Use `lein pom` to produce a pom.xml you can use as a basis for a maven project in eclipse.
17:21cemerickFeh. :-)
17:21manutterEclipse Indigo at home is pretty cool, I'll be playing with it some more
17:22manutterIs there a shell script plugin? That'd meet most of my needs
17:23manutter(where "my needs" == "too lazy to switch windows")
17:23cemerick"shell script plugin"?
17:23manuttereh, something that would let me run commandline commands or scripts from within eclipse
17:24manutterof course, that would end up being me calling "lein foo" from within eclipse, since lein is a script
17:24manutterit's no biggie of course, I just have to pop open a terminal window
17:25manutterI'm just kicking the tires and stuff, haven't played with eclipse in years and don't remember what all it does.
17:26cemerickmanutter: That's built-in. Menus: Run > External Tools > External Tools Config. Create a new "program" config. Specify your path to lein, and I think there's a property you can use to dynamically choose your working directly based on "current project". Command line args of "pom".
17:26cemerickBind that to a keystroke, and you've got `lein pom`.
17:26manuttercool, that's the ticket :)
17:27manutterthanks guys, I'm off to play some more then
17:28cemerickmanutter: The above is untested, BTW ;-) …but should work
17:28manutterI'll test it then :)
17:31cemerickHuh, nifty. ${container_loc} as working directory works nicely :-)
17:31cemerickmanutter: ^^
17:32manutterawesome, thanks
17:32cemerickThat's probably going to key off of the active (or most-recently-active) editor to determine "active project".
17:39manutterCool, lein pom works
17:39manutterlein deps is going to have issues because the lein directory structure is different from eclipse's
17:39amalloymanutter: both of those are trivially configurable
17:40manutteraha thanks
17:40cemerickmanutter: eclipse doesn't have a particular directory structure…
17:40manutterI sould be able to track that down then
17:40manutters/sould/should/
17:40lazybot<manutter> I should be able to track that down then
17:52manutterso before I chase this too far, what's the usual eclipse way to add, say, compojure to a clojure project? I suspect it's not lein deps...?
17:53Scriptormanutter: yep, nothing to do with eclipse
17:54Scriptorjust add the latest compojure to project.clj and do lein deps
17:54manutterok, that's good news for plugin related stuff too (lein noir new foo)
17:55manutterand I just have to add lib/*.jar to the classpath
17:55manutterafter lein deps
17:56manutterSo far I've got two clojures tho: lib/clojure-1.2.1.jar and Eclipse's native clojure.jar at the root level
17:56Scriptorwait, why do you need to add them to the classpath?
17:56Scriptorlein handles most classpath stuff
17:56Scriptorwell, not sure how it integrates with eclipse, I guess
17:57manutterThat's what I'm wondering abou
17:57manutter*about
17:57manutterI'm cool with emacs and cli lein, just not sure how to achieve the same results in eclipse
17:58manutterI suppose I could use lein deps and lein swank, and just use Eclipse's "connect to external REPL" command
18:02ibdknoxmanutter,
18:02ibdknoxsomeone had a noir "template" for eclipse
18:02ibdknoxhttps://github.com/yogthos/Noir-Eclipse-Template-Project
18:03ibdknoxyou could use that as a rough guide on setting up the classpath/project file for eclipse correctly
18:03ibdknox*disclaimer* I haven't tried it
18:13technomancymanutter: use lein repl instead of swank; it starts a socket repl
18:27ibdknoxarohner: I left a couple comments. The patch looks good, just don't want a contrib dependecy
18:27arohneribdknox: ok
18:27arohnerI'll have those fixed tomorrow
18:27ibdknoxawesome, good work sir!
18:32manutteribdknox, technomancy: thanks!
18:33ibdknoxmanutter: anytime
18:47justicefrieswhat are the good/recommended clojure books?
18:47RaynesAll of them.
18:48justicefriesfair enough. ;)
18:51Raynesjusticefries: Programming Clojure is horribly out of date at this point, though I hear they're currently writing the second edition.
18:51justicefriesah ha.
18:51RaynesBeyond that, you should be fine.
18:51justicefriesI'm going through the Clojure reference now, was looking at Joy of Clojure as well
18:51RaynesPractical Clojure + The Joy of Clojure tends to be a popular combo.
18:51justicefriesah
18:51justicefriesperfect
18:52RaynesWhen my book comes out it'll (obviously) take over the world.
18:52RaynesBut until then, you people just have to deal.
18:52justicefriesha! What's the book?
18:52Raynesmeetclj.raynes.me
18:52justicefriesnice. I'm straying away from Ruby-land.
18:52RaynesNot cool enough to have its own domain name.
18:52justicefriesinto clojure.
18:53gfrlogclojure has totally ruined ruby for me
18:53justicefriesyup.
18:53justicefriesbeen doing obj-C and clojure.
18:53Raynescemerick: Damn you all to hell.
18:54technomancyprogramming clojure isn't that out of date
18:54amalloyRaynes: just hack his website
18:54Raynestechnomancy: It's pretty well out of date.
18:54cemerickRaynes: Surely the right domain will get you #2 in google results? ;-)
18:54technomancythe only thing that's confusing is that it talks about structs
18:54gfrlogRaynes: what is chapter 7 about?
18:54technomancythe lack of protocols/records shouldn't be an issue for an introductory book
18:54Raynesgfrlog: Lisp. It's the macro chapter and such/
18:54Raynestechnomancy: Doesn't it make use of contrib libraries that don't even exist anymore?
18:54gfrlogRaynes: and how do you pronounce the chapter name?
18:55Raynesgfrlog: You don't.
18:55RaynesAnd those chapter names are tentative and likely to change as I think of cleverer names.
18:55gfrlogoh now I have to just to be contrary
18:55RaynesYou can pronounce it "chapter 7"
18:55technomancyhm... I guess there's a fair amount of contrib stuff there
18:55amalloygfrlog: i think it sounds like a raspberry
18:55gfrlogI think my first instinct is to pronounce it as if it were a long string of 'f's
18:56ibdknoxtechnomancy: I had a friend go through it recently, and there was a fair amount I had to help with
18:56RaynesThe order of the chapters is probably not final either.
18:56amalloytechnomancy: when Raynes said "all of them", i reminded him of all the poor souls who ask how to use duck-streams with clojure-1.0.0-SNAPSHOT or some equally absurd version
18:56ibdknoxlol
18:57justicefriesi have beginningclojure.com :)
18:57technomancypeople pick on programming clojure because it doesn't cover records, but I don't think that's a fault. if you've only got 200 pages, it's perfectly reasonable
18:57amalloytechnomancy: totally agree there. who cares
18:58amalloythe fewer new users who hear about records, the happier #clojure will be
18:58ibdknoxhaha
18:58RaynesMy book will probably cover twice as much as Programming Clojure in the same number of pages. Whether that's a good thing or not remains to be seen.
18:58gfrlogwhat's the concisest/cleverest way to reverse an interleave operation?
18:58amalloygfrlog: that's a question on 4clojure. best answer has been tweeted
18:59gfrlogamalloy: okay I'll go browse
18:59amalloy&(->> [[1 2 3 4] [:a :b :c :d]] (apply interleave) (partition 2) (apply map list))
18:59lazybot⇒ ((1 2 3 4) (:a :b :c :d))
19:00amalloygfrlog: (for your convenience)
19:00gfrlogamalloy: thanks. That is exactly as clever as I was hoping it would be.
19:02justicefriesRaynes: when'll the book be finished?
19:02justicefries(hurry up.)
19:02Raynesjusticefries: Sometime in the next 10 years or so, I imagine.
19:04RaynesMy deadline with my publisher is November unless they extend it. I kind of skipped the last 4 months with very little work on the book. If by some miracle I manage to finish it by November and/or my publisher doesn't drop me like a brick for being slow, sometime early next year would be my best guess.
19:07RaynesAnd to anybody thinking me lazy, just you try to keep yourself motivated to write a book when you have to spend half of your day fighting with OpenOffice to do it. Just... you... try...
19:07amalloytake a detour to write a program that converts markdown into their crazy openoffice format
19:07amalloyhow long can that take...
19:07RaynesMan, the stuff that OpenOffice generates...
19:07ibdknoxLaTeX
19:08ibdknox:p
19:08RaynesIt isn't even natural. It isn't human.
19:08RaynesIt's like a Dalek core dump.
19:10justicefriesOO is nasty. Do it in Byword
19:10justicefries.
19:11Raynesjusticefries: They have this insane OpenOffice template that I have to use. Picture this: 3 different styles applies to three different portions of a single code block and *every* single code block.
19:11justicefrieswhat? that sounds wild.
19:11RaynesCodeA for the first line, CodeB for the middle lines, CodeC for the final lines.
19:12Raynescemerick: You don't know how good you have it, man.
19:12cemerickRaynes: I'm _very_ aware of my markup nirvana. :-)
19:13justicefriesthat sounds pretty ugly.
19:13cemerickRaynes: If I were you, I wouldn't bother with their templates or openoffice at all until you're 98% *done*. At that point, pick through as you need to match what's required.
19:14Raynescemerick: I think it's likely more tolerable to apply the styles as I go, because there are a lot of them. A l-o-t of them.
19:14amalloyi imagine cemerick is right
19:15amalloybecause then you can edit stuff
19:15RaynesWell, I can edit stuff anyways.
19:15cemerickconstantly going type-3-words, mouse around, type-6-words, mouse around would drive me batty.
19:16RaynesIt's pretty bad. I should have self published.
19:16carlo_auRaynes: why not LaTeX?
19:16Raynescarlo_au: Because my publisher doesn't like it.
19:16RaynesAnd I don't really like it either.
19:17RaynesDon't really want to learn a new language to write a book.
19:17RaynesIf they just had an asciidoc or docbook workflow like every other decent publisher, things would be easy.
19:17cemerickI thought conversion to emacs required a tour of duty in the LaTeX mission?
19:18carlo_auRaynes: there's not that much to LaTeX
19:19carlo_authe horrible details are best left to a publisher
19:19cemerickRaynes: Right, see, you should just march in there and set them straight. ;-)
19:20RaynesI've complained so hard.
19:20RaynesI know, but I seriously have.
19:20RaynesI seem to recall saying something like "Please, oh please, come up with some sort of markup workflow. If not for me, for future writers."
19:20cemerickThings like this are fundamentally not worth fighting for.
19:21RaynesWhy not?
19:22cemerickBecause you have no stake in the inner bowels of a publisher you have no stake in, and even if you were to convince them to change things, that change would surely not go into effect in time for you to take advantage.
19:23cemerickIt's like me walking into a department store and trying to get them to change their POS system.
19:24RaynesMy editor said that he had been working on getting some sort of asciidoc or markdown workflow going, but hadn't been successful yet. I mostly encouraged him. I didn't really elevate my position.
19:25cemerickSure. I've seen people invest a lot of resources into pitched battles like this. I guess it was a generalized comment.
19:26technomancymanning used to require _word_ files, so... it could be worse
19:30amalloytechnomancy: i have this bizarre mental image of sending them a book comprised of a zillion single-word files and waiting for them to stitch it all back together
19:31technomancyamalloy: sounds about right; isn't that how Office works behind the scenes?
19:31amalloyit would explain the size of the .doc files
19:32cemerickgfrlog: non-technical people in general aren't so picky and irritable as we are.
19:32Raynescemerick: Paragraph styles are easy for the most part. The template automatically uses the right paragraph styles and switches them when they need to be switched. The only time I have to set a paragraph style manually is when I'm pasting a block of code or doing something equally... different.
19:32RaynesCharacter styles are a problem.
19:32amalloygfrlog: "Isn't it great that you can send Word files? Last time I published you had to supply your own ink and typewriter"
19:32RaynesThere are a lot of 'literal' words (names of functions and such) in my book so I have to set literal, write the word, set default, continue.
19:33gfrlogamalloy: that's the kind of thing I was thinking. that maybe word files are literally the best that a publisher could possibly offer.
19:33cemerickRaynes: asciidoc inline styles: _foo_, `bar`, *baz* </rubbing-it-in> :-D
19:33gfrlogRaynes: you have keyboard shortcuts for all that?
19:33kwertiilearning LaTeX was highly annoying. it has a bizarre and archaic syntax, and a million subpackages for every little thing. it was a very steep and painful learning curve. BUT now everything prints EXACTLY as I want it to.
19:33RaynesI have a keybinding for that though. As a matter of fact, keybindings would make nearly all of this irrelevant but OpenOffice shortcuts are completely destroyed on OS X.
19:35Raynescemerick: One fantastic thing is that I get to use wingdings. Never thought I'd get to do that.
19:35cemerickRaynes: for what?
19:36RaynesNumbering lines in code so that I can address each line individually in my text.
19:36RaynesStuff like that.
19:36cemerickRight, callouts.
19:37cemerickasciidoc callouts are pretty nifty http://www.methods.co.nz/asciidoc/chunked/ch17.html#CO1-3
19:38RaynesMan, this conversation has sucked like an hour of productivity out of my work day. You should all be ashamed.
19:38cemerickI do wish github had better asciidoc support. It blows markdown out of the water completely.
19:41technomancymarkdown is totally a least-common-denominator
19:42cemerickPerhaps, but it's better than a lot of other options.
19:42cemerickI could never stand textile, for example. There's another extraordinarily verbose markup out there that is popular for reasons passing understanding, the name for which escapes me.
19:43technomancymediawiki?
19:44RaynesWhatever pathetic markup that JIRA uses?
19:44cemerickheh, that's not it, but it's worse than all the others combined
19:44amalloyargh jira
19:44Raynes$kill
19:44lazybotKILL IT WITH FIRE!
19:56hiredmanyou can tell emacs is a serious editor because it runs as part of its own build process
21:18leo2007Good morning.
21:18leo2007When I run swank-clojure shell script, it prints back: user=> Connection opened on null port 4005
21:18leo2007but slime-connect fails
21:18leo2007Connecting to Swank on port 4005.. [2 times] open-network-stream: make client process failed: connection refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service, 4005, :nowait, nil
21:19leo2007ideas?
22:06fmwI posted a clojurescript related post to HN: http://news.ycombinator.com/newest
22:06fmwnot linking directly on purpose, because the HN system detects any upvotes from that as cheating ;)
22:24amac_I've having a few problems with namespaces: I need to intern a bunch of defs to partial fns at runtime, the first problem is that if I intern to *ns* it doesn't refer to the ns of the caller it's hitting some global ns (lein points to 'user, running the jar dumps in 'clojure.core(?!)), the second is that regardless of where they are interned I can't seem to call them (they don't pass the compiler check that they exist,
22:26hiredman*ns* is a compile time construct
22:26hiredmanvars are resolved at compile time
22:26amac_damn.
22:27leo2007why the means I use to connect to internet interfere with slime connection to swank-clojure?
22:27leo2007on the same machine of course.
22:28amac_leo2007: what problem are you seeing?
22:29leo2007for example, when I am connecting to internet through my iphone, I am getting Connecting to Swank on port 4005.. [2 times] open-network-stream: make client process failed: connection refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service, 4005, :nowait, nil
22:29amac_hiredman: is there a proper way to define things at runtime and have them be visable?
22:29hiredman"don't"
22:29amac_hah
22:29amalloyamac_: good advice
22:30amac_leo2007: could be how your phone is routing traffic
22:30hiredmanI mean, you can do it, but if you find yourself doing it, you should stop and do something better
22:30leo2007amac_: common lisp swank works just fine.
22:31amac_It was just meant to be some syntactic niceness in an orm I'm writing, map the crud fns to nice names that are defined outside the scope of the script
22:31amac_leo2007: that's odd, how are you launching swank?
22:32leo2007I run the swank-clojure script in .lein/bin
22:32amac_scratch that, use the lein plugin
22:32leo2007what?
22:32clojurebotwhat is bla
22:32amac_then just go to your project and type "lein swank"
22:33amac_are you familiar with lein?
22:33leo2007amac_: I can only tested it later since I cannot disconnect now.
22:33leo2007amac_: a little bit by reading lein --help
22:33leo2007I am comfortable with lisp and slime/swank though.
22:34amac_lein is a dependency/build tool, and pretty standard for most clojure projects, it also has a plugin for easily launching swank
22:35amac_take a look at the github page for instructions
22:36leo2007amac_: I need to modify swank-clojure to work with latest slime. Loading that old slime.el screw over my setups for common lisp and scheme.
22:36leo2007amac_: thanks for the pointer.
22:37jweissthis is a bizarre bug. with my project (mix clojure java) using lein's classpath, a simple test with xmlrpc client deadlocks waiting for a connection. if I remove src/ and resources/ from the classpath, it works. but leaving either one in, deadlocks.
22:37jweissthe test is entirely a java codepath, so the clojure source being in the classpath shouldn't matter
22:37jweissand certainly not the png files in resources/
22:39amac_leo2007: np, ping me later if its still not working for you
22:41leo2007amac: thanks a lot.
23:13gfrlog,(println ",(println :foobar)")
23:13clojurebot,(println :foobar)
23:13gfrlogdrat
23:18amacgfrlog: Isn't there a second bot in here still? Get them to talk to each other. :)
23:19amalloyjesus. do we have to do attempt-and-fail a bot-storm every week?
23:20amacyes.
23:21gfrlogamac: I thought of that one a while ago. Why it took me this long to try clojurebot on itself, I'm not sure.