#clojure logs

2011-03-19

01:16Lulu58e2I'm using Slime+Swank and C-c C-k keeps giving me an error about a seemingly out of date file; is there cached files or something I need to clear out?
01:18Lulu58e2I'm hacking around and tried putting :reload in my :use libspec (not sure if I have the terminology right there)
01:18Lulu58e2Also tried recompiling all of the required libs
03:43Lulu58e2I figured out my slime issue: upgraded to emacs 23.2, Swank-Clojure 1.3.0_SNAPSHOT and Slime 20100404.1
06:09khaliGthe java compatibility thing seems to be a bit of a double edged sword. you get a lot of libraries, but the clojure wrappers are usually incomplete or partial ones (just enough for the authors needs), which means there is this tension of not quite being able to do what you want, with the given library. Is this a fair assessment?
06:10brehautkhaliG: you are supposed to just be able to do what you want with the java library; any wrapper is merely a convenience
06:11tomojof course there is plenty of that tension with the java libraries themselves, just like everywhere else
06:11raekI get the feeling that clojure was built to be able to use "pholosophically compatible" libraries (e.g. immutable objects) without wrapper libs
06:11ChousukeA better way to put it is that Java APIs are usually not very idiomatic in functional-style programs
06:12chitsubrI've read that the python intepreter prompt is not a real REPL like the clojure prompt is, but couldn't understand the difference why. Is that statement true, and if so, why?
06:13brehautchitsubr: can you link to that claim, i think it needs more detail
06:13ChousukeI suppose python lacks "read"
06:13Chousukeso technically it's not a REPL
06:13Chousukeit's just an EPL :P
06:13chitsubrbrehaut: yes, I'll try to find the proggit comment thread where that claim was made
06:13brehautChousuke: it has read; it just happens to be inextricably linked to eval
06:13raekI think the argument is something like that you cannot decompose the python prompt into a distinct Reader, Evaluatator and Printer
06:14khaliGchitsubr, from memory you can't redefine a function in the repl but i could be wrong about this i don't remember very well since i never really used python
06:14Chousukebrehaut: yeah
06:14brehautkhaliG: you are completely wrong about that
06:14khaliGbrehaut, yea, just checking it now
06:15ChousukekhaliG: remember to indent properly :)
06:15khaliGchouser, heh the repl just complained about just that!
06:15brehautits a mutable dynamic language; changing things is what it does best :P
06:15chitsubrhere's part of the quote: REPL" has taken on more connotation than just "read, eval, print." When people say they want a REPL they usually mean they want:
06:15chitsubr1) An actual interactive prompt. 2) Per-file and per-region compilation into a running image. 3) Some sort of scratchpad that has state.
06:16khaliGok scratch that you *can* redefine functions
06:16raeksome clojure users seem to want to avoid using java interop at all costs (i.e. refuse to touch a java lib if it doesn't have clojure wrapper)
06:16Chousukehmm, that's overloading the term a bit too much
06:17Chousukebut yeah with clojure you can start a REPL that's connected to a running application and work with it on the fly
06:17chitsubrhere's the link to the comments : http://www.reddit.com/r/programming/comments/g24y3/, the comment I read was made by (search for) rayiner
06:17ChousukeI have no idea if that's possible with python
06:18chitsubrChousuke: if I have a running Clojure application, will any REPL I start be connected to it?
06:18Chousukechitsubr: if it's within the same JVM instance, yes
06:18Chousukemost of the time it won't be I suppose
06:19chitsubrChousuke: so do I have the ability when starting a REPL ot specify the JVM it should attach to?
06:19raekchitsubr: it's the other way around: you start the repl from within an already running instance
06:19Chousukenot really. though I think there are ways to do that using the java debugging facilities.
06:20Chousukethe most common situation is that you start a repl in slime or something
06:20Chousukeand then run your application from there
06:20Chousukeand the repl stays running
06:21raekwell, if you have evaluated (swank.swank/start-repl), every time slime connects to the swank server, a new repl will be created
06:21Chousuketechnically that should be possible with python too.
06:21chitsubrhmm.. so if I want a startup daemon written in Clojure, I would have to first fire up a repl and then run the daemon in it?
06:21brehautchitsubr: that thread is a trainwreck
06:22Chousukechitsubr: only if you need a repl, really
06:22chitsubrbrehaut: sorry, my bad in linking to it
06:22brehautchitsubr: its my bad for clicking on something that clearly had reddit in the domain
06:22chitsubrI was just interested in one comment
06:22Chousukechitsubr: and there are ways of starting a "remote" repl within an application that can be connected to later.
06:22raekchitsubr: you could have a -main that starts up the daemon and a repl socket server
06:23chitsubrawesome, I'll do some searching for remote REPL's and repl socket servers
06:23Chousukehow's the nrepl project doing?
06:23Chousukehttps://github.com/clojure/tools.nrepl
06:25raekchitsubr: check out clojure.main/repl (http://clojuredocs.org/clojure_core/clojure.main/repl) and http://clojuredocs.org/clojure_contrib/clojure.contrib.server-socket/create-repl-server
06:38brehautChousuke: chitsubr: BTW, examine pythons ast.parse and __builtin__.compile functions; it clearly has a seperate reader and evaluator. its just not very useful
06:40chitsubrbrehaut: and the reason it's not very useful is perhaps because python programs aren't represented as python data structures, AFAIK and unlike Clojure
06:41brehautchitsubr: they are; it just happens that OO has specific data structures (in this case AST objects) for everything, rather than prefering generic datastructures (even though it has them)
06:41chitsubrbrehaut: I've got this (perhaps wrong) idea that Clojure and lisp's repl's are powerful since the programs can be represented by the data structures used in the language
06:41chitsubrbrehaut: oh ok
06:42Chousukebrehaut: of course it has a parser and an AST but that's more of an implementation detail :)
06:42brehautChousuke: well yes, but if the claim is that python doesnt have a repl because you cant get access to those pieces from python itself, its a faulty claim
06:43brehaut(note, im not suggesting that the ast is going to be particularly useful to 99.99% of python developers, unlike a lisp AST)
06:44chitsubrbrehaut: just to clarify, by lisp AST do you mean a list?
06:44brehautand atoms
06:44chitsubrok
06:44brehaut(in the lisp sense, not the clojure sense)
06:44Chousukeand in clojure's case, vectors, maps and other things :P
06:44chitsubrright, ok
06:45Chousuke(sets never get any love in code-is-data discussions)
06:45brehaut#9
06:46brehautapparently i fail at using clojurebot
06:47brehautchitsubr: "9. It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures." – Alan J. Perlis
06:47chitsubrbrehaut: aha, thanks
06:48brehautchitsubr: the utility of the AST being in the same datastructures you already know the API to manipulate is extremely powerful.
06:49chitsubrso Perlis's quote is directly applicable to lisp, but for clojure its 100 functions and four data structures?
06:49brehautclojure just takes the ideas in lisp further
06:49brehautit acknowledges that data does have different shapes, but those shapes generic (sequences, maps, sets, etc)
06:50Chousukechitsubr: all of the data structures can pretend to be sequences, so not really :)
06:50brehaut&(seq {:foo 1 :bar 2}) ; ftw
06:50sexpbot⟹ ([:foo 1] [:bar 2])
06:52chitsubrbrehaut: what does the &(...) do?
06:52brehauttells sexpbot to evaluate the code
06:52chitsubroh ok
06:52brehautcomma does the same for clojurebot
06:52brehautsexpbot just has a nice feature that helps my tired brain
06:53chitsubr:)
06:53brehautsuch as ##(map inc [1 2
06:53Raynesbrehaut: >_>
06:54brehautRaynes: what have i done to sexpbot? is he ignoring me
06:54Raynes$kill
06:54sexpbotKILL IT WITH FIRE!
06:54RaynesHe seems okay.
06:54brehaut&(map inc [1 2
06:54sexpbot⟹ (2 3) ; Adjusted to (map inc [1 2])
06:54brehaut:D
06:54RaynesI see.
06:55brehautRaynes: you must have known about this?
06:55chitsubrbrehaut: cool, some AI I see
06:55brehautchitsubr: hah no
06:55RaynesYes, of course. I assumed you expected the embedded execution to do the same thing.
06:55brehautRaynes: i did; why wouldnt it?
06:56RaynesThat was weird.
06:56brehautchitsubr: its just a simple parser with an error handler that matchs up any missing parens if it reaches the end of input
06:56chitsubrbrehaut: ok :)
06:56brehaut&(inc 1]
06:56sexpbot⟹ 2 ; Adjusted to (inc 1)
06:56Raynesbrehaut: I don't know. I was just responding to... sigh. I should go to sleep. ._.
06:57brehautits late over here in the future too.
06:58chitsubr4 am pst here, I'm off, thanks folks
06:59brehautRaynes: on the other hand, shiny new TJoC
06:59RaynesI saw.
08:32Rayneschouser: That's one hefty ebook you've got there.
08:32RaynesWeighing in at just over 13 pounds, it's certainly a contender for the heavyweight title.
09:13angermannifty.
09:15__name__I'm confused.
09:16__name__Why does Clojure 1.1 do that:
09:16__name__user=> (def a 1)
09:16__name__#'user/a 1
09:23danlarkin__name__: do what? let you use def?
09:24__name__danlarkin: See how it defines a 1 instead of a.
09:24__name__m(
09:24__name__I've used a non-breaking space, nevermind.
09:24__name__That's quite interesting, though
09:25__name__http://paste.pocoo.org/show/356042/]
09:25__name__http://paste.pocoo.org/show/356042/ even, sorry.
09:25fliebel__name__: I wonder if you read a file that contains backspaces, if you could define even weirder stuff :)
09:26__name__fliebel: :)
09:26__name__I think the nbsp should not be allowed in identifiers.
09:26__name__No whitespace should, imo.
09:26danlarkin__name__: yeah if you just replace your nbsp with another character that behavior becomes more clear
09:26fliebel__name__: How did you insert one?
09:26__name__fliebel: I had it set to shift+space
09:27__name__danlarkin: Yes, I just really think no whitespace should be legal in identifiers.
09:27__name__*allowed evenn
09:28fliebel__name__: Problem is ther eis a lot of dubious whitespace in unicode.
09:28__name__fliebel: Yeah; would it really be a problem just to exclude them all?
09:28__name__It's also that I'm not a big fan of Unicode in code anyway :)
09:32fliebel__name__: I think it's great, we just need unicode keyboards :D
09:33__name__I think ascii is good enough and already widespread, but that's just me.
09:33__name__I also use a keyboard not designed for my native language, so I am weird.
09:34fliebel__name__: Which are?
09:34__name__fliebel: I use a 104-key qwerty which does not have some letters on it I need for my language.
09:35__name__ö, ä, ü and ß.
09:45fliebel__name__: Ah Germany :) My lang does not have these, but I can do them… ö ä ü ß
09:45__name__I can do them as well, I have a compose key ☺
09:46angerman,(map vec [1 2 3] [2 3 4])
09:46clojurebotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$vec
09:48angerman,(doc unless)
09:48clojurebotCool story bro.
09:55fliebel&(map vector [1 2 3] [2 3 4])
09:55sexpbot⟹ ([1 2] [2 3] [3 4])
09:55fliebelangerman:
09:56angermanfliebel: thanks. Guess that would be better than (partition 2 (interleave …)) :D
09:57angermanlol.
10:00__name__fliebel: But actually I come from Austria, not Germany :)
10:01angerman__name__: so you to the cheap gasoline and huge ski resorts :D
10:01__name__angerman: I don't use a car, but yes :)
10:02angerman__name__: hehe. It's not that far from here.
10:03angermantoo far though for it to be economical to refuel in austria...
10:07phenom_,(type (vector-of :byte))
10:07clojurebotclojure.core.Vec
10:09__name__angerman: Where are you from?
10:10angermanMunich
10:10angermanwell, that's where I live.
10:10__name__People from Passau refuel in Austria :)
10:10angermanyea, but Passau
10:11angerman's not that far off the boarder :D
10:11__name__Passau is nice.
10:12angermandon't know. This is actually foreign territory to me. I'm actually from the strip of land between the baltic and north sea.
10:12__name__Hamburg?
10:13angermannorth of that :)
10:13__name__(territory, not city.)
10:14angermannot even :)
10:14__name__Oh wait.
10:14__name__Schleswig-Holstein?
10:14angermanRight behind my parents home is the ancient danish border.
10:14angerman__name__: yes.
10:14__name__I thought that belonged to Hamburg :(
10:14__name__But Hamburg is city and territory at once, it seems.
10:15__name__You learn something new every day :)
10:15angerman__name__: yes. We have some of those city states.
10:15__name__angerman: Vienna is one too.
10:15angermanMost of the old Hanse states are.
10:16__name__Vienna is because it was socialist.
10:16angerman__name__: a fellow student keeps telling me that Vienna is weird. (He's CBA)
10:16__name__And lower Austria was conservative.
10:16__name__angerman: What's a CBA?
10:17angermanchinese born austrian.
10:17angermanHe actually served an extended period in the Bundesheer before coming to Germany to study...
10:17__name__Is that acronym common?
10:17__name__angerman: In which way is Vienna weird?
10:18patrkrisis it at all possible to use `lein run somescript.clj` since leiningen 1.4.0?
10:18angerman__name__: not so sure. Might be because my friends a from many countries and ABC (American born Chinese) is common, other 3 letter abrevations are used.
10:19angerman__name__: he sais they talk funny and are weird in general… not so sure about that though. He's from Klagenfurt though.
10:19__name__Hahaha, Klagenfurt :-)
10:19__name__angerman: I could tell you the same about Klagenfurt :)
10:19angermanyea I guess it like the bavaria thing in Germany I guess.
10:20__name__Vienna is a bit weird, but I kind of like it
10:20__name__The people are a bit more … ehm … direct and … ehm … sincere.
10:23angerman__name__: been there only once in my life so far. And that's 6 years ago… the thing I remember most was that the streets were a little dirty.
10:24__name__angerman: Paris is worst in that regard.
10:24angermanBeen last year to Salzburg. That's been quite nice. And the streets were less dirty. But that might have changed in Vienna as well.
10:24__name__angerman: Salzburg is just smaller.
10:24angerman__name__: yea. Heard about that. But it's the French. So. :D
10:25__name__And they don't allow you to go up the steeples of their churches :(
10:25angermanAnd I must admit I like Hong Kong best so far.
10:25__name__Stupid Salzburgians(?)
10:25__name__angerman: Have not been there.
10:25angermanwell. Not much a problem for me. I don't care for Churches.
10:25__name__I like the view.
10:26__name__angerman: Hong Kong is pretty modern, eh?
10:26angerman__name__: it's probably one of the few asian cities (Singapore, maybe?) where you can get by with no word chinese (or in this case cantonese).
10:27angermanAnd It's damn clean. People are friendly… it's mostly cheap.
10:27__name__angerman: What about Japan?
10:27angermanJapan was dead expensive.
10:27__name__But they speak English, right?
10:27angermanhaha!
10:27angermanNice try.
10:27__name__No?
10:28angerman__name__: as usual the closer you get to the touristy areas the better the english gets.
10:28__name__Yeah.
10:28__name__But it's rather good in central Europe.
10:28angermanAnd of course you can do all kinds of tours in English and find your way with english. But apart from that… (e.g. if you like to go off track, you can get lost quite fast).
10:29__name__I mean, you can get along with only English quite well here in Austria.
10:29angermanEven in a semi-central area of Osaka, the bank was unable to help me withdraw money (using a VISA card) in english.
10:29__name__I once knew an Australian who lived here.
10:30angerman__name__: sure. Europe is different. Apart from France I guess we have agreed on one universal language here.
10:30__name__Yea, France is funny.
10:30__name__‘Do you speak English?’ made one person say ‘Non!’ as if I had insulted all of his kin.
10:31angermanyou did.
10:31__name__Haha.
10:31__name__I speak some French, but I could not understand him.
10:31angermanI can hardly read french.
10:31__name__There's a huge difference between understanding a language and understanding people :)
10:32__name__I mean, I don't think many German non-natives understand people in Vorarlberg.
10:33__name__And there are some communication problems between north and south of the German speaking area.
10:33__name__I've had people from northern Germany not understand me because the words I use simply do not exist there.
10:34angerman__name__: yes I takes me sometimes a bit as well to understand some people around here.
10:34angermanBut with a little imagination you can usually guess what the word means and from where it comes. Not that I'd ever used it that way or in that context. But I can still make sense of it.
10:35__name__Like “Marille”, “Powidl”, “Knödel” …
10:35angermanAnd bavarian is still easier than plattdüütsch.
10:35angermanWell Knödel should be known all over Germany.
10:36angermanBut yes, I wasn't talking about subjectives. :)
10:36__name__And the lack of “Weiters” in Germany-German confuses me :)
10:36__name__It's a great word.
10:37angermanI mean we definitely do not have the work Kren. (Don't know how that's spelled right… It's Rettich)
10:37__name__Isn't it Meerettich?
10:37angerman__name__: what's Weiters supposed to mean?
10:37angermanyes.
10:37__name__*Meerrettich even
10:37__name__angerman: Similar to “zudem”.
10:38__name__“österreichisch auch, weiterhin, darüber hinaus, außerdem, im Weiteren”
10:39angermanwell you can guess from Weiters that it's a supposed addition. But it doesn't fit grammatically. Closes would be Weiteres, though that's probably further away in meaning.
10:40__name__angerman: Weiteres is something different.
10:40__name__angerman: Weiters is mosly used eat the beginning of a sentence.
10:41angermanI guess we'd use "Im Weiteren" or some construct like that.
10:41__name__It's more zudem I think.
10:42__name__dwds, e.g., has „Die gerichtsmedizinische Sachverständige erhielt weiters den Auftrag, die Blutproben der Unfallbeteiligten chemisch-toxikologisch sowie deren Kleidung und Ausrüstungsgegenstände auf Spuren zu untersuchen“ in the examples.
10:43angermanyou could substitute im weiteren… or zudem.
10:43__name__im Weiteren sounds odd in that context, but that might be because I am used to weiters.
10:43angermanThe problem, at least to me, is that weiters does just not sound right.
10:44__name__angerman: But it is, the Austrian Dictionary, which is the authority, allows it ;)
10:45angermanLanguage rules are something weird.
10:48__name__Yes
10:48__name__They messed that up a bit.
10:48__name__With all their reforms and revertions of parts thereof.
10:49angermanI can live with quite a lot. But the abusive use of 'r' 'u' 'wif', … in HK really start to get annoying.
10:49__name__HK?
10:49angermanluckily they have yet to penetrate the government.
10:49angermanHong Kong
10:50angermanfeels like you ended up in aolbonics land.
10:50__name__What's ‘r’ ‘u’ ‘wif’
10:50__name__Are you with?
10:50angermanyes.
10:50__name__Well, be back soon.
10:50angermanand that's just the beginning.
10:50__name__Nice talking to you.
10:50__name__Need to go buy groceries.
10:51angermanright, your shops close so early.
10:51angerman20min left.
10:51angermanlol
10:51__name__Yep, we're good Christians :)
10:51angermanbawahahahaha.
10:51angermanThor for life!
11:27devnSteve Yegge's FOREWORD to JoC is awesome: http://www.manning.com/fogus/excerpt_foreword.html
11:29TimMcI like it.
11:34devn:)
11:34phenom_anyone know why doing byte equality does reflection into clojure.lang.Util ?
11:34__name__angerman: Out shops don't close as early as they used to, though.
11:36angermanphenom_: switch on the reflection flag?
11:37angerman__name__: we consider 8pm in Germany conservative on Saturdays.
11:37pdkclosing at 8 on a weekend would be lame anywhere
11:38angermanpdk: it used to be 4pm
11:39phenom_angerman: i have ... i'm doing an equality check on 2 bytes but for some reason it's doing reflection into clojure.lang.Util
11:39phenom_for "equiv"
11:44__name__angerman: :O
11:45angerman__name__: yea. People from outside of bavaria complain on a regular basis that shops close at 8pm.
11:45angermanthat they close at 8pm thoughout the whole week...
11:54phenom_(= (byte 10) (byte 10)) throws a refelction warning ... "call to equiv can't be resolved ..."
11:54phenom_,(= (byte 10) (byte 10))
11:54clojurebottrue
11:55phenom_,(set! *warn-on-reflection* true) (= (byte 10) (byte 10))
11:55clojurebotjava.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set
11:59TimMc,(binding [*warn-on-reflection* true] (= (byte 10) (byte 10)))
11:59clojurebottrue
11:59scottjhow come clojure uses same hash for 0 and -1?
12:00TimMc,(map hash [0 -1])
12:00clojurebot(0 -1)
12:00scottjI guess cause java does, why does java? it means you can't (case x 0 something -1 somethingelse)
12:00TimMcscottj: Not seeing it.
12:01TimMc,(map (comp hash long) [0 -1]) there we go
12:01clojurebot(0 0)
12:01scottj*clojure-version* => {:major 1, :minor 3, :incremental 0, :qualifier "alpha4"} (map hash [0 -1]) => (0 0)
12:02TimMcHappens in 1.2 as well.
12:02TimMcOh, interesting -- you're getting that without using long.
12:02TimMc,(doc case)
12:02clojurebot"([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can fol...
12:03scottjprobably tied into 1.3 returning longs by default if it can I think
12:04TimMcI had no idea that case used hashes.
12:05TimMcscottj: What happens if you do #{0 -1} ?
12:07scottj#{0 -1}. (.hashCode 0) and (.hashCode -1) both return 0
12:07devn,(hash 0132294329432)
12:07clojurebotInvalid number: 0132294329432
12:07devn,(hash 01322)
12:07clojurebot722
12:07TimMcWhy the leading 0?
12:08scottjbase 8 I think
12:08scottj,07
12:08clojurebot7
12:08scottj,08
12:08clojurebotInvalid number: 08
12:09TimMcI thought Clojure didn't do that!
12:09TimMc10r08
12:09TimMc,10r08
12:09clojurebot8
12:10TimMcOh well. I guess it is using Java's number parsing.
12:10scottjwhat's that syntax mean? any base you want?
12:10TimMcyeah
12:10scottjcool
12:11TimMc,36rnaqk2b
12:11clojurebot1408757267
12:11TimMc,36rrrrrr
12:11clojurebot46645335
12:15TimMc,(case (long 0) (long 0) :zero, (long -1) :neg1)
12:15clojurebotjava.lang.IllegalArgumentException: No matching clause: 0
12:15TimMc,(case 0 0 :zero, -1 :neg1)
12:15clojurebot:zero
12:16TimMc,(case -2 0 :zero, -1 :neg1)
12:16clojurebotjava.lang.IllegalArgumentException: No matching clause: -2
12:16TimMcBah, typo.
12:16TimMcWhat do you suppose went wrong with my first case statement?
12:22devn,0x2a
12:22clojurebot42
12:22TimMc,0b1010101
12:22clojurebotInvalid number: 0b1010101
12:22devn:)
12:23TimMcscottj: Interesting, so set seems to work.
12:24TimMcscottj: What exactly happens when you write (case -1 0 :zero -1 :neg1) in 1.3?
12:25devn,[32e-4 +3.14 888/3 \u0042 \u30DE :?]
12:25clojurebot[0.0032 3.14 296 \B \マ :?]
12:32TimMchttp://dev.clojure.org/jira/browse/CLJ-426 <-- This is the closest ticket I can find to the long hash issue.
12:41jarpiain,(case 'long (long 0) :zero, (long -1) :neg1)
12:41clojurebot:neg1
12:43TimMcwut
12:44TimMcSo, in other words... case is entirely fucked.
12:46incandenzait says the tests must be compile-time literals, so I don't think (long 0) qualifies
12:47TimMcWhy does it even compile, then?
12:48Chousuke,(case 'test (foo test) :test, (something else) :test2)
12:48clojurebot:test
12:49Chousukelists in case specify alternatives
12:49Chousuke,(case 'foo (foo test) :test, (something else) :test2)
12:49clojurebot:test
12:49incandenzaah
12:54__name__angerman: are your shops opened at sun?
12:55angermanno
12:55__name__here only few shops have opened until 8pm.
12:58TimMcOK, so the long hash thing is part of that ticket.
12:59TimMcI see that the collision is discovered at case's macro runtime, not use-time.
13:07TimMcOr wait... is this long hash thing known by the devs?
13:24mefestoHey everyone
13:24mefestoI have a project that I'd like to layout like this: http://pastie.org/1690020
13:25mefestoUsing leiningen for each subdir. How can I make use of the common lib in the other projects? Do I need to do a lein install the common-lib for each change and a lein deps in the server/client subprojects or is there a better way?
13:29TimMcmefesto: You can use symlinks and lein checkout dependencies.
13:30mefestoTimMc: I'm not clear what you mean, could you expand a bit?
13:32dpritchettwhen's the JoC party?
13:33TimMcmefesto: Go to the main Leiningen page and search for "checkout dependencies"
13:35mefestoTimMc: cool thanks. Looks like that will work for me. Although a guy I work with is on windows ... too bad for him :)
13:35TimMcindeed
13:36TimMcThat's one of the reasons I can never go back to Windows.
13:36TimMcI believe there is some way of making symlink-like things in NTFS, but it isn't in the UI.
14:04dpritchettClojure and JVM pecadilloes are the reason my newest laptop runs OSX. Got tired of all of my favorite niche languages being harder to play with even with Cygwin.
14:43devnis clojure niche still?
14:44devni guess it doesn't really matter to me either way, but it seems like the community is growing pretty fast, people are hiring clojure programmers, etc.
14:44dpritchettit's not an LCD sort of thing like java, c#, or php
14:44dpritchetti mean, you're not going to see many job listings for clojure here in memphis
14:45TimMcI'm applying for a position at Akamai where I would be writing Clojure.
14:45dpritchettbut what I was referring to is my early experiences with clojure node.js and various other comparatively new and exciting languages
14:45dpritchettthe blog posts and tutorials are always written by someone with a real live posix environment
14:46dpritchetttrying to follow along under winXP was always frustrating since learning a new language/platform is enough of a headache that mentally translating everything to windows wasn't worth it
14:46dpritchettsort of like trying to raise VC for a startup in alabama. you could do it, but it's harder than it needs to be.
14:46devnim echoing what someone else was saying -- think it was maybe guy steele at strange loop last year?
14:47devnbut it's interesting and exciting that new languages are being considered right now
14:47dpritchettsure is!
14:47dpritchetti regret missing strange loop last year, it's only half a day's drive
14:47dpritchettmaybe i can get it this year
14:48devnim in WI so I drove down (butt was asleep about half way)
14:48devnbut definitely going to go again -- it's a great mix
14:49dpritchetti know at least one guy from Memphis who went... i need to have lunch with him again soon
14:58devnhm, time to play with https://github.com/jonromero/music-as-data.git
15:05scottjI'm not sure the TIOBE language popularity index relates well to industry, it has Objective-C and Lisp neck and neck
15:05companion_cubelisp is as used as objective-C ??
15:07pdkmaybe with some big technicalities slapped on the way they're counting
15:08dnolenscottj: that's combining Common Lisp, Scheme and Clojure I think.
15:09scottjdnolen: don't think so, it has scheme separately
15:09dnolenscottj: perhaps combining CL then.
15:10scottjbut I see now how they're doing it. they have 7 sources including job postings on craigslist, bookmarks on delicious, code on google code, projects on freshmeat, books purchases at some retailer, etc
15:10incandenzahow are they neck and neck anyway? doesn't look like it to me: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
15:12scottjoh my bad, I was looking at http://www.langpop.com/ hehe I don't know how I got there looking for tiobe
15:12devnincandenza: hal, is that you?
15:13devnor are you the samizdat?
15:14incandenzaI guess I'm not, or I should be incapable of speech
15:15devnwait a minute, this is a terminal window, you're just typing, so how do i know you're not hal?
15:35devn2 questions: I can't seem to find http://code.google.com/p/jfugue/ in a maven repository, but it seems like it should be there, any ideas on search tools to find its proper home? 2nd related question: what's the best way to get it into my project.clj so it can be redistributed without making people hunt down a jar and add it manually (aside from including it in the repo)
15:37mrBliss``devn: I usually look on http://jarvana.com but unfortunately it can't find JFugue.
15:38devnyeah i set this up a long time ago and i found an issue for JFugue that stated they were going to make it available there
15:38devnso i know it exists somewhere
15:38devni just have no idea where it is...
15:39TobiasRaederhi :)
15:39devn'lo TobiasRaeder
15:40devnmrBliss``: well, looks like i wasn't alone -- it's on clojars at least...
15:40devnmrBliss``: and whaddya know, I happen to be the one who uploaded it
16:05alexykanybody used kendall-tau from incanter?
16:56TimMcI had a list of coordinates in n-dimensions, and needed to get the [min max] value for each dimension: ##(map (partial apply (juxt min max)) (apply map vector [[0 1] [2 3] [5 -1] [4 6] [-2 3]]))
16:56sexpbot⟹ ([-2 5] [-1 6])
16:56TimMcmap partial apply juxt!
17:02devnhm, jfugue is pretty cool
17:03TimMcdevn: What is it?
17:03devnit's a music library for java
17:03devnprogramming music
17:04devnit's big, but i want to write a wrapper for it
17:04devnTimMc: it has its own mini DSL for writing notes, rests, lengths of them, etc.
17:04TimMcInteresting.
17:05devnso (. (new Player) play (Pattern. "C5q Rw")) plays a C5 quarter note followed by a measure-long rest
17:06devnI want to write the wrapper, build an abstraction around the way it does notation to make it more data-like instead of keeping it all in a string
17:07devnalthough im not sure how the second part of that would be
17:07devnI guess I just want a more generative composable system for writing those strings programatically
17:09devnso (generate-chord-progression [2 5 1 {:measures 4}]) could produce something like Dm, G, C, C
17:11zakwilsonPersistantHashMap lookups are O(log32 n), right?
17:13devnzakwilson: yes
17:14zakwilsonLookups aren't faster in the transient, are they?
17:15devnzakwilson: hm, good question
17:15zakwilsonI know writes are faster.
17:16opqdonuti'd say not
17:16devnopqdonut: im guessing you're right but i cant say for sure
17:17zakwilsonI think I might need to use a Java hashtable if I want more speed.
17:18raekI think transients has the same basic structure, but they allow some things to change in-place
17:18opqdonutyeah
17:19opqdonutno reason for non-transients to have poorer read performance
17:20zakwilsonThat's what I thought, but I figured I'd ask. I'm dealing with some large maps, and the diminishing read performance is starting to hurt.
17:20zakwilsonUnfortunately, (into (Hashtable.) stuff) doesn't work.
17:21raekeven if you have about 4 000 000 000 entries, the tree won't have more than 6 levels
17:21devnopqdonut: i mean, going with a transient and tersting could show you pretty quickly
17:21devntesting*
17:21Chousuketransients won't help read performance. :/
17:21opqdonutindeed
17:22devnoops i read zakwilson say write and not read
17:22devnbut i mean, it could still be worth trying a transient
17:22devnit wouldn't take much to benchmark
17:23zakwilsonIt looks like I'm dealing with 3 or 4 levels, but I'm doing a *lot* of lookups, so being 3-4 times slower is a big deal.
17:23devnwhat about structmaps? :X
17:24devnis that insane?
17:24zakwilsonThe keys are arbitrary strings.
17:24devnhmm
17:25devnzakwilson: what about using a database or something instead?
17:25devnit sounds like you're getting into that kind of territory
17:26raekzakwilson: 30000-1000000 entries?
17:26devnredis maybe?
17:26zakwilsonCould database calls actually be faster than in-memory lookups?
17:26zakwilsonraek: yes, though it could easily go over a million.
17:28devnzakwilson: redis is pretty blazing -- depending on the type you get O(1) in quite a few places
17:28zakwilsonConstant time is good, but what's the overhead?
17:28devnthere are some config options to care less about consistency and go for speed
17:29devnzakwilson: memory is the trade off with redis
17:29zakwilson(relative to java.util.hashtable)
17:29devnzakwilson: i wish i had a solid answer for you there, but i truthfully do not know
17:30zakwilsonMemory is a concern too. I've run in to situations where my laptop is barely big enough for a dataset in memory as a Clojure map
17:32devnzakwilson: forgive me but I need to ask two things: 1, are you sure your reads are the problem
17:33zakwilsondevn: yes
17:33devnand 2, how do you know
17:33opqdonutyeah, with clojure it's reflection that's usually the bottle neck
17:33zakwilsondevn: because I'm doing tens of millions of them, and it slows down predictably when the dataset gets to a certain size.
17:34devn*nod* -- and that is fine but i think it's always important with performance concerns to have some sort of reliable data to point to that proves it
17:34devnive seen people have terrible performance because of some seemingly innocuous bit of code somewhere else in the program
17:34opqdonutzakwilson: ah but your code might still have a constant factor slowdown somewhere else
17:34devnopqdonut: exactly
17:34opqdonuteven though your asymptotics are expected
17:34zakwilsonI suppose it's been a while since I hooked the profiler up to it.
17:35devnzakwilson: im definitely not saying you're wrong
17:35opqdonuttry turning reflection warnings on, if you haven't yet
17:35devnbut it's always good to have some hard data to look at and be sure you're attacking the right problem
17:35devnand what opqdonut said, but i suspect you've got them on already :)
17:37devnopqdonut: one reason you might look at redis is that it has its own virtual memory
17:37devnso the size of the set can exceed memory
17:39devna couple of points on that: an OS's page is 4kB, the vsalue of a redis key may touch many pages even if the key is small enough to fit in a single page, and for these reasons, redis objects can be an order of magnitude larger in ram than they are when stored on disk, so if you're using the OS' virtual memory the OS needs to perform and order of magnitude more I/O versus a redis instance with VM
17:39zakwilsonYeah, I think it's time to get out the profiler before I try messing with Java data structures, but I'm pretty sure I want a 3-4x speedup if the option exists.
17:40devnnow the only issue is that you end up needing to store ALL of your keys in memory at all times -- you can swap values to disk, but not keys
17:40devnso that poses some memory issues, but the tradeoff is you get some pretty blazing lookups without the extra I/O
17:42zakwilsonI'm currently ok with everything in memory at once. Values are ints, so no problem there.
17:42zakwilsonWhen I start exceeding what my laptop can handle, or making a real product out of this, I'll need to care about real datastores.
17:42devneither way, redis is probably worth a look
17:42devnyou sacrifice some consistency for performance, but overall it's very fast
17:43devnthe CAP problem and all of that
17:43zakwilsonThanks for the pointer to redis. I'm not at all familiar with it, and had been leaning toward Mongo as a place to persist stuff (I'm currently just spitting maps to disk)
17:43devnmy suggestion is you dont want to use mongo for this
17:44devnredis is a k/v store, and that sounds like exactly what you have
17:44devnyou can use mongo for that, but performance-wise i think redis will be a better fit
17:44devnand i say this with absolutely no context about the actual problem you're trying to solve :)
17:45zakwilsonWell, what I really have is a small map where the values are {string int}, but that seems like it would be easy enough to model with a k/v store.
17:45devnwhen you do a lookup for a key are you just doing something like (:key {:key 1})?
17:46devnor is it fuzzier?
17:46devnand is it a plain map, not sorted right?
17:46zakwilsonCorrect
17:46devnyeah, redis would probably be a good fit
17:46zakwilson{"foo" {"bar" 4 "baz" 8}} (to oversimplify)
17:47devnone note on redis: if you decide to use it, take your time in configuration
17:47zakwilsonIt's those inner maps that are often huge, though I sometimes have tens of thousands of keys in the outer.
17:47devnsetup a simple harness for testing configuration changes and play with the config for a bit
17:47zakwilsonAlright, good to know.
17:47devnthere are a lot of options -- when we originally used redis we had the VM off and tried to do 1M records off the bat for fun and we were like: "this seems slow..."
17:48devnrevisiting the config changed all of that
17:49zakwilsonHave you compared redis reads to in-memory datastructure reads?
18:01devnzakwilson: there are benchmarks out there i think but no, not personally.
18:02zakwilsondevn: thanks for the pointer in the right direction. I probably won't be going for redis just yet, but when I need a real datastore, I'll look in to that.
18:13quotemstrThe Clojure object-reference syntax is pretty damned neat. Has anyone ported it to CLOS?
18:19dnolenquotemstr: object-reference syntax?
18:19quotemstrThe Java interop stuff.
18:20quotemstrIn principle, you could implement the same thing with a CLOS system supporting a MOP.
18:20quotemstrIt's both safer for slots than with-slots, and more convenient for methods.
18:20quotemstrGranted, you couldn't map all generic functions --- only those following a certain convention. But most do.
18:32devnhttp://blog.notdot.net/2010/07/Damn-Cool-Algorithms-Levenshtein-Automata
18:45DollaMandoes using :> in enlive selectors improve performance?
18:54amacanyone familiar with pallet/jcloud?
19:02ekoontzis there a clojure equivalent of Common LIsp's (progn)
19:03woobyekoontz: 'do'
19:03brehautekoontz: do
19:03ekoontzthanks guys :)
19:04woobyamac: a little, you should check out #pallet
19:04amacah, good call
19:09scottjquotemstr: if you like that java interop syntax you should look at arc's ssyntax
19:10Deranderis it possible to do something like (defn new-draw [the-fn] (defn draw-function [g] (apply the-fn g)) (.repaint pane)) where the-fn is (fn [g] (.drawLine g 100 100 10 15))?
19:10Deranderbasically I'm trying to swap out the drawing function of a proxy JPanel and redraw it
19:10Deranderfor lazy repl hacking
19:11brehautDerander: i believe proxys have a way to duck punch their methods on a per isntance basis
19:11brehautbut the easiest way would be to close over an atom or ref
19:12Deranderfair enough
19:13raekDerander: also note that the inner defn will create (or modifiy) a _global var_ and is not limited by the lexical scope (use let or letfn for that)
19:14Deranderyeah
19:14DeranderI was being lame and hacky. I'm calling draw-function inside of the paintComponent instance method on the proxy
19:14Deranderso I figured I'd just swap it out and redraw
19:14Deranderit works if I run (defn draw-function ...) in the repl, but then I also have to run (.repaint panel)
19:14DeranderI was trying to combine the steps
19:15raekDerander: https://gist.github.com/877894
19:15brehaut(doc update-proxy)
19:15clojurebot"([proxy mappings]); Takes a proxy instance and a map of strings (which must correspond to methods of the proxy superclass/superinterfaces) to fns (which must take arguments matching the corresponding method, plus an additional (explicit) first arg corresponding to this, and updates (via assoc) the proxy's fn map. nil can be passed instead of a fn, in which case the corresponding method will revert to the default behavior.
19:15raekI also wanted to have a proxy object that was easy to redefine, so it did it like that
19:16Deranderraek: I will read and attempt to comprehend this after I try out update-proxy
19:17raeka normal call to proxy will result in something very similar to the body of list-cell-renderer, but with an anonynous fn instead of #'prepare-renderer
19:18raekinstead of replacing which function the proxy should use every time I change something, I let it call the var instead (which will deref it at each invokation)
19:18raekupdate-proxy is a good option too
19:19brehaut&(let [p (proxy [Object] [] (toString [] "Hello"))] (prn (str p)) (update-proxy p {"toString" (constantly "foobar")}) (str p))
19:19sexpbotjava.lang.IllegalStateException: Var null/null is unbound.
19:20brehautthat was unexpected
19:20brehaut,(let [p (proxy [Object] [] (toString [] "Hello"))] (prn (str p)) (update-proxy p {"toString" (constantly "foobar")}) (str p))
19:20clojurebotjava.lang.RuntimeException: java.lang.IllegalStateException: Var null/null is unbound.
19:20brehautoh well. it runs fine in my repl
19:20Deranderokay, I think this is working adequately
19:21Deranderupdate-proxy does the trick
19:21Deranderthanks all
19:21raekit's pretty cool to be able to fix GUI code without even closing the window...
19:21Derandernoooo kidding
19:21brehauttotally :)
19:21DeranderI'm dicking around with polyganizations and triangulations of point clouds
19:21Deranderso being able to see changes quickly is nice
19:22DollaManhm.... vars work without deref?
19:22DollaMan,(#'first [1 2 3])
19:22clojurebot1
19:22raekyes, they call the thing they contain
19:22DollaManI thought I had to do ##(@#'first [1 2 3])
19:22sexpbot⟹ 1
19:23raek(yes, they work without deref *in a function position*)
19:23brehautDollaMan: they are derefable, but thats not all they are
19:24DollaManso how about my enlive question :)
19:24brehautDollaMan: i dont know if anyone has ever benchmarked it
19:25DollaManI am speaking from a theoretical perspecive
19:25DollaManif I use :> in a selector I am basically saying "search only 1 level deep for the next piece of selector"
19:25DollaManwhich constrains the search
19:25DollaManwhich should make it faster in theory
19:26brehautwell it is pruning a search space so from a 100 mile view; yes
19:26DollaManI'm just asking if enlive prunes the search or not
19:27brehautdollaman, how about you find out and report back: https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj
19:27brehauti think you want to look at compile-keyword (line 295)
19:28brehautand work out
19:28DollaMantoo hard for me to understand I'm afraid
19:29DollaMancgrand's code is short but hard to understand
19:29brehautwe are going to have to disagree on that point
19:29DollaManok :)
19:45TimMcI am totally using α, β, and γ as variable names.
19:45brehautTimMc: amazing
19:45TimMcIt is wonderful.
19:45brehautwithout doubt
19:45amacpretty
19:46Deranderis there something like apply that works with java methods? so (.drawOval g oval-coords) would work where oval coords is some vector containing integers [x, y, width, height]?
19:46DeranderI suppose I could write a clojure wrapper fn
19:47Deranderoh hey, I suppose I should try apply and see if it works on java methods
19:48Deranderoh darn, nope.
19:48raekDerander: the compiler will look up the signature of .drawOval at compile time. it is possible to do a "apply" using reflection, but if you know the signature at compiletime, that feels a bit bloated to me
19:49raekyou can do something like (apply #(.drawOval %1 %2) some-coll) though
19:49Deranderyeah
19:49Deranderthat's what I'll do
19:55brehautDerander: potentiall memfn could help too?
19:55Deranderbrehaut: reading
19:56Deranderbrehaut: yes, I think that works.
19:57raekisn't memfn from before the #() syntax was introduced? I think it results in exactly the same thing
19:57brehautraek: maybe?
19:57brehautraek: but there has always been #() as long as ive been following clojure
19:57raekhttp://clojure.org/java_interop#Java Interop-The Dot special form-(memfn method-name arg-names*)
19:58raekNote it almost always preferable to do this directly now, with syntax like: [example using #()]
19:58raek""
19:58brehautraek: cool thanks :)
19:59raekhrm, but with memfn you can name the arguments...
20:00Derander (apply #(.drawOval %1 %2 %3 %4 %5) g (point x y)) does not seem equivalent to (apply (memfn drawOval) g (point x y)), but my understanding of the documentation says it should be
20:00Derander(point x y is a vector with 4 values)
20:00Derander(point x y)*
20:01devnraek: crazy you just mentioned that
20:01devnraek: i was just reading about something similar
20:02devnhttp://objectcommando.com/blog/2010/05/17/easy-java-interop-with-clojure/
20:03Deranderoh
20:03DeranderI understand
20:06raek,(macroexpand-1 '(memfn split re limit))
20:06clojurebot(clojure.core/fn [target__3915__auto__ re limit] (. target__3915__auto__ (split re limit)))
20:06raek,(macroexpand-1 '(memfn drawOval))
20:06clojurebot(clojure.core/fn [target__3915__auto__] (. target__3915__auto__ (drawOval)))
20:07raekDerander: (memfn drawOval) expands to 0-ary function, so that's why you can't apply it with 5 args
20:07Deranderraek: right
20:07Deranderraek: that was my "I understand" moment :-)
20:07raekah. :)
20:07brehautDerander: sorry for leading you astray
20:07Deranderit's fine. I like the memfn syntax better regardless
20:08raekfor mor than 2 args, it definitely helps with readability
20:14devnraek: any existing libs come to mind that are the "gold standard" of wrapper library?
20:14devnas in, a wrapper around java code primarily
20:15brehautdevn: clojure.core? :P
20:15devnha! yes but it is not "regular" I don't believe. Or is it?
20:15devnI'm talking about directly taking a java library and simply writing a clojure "interface".
20:16devnThere are a lot of choices one has when wrapping a lib. The above example is good proof.
20:16devnReadability matters and I'm looking for a very readable and elegant version of a wrapper lib
20:17devnthat uses clojure.core's existing abstractions
20:18brehautenlive perhaps? its a wrapper around tagsoup i think? (ok, so wrapper sells it short, but nevertheless)
20:18devnyeah it's hard to find a wrapper that doesn't introduce additional functionality and muddy the water a bit
20:18brehautyeah
20:18devnnot really muddying so much as it is improving and enhancing
20:18devnstill, nice to see a really clean vision of what an elegant wrapper looks like
20:19brehautwhat about clj-time?
20:19devni was just about to say i bet jodatime was well wrapped
20:19devn:D
20:27raekdevn: well, I dunno what would make up a "gold standard"...
20:28Deranderis there a simple built-in to do something like this? [[1 1] [2 2] [3 3] [4 4]] -> [[1 1 2 2] [2 2 3 3] [3 3 4 4]]
20:29Deranderit is not popping out to me in the function list in the api reference
20:29brehaut&(partition-all 2 1 [[1 1] [2 2] [3 3] [4 4]])
20:29sexpbot⟹ (([1 1] [2 2]) ([2 2] [3 3]) ([3 3] [4 4]) ([4 4]))
20:29shachafDerander: I don't know about Clojure, but you can probably do something like Haskell > (\l -> zipWith (++) l (tail l)) [[1,1],[2,2],[3,3],[4,4]]
20:30Derandershachaf: I wish my haskell foo were stronger
20:30brehaut&(map concat (partition-all 2 1 [[1 1] [2 2] [3 3] [4 4]]))
20:30sexpbot⟹ (([1 1] [2 2]) ([2 2] [3 3]) ([3 3] [4 4]) ([4 4]))
20:30Deranderbrehaut: then map that
20:30Deranderbrehaut: I knew there would be something
20:30shachafDerander: Just zip the list with its tail and then concat the result.
20:30brehauthmm
20:30brehaut&(map flatten (partition-all 2 1 [[1 1] [2 2] [3 3] [4 4]]))
20:30sexpbot⟹ ((1 1 2 2) (2 2 3 3) (3 3 4 4) (4 4))
20:30Deranderbrehaut: that behavior is actually better -- I need to combine 4 4 at the end with another separate vector
20:31brehaut&(map flatten (partition 2 1 [[1 1] [2 2] [3 3] [4 4]])
20:31sexpbot⟹ ((1 1 2 2) (2 2 3 3) (3 3 4 4)) ; Adjusted to (map flatten (partition 2 1 [[1 1] [2 2] [3 3] [4 4]]))
20:31Derandershachaf: haha. I am reading learnyouahaskell right now
20:31Derandershachaf: it's on my list of languages to learn when not sleep deprived
20:32Deranderbrehaut: partition is such a useful function. perhaps this time it'll stick in my mind
20:33DollaManhow do I make a handler in Ring which returns an image (or other non-text data)
20:34DollaManhow do I host images in Ring
20:34brehautDollaMan: ring response maps are allowed to have a file as the body
20:34DollaManjava.io.File?
20:34clojurebotchouser: Some high-tech profiling with Activity monitor and println shows that I'm doing 100% of one core and not so much IO, though the number of files being read is huge(I estimate 5 per second).
20:35DollaManwhat about a stream?
20:35raekDollaMan: you can have an InputStream as a body too
20:35brehautDollaMan: yes; may i suggest examining the ring spec? closely followed by the available middleware https://github.com/mmcgrana/ring/blob/master/SPEC
20:36raekDollaMan: my IRC bot has a web server that serves png files piped from dot: http://raek.se/trattern/src/se/raek/trattern/graph.clj
20:36brehautDollaMan: https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/file.clj, https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/static.clj
20:37brehautraek: thats a very nice example
20:39raek(the result: http://services.raek.se/graphs/irc/quakenet/d1d)
20:39DollaManalready implemented what this middleware does :D
20:40brehautDollaMan: time to delete some code then! :D
20:40amacraek: neato.
20:45ataggart&(/ 1 3)
20:45sexpbot⟹ 1/3
20:45ataggart&(/ 1 3M)
20:45sexpbotjava.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
20:45ataggartanyone else think that should turn into a Ratio?
20:47amacprobably, that would likely create annoying-to-reproduce bugs
20:47amacimplementation might be tricky though
20:53amacraek: thanks for introducing me to clojure through that code example... very handy.
20:53amacerr loom in your clojure example
20:55DollaManthese ring wrappers can be confusing
20:55brehautDollaMan: how so?
20:55DollaManwrap-static for instance takes my handler as an argument
20:56DollaManbut when conditions are met
20:56DollaManit ignores my handler and serves a file
20:56brehautyes
20:56brehautits a middleware; it interposes some logic between your code and the web server
20:56brehauteither (or both) on the request or response
20:57DollaManah..... I see now
20:57DollaManI got confused because the guy was using app variable in code
20:57DollaManwhich I confused with the app macro of moustache
20:57brehautapp is moustache's handler swissarmy knife
20:57brehautoh right
20:57DollaManthe git coloring was misleading
20:57brehauti see what you are saying
20:57DollaManthe app in let binding wasn't colored
20:58DollaManbut in fn call it was
20:58DollaManmy bad
20:59Deranderhttps://gist.github.com/877961 <-- great success.
20:59Deranderhttp://cl.ly/0e3d1D1t340L2g1s241T is the output
21:00Null-ALet's say I want a configuration file, both reading in and outputting. Do I require it to read it?, and to output it, what do I do?
21:00Null-Asome way to serialize a hash-map is lisp reader syntax
21:00amac(doc slurp)
21:00clojurebot"([f & opts]); Reads the file named by f using the encoding enc into a string and returns it."
21:00amac,(doc slurp)
21:00clojurebot"([f & opts]); Reads the file named by f using the encoding enc into a string and returns it."
21:01amac,(doc spit)
21:01clojurebot"([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."
21:01Null-Aamac: there's some encoding?
21:02amacNull-A: what do you mean?
21:03amacoh, no
21:03amacyour config files are probably just straight text; pass them into slurp and it'll read them just fine
21:03Null-Aamac: ok, so i'll use print-str to produce the config files from clojure hash maps
21:03Null-AI want to use clojure style
21:05Null-Aer, prn-str is what I want
21:05Null-Afor output
21:05Null-Anow I just need the inverse
21:05amacyou can just dump the map in there &(spit "aoeu.txt" {:a 1})
21:06amacslurp/spit are for read/write respectively
21:07Null-Aamac: slurp returns a string of the file contents
21:07Null-Anow I want to turn it into a hashmap
21:09amacwell, not exactly safe but you could use read-string
21:09amac(doc read-string)
21:09clojurebot"([s]); Reads one object from the string s"
21:09amac(read-string "{:a 1}")
21:10amac,(read-string "{:a 1}")
21:10clojurebot{:a 1}
21:10amacthere it goes
21:11scottjanyone have a convention they really like for locals that share name of functions? name*, aname, name', name1?
21:11amacjust be careful that you're basically executing whatever is in your config
21:11Null-Aamac: ok
21:11Null-Aamac: thanks!
21:11amacscottj: I think * is what is most common, at least to replace core fns.
21:12amacNull-A: np. :)
21:13Null-Aamac: Yah I just found example code that did the same thing "(with-in-str ... (read))
21:13Null-Athere was a comment "Security risk?"
21:14amacyeah, someone could easily write some nastyness into your config file
21:14amacyour other option is to write a parser, but that's more time consuming
21:15brehautif you only read the config file, but not eval it, there shouldnt be any risk
21:15Null-AThere's so many security holes on unix systems I think if people have access to your file system
21:15Null-Ajust change dot emacs or something
21:15Null-Abrehaut: does read-string do eval?
21:16brehautno
21:16brehaut,(read-string "#(inc %)")
21:16clojurebot(fn* [p1__5464#] (inc p1__5464#))
21:16amacbrehaut: well, at some point he'll be doing something with that object and it will get evaluated
21:16Null-A,(read-string {:a (+ 1 1)})
21:16clojurebotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.String
21:16Null-A,(read-string "{:a (+ 1 1)}")
21:16clojurebot{:a (+ 1 1)}
21:17brehautamac: i might have missed something, but i didnt see any mention of that
21:17Null-A,(:a (read-string "{:a (+ 1 1)}"))
21:17clojurebot(+ 1 1)
21:17Null-A,(eval (:a (read-string "{:a (+ 1 1)}")))
21:17clojurebotDENIED
21:17Null-Athat's pretty cool
21:17brehautyeah
21:17amacbrehaut: I'm assuming
21:18brehautamac: if its just a config, then it just needs to be data, so you never need to call eval
21:18brehautits no different to using json frinstance
21:24amacbrehaut: yeah that's true I suppose.
22:02devnanyone here read programming clojure, practical clojure, clojure in action, and joy of clojure?
22:02devni know that's a tall order, but they're all fairly short
22:02devnas far as programming books go
22:03devnim curious and interested to compare notes
22:27brehautseems to me that an library that compiled template snippets to both enlive (using enlive syntax) and javascript using jquery and scriptjure would be pretty awesome
22:31mecThere doesnt happen to be a way to define java in clojure is there?
22:32brehautmec what do you mean by that? construct java asts and render them to .java source?
22:36mecI havnt really thought about how it would be done, but maybe define a java method inline
22:36brehautmec: step back a moment. what purpose do you want this for?
22:39mectrying to write some faster math stuff, although im probably doing the hints all wrong
22:40brehautwhich version of clojure are you using?
22:40mec1.2 cant get 1.3 to work right with clojurebox
22:41brehautok. your a bit out of luck there. typically if you want to call out to some java code for your project, you write the java in a seperate java source tree and let your project tool manage it
22:41meci thought so
22:42brehautit would be pretty horrible to have java just smushed into a clojure block :P
22:43meci don't think its too abnormal, a lot of languages let you inline the lower level language
22:44brehautclojure isnt a lot of languages :P
23:02scottjmec: if you can get 1.3 working then you should be able to get a lot closer to java like performance in regular clojure
23:03mecI'm trying to find something on that now
23:04brehautmec: what does clojurebox provide you? is it a clojure install + emacs configuration?
23:04mecya for windows
23:04scottjit's really nice
23:05brehautdoes it run ontop of a project tool like lein?
23:06scottjI don't think so, it predates lein
23:06mecit works with lein swank, but i havnt played with any build tools yet, too painful
23:06scottjhow does it not work with 1.3?
23:07scottjif you start a lein project, use clojure 1.3, then lein swank can you connect to it from clojurebox?
23:07brehautmec lein is your build tool
23:11mecdoes contrib not have an alpha6 release?
23:13brehautcontrib is getting a big shakedown for 1.3
23:27meci just dont have a clue how to get clojurebox to run a different version
23:29scottjyou would run lein swank and then M-x slime-connect
23:30scottjI'm guessing now you're running M-x slime, don't do that to connect to a 1.3 running lein swank
23:31mecright now i either just start clojurebox or click on a .clj file, i dont use lein
23:33scottjwell you should learn it :) hopefully it works better on windows now
23:33scottjor you can look in the clojure box configs (.el files probabl) and find where it points to the clojure jar and point it to the 1.3 one
23:40mecthat just gives all sorts of errors
23:41meci believe when i tried lein with 1.3 it wouldnt give me a slime repl at all, just inferior
23:44mecdo i just do [org.clojure/clojure "1.3.0"] ?
23:51rdeshpandehey guys, as a new clojure programmer is it advised to learn on clojure 1.3 instead of 1.2? if so, what resources are recommended for 1.3 learning?
23:52brehautstart with 1.2
23:52brehaut1.3 is very much an alpha ATM
23:52mec...
23:53meclein swank is just giving me the same errors clojurebox did :x
23:53brehautmec: i think it needs -ALPHA6
23:53mecbrehaut: ya fixed that one
23:54pdk1.3 is hardly ready for production use
23:54rdeshpandeinteresting that labrepl has you install 1.3
23:55brehautrdeshpande: more experienced clojure users have good reasons to be wanting to work with 1.3, but if you are starting out 1.2 is the stable release, has the majority of tooling and library support etc
23:59brehautrdeshpande: oh. misread your statement. yeah that is interesting