2010-02-03
| 00:04 | konr | Has anybody used Jambi? Do you know why (for [x (range 3) y (range 3)] (doto grid (.addWidget (lcd-range) x y))) doesn't do anything but (doto grid (.addWidget (lcd-range) 0 1)) works as expected? |
| 00:04 | konr | |
| 00:05 | hiredman | for is lazy |
| 00:06 | konr | oh yeah! Nothing a dorun doesn't solve. Thanks! |
| 00:07 | arohner | konr: or you can just use doseq |
| 00:07 | arohner | it's like for, but not lazy and returns nil |
| 00:09 | konr | arohner: seems more appropriate. Thanks! |
| 00:17 | qbg | Is there some way to blocking wait (preferably with timeout) on an atom/ref until it contains a certain value? |
| 00:17 | hiredman | promise/deliver |
| 00:19 | qbg | But with promise/deliver can't reset it; only create a new one. |
| 00:19 | hiredman | you can put a promise in a ref or an atom |
| 00:19 | hiredman | oh hell |
| 00:19 | hiredman | just use a blockingqueue |
| 00:45 | qbg | Specifying :reload-all to require should cause all directly and indirectly required libs to be recompiled, correct? |
| 00:47 | qbg | Because sometimes old definitions don't get replaced for me |
| 00:47 | qbg | compile-buffer in SLIME also doesn't replace them for me sometimes. |
| 01:25 | LauJensen | Morning |
| 02:55 | replaca | LauJensen: Morning |
| 03:19 | qed | hi all |
| 04:33 | spariev | LauJensen: your writeup on Compojure is really nice |
| 04:34 | LauJensen | Thanks :) |
| 04:38 | zaphyr | ooh, could I have a link to that? sounds good |
| 04:39 | spariev | zaphyr: http://www.bestinclass.dk/index.php/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure/ |
| 04:39 | zaphyr | thanks! |
| 04:39 | zaphyr | hehe, title of awesomeness :) |
| 04:58 | LauJensen | http://landshape.org/enm/20th-century-warming-not/ |
| 04:59 | LauJensen | I must say I'm glad my webserver is running Linux, otherwise the amount of activity I get these days would probably have cratered it :) |
| 05:00 | Chousuke | are they taking that graph seriously? :P |
| 05:02 | LauJensen | Of course |
| 05:14 | ambient | proper statistics is sometimes more mysterious than black magic :) |
| 05:18 | esj | (inc ambient) |
| 05:19 | ambient | you mean (swap! ambient inc)? :) |
| 05:21 | ambient | it really feels weird being a variable in an immutable language |
| 05:22 | ambient | do i die when i change? |
| 05:22 | ambient | i guess the atom protects me |
| 05:33 | LauJensen | ambient: I'm not saying that there isn't a myriad of stats that you can run in various ways, I'm just saying that the temperature isn't rising in the NOAA sets :) |
| 05:33 | LauJensen | Its weird why so many people believe that cutting up trees and digging ice holes can change that fact |
| 05:36 | ambient | carbon dioxide working as a greenhouse gas seems to be the idea, afaik |
| 05:38 | esj | ambient: oops, yes. |
| 05:49 | AWizzArd | Hallo ulfster |
| 06:00 | vu3rdd | LauJensen: I got really fascinated with your post that I downloaded all the NOAA data and have just started to play with it. |
| 06:00 | LauJensen | Great - Hows it coming along ? |
| 06:05 | vu3rdd | LauJensen: I am midway thru your post. As I told you over email, I got stuck with Java libraries, being a java n00b |
| 06:07 | vu3rdd | but slime makes it quite easy to explore the java libraries. The C-c I (inspect) and M-. |
| 06:12 | LauJensen | vu3rdd: Then I misunderstood your mail, I actually thought you had worked it out |
| 06:13 | LauJensen | But the code should run right out of the box, why do you need to fiddle with Java ? |
| 06:31 | vu3rdd | LauJensen: yes, code should work. But I was more interested in knowing the java interop and the logic used than the actual result of the code itself. |
| 06:33 | LauJensen | ah ok |
| 07:34 | vu3rdd | ,quit |
| 07:34 | clojurebot | java.lang.Exception: Unable to resolve symbol: quit in this context |
| 07:34 | vu3rdd | :-) |
| 07:34 | vu3rdd | too much use of slime |
| 07:36 | LauJensen | hehe |
| 08:23 | avarus | hi! |
| 08:26 | LauJensen | Hey |
| 08:29 | avarus | how are you guys (and girls)? |
| 08:38 | avarus | well, you seem fine :P |
| 09:03 | cemerick | rhickey: I infer from this that clojure is fully osgi-capable: http://lambdalounge.org/2010/01/28/polyglot-osgi-in-february/ |
| 09:15 | rhickey | cemerick: I'm still waiting for a definition of what OSGi-capable means |
| 09:15 | cemerick | rhickey: in some ancient history, clojure would simply fall down |
| 09:17 | rhickey | cemerick: I don't really see how that would be the case. It is more a matter of, afaict, people having expectations of providing the core language as a service (or whatever they call it), mostly driven by expectations formed by how interpreters work |
| 09:18 | rhickey | Or, Clojure-loaded code being able to play with OSGi's classloader mechanism, but no one should have any expectation of some standard Java-based code that did dynamic loading doing that, as there is no standard for exposing classes across dynamic loaders |
| 09:19 | rhickey | originally, all OSGi=like things expected al code to use Class.forName |
| 09:19 | rhickey | all |
| 09:20 | rhickey | however, even if it now 'runs' under OSGi, it doesn't mean it can provide the facilities people want |
| 09:20 | cemerick | Sure. There was a time when one could not get a repl going at all, for example...at the very least, it appears such issues no longer exist. |
| 09:20 | cemerick | I'm guessing the move to use the context classloader by default helped there. |
| 09:20 | rhickey | I never got a much better report than "it doesn't work" |
| 09:21 | rhickey | I do know a few things that will make it more modular, in particular: |
| 09:21 | rhickey | getting rid of symbol maps to class object in namespaces... |
| 09:21 | rhickey | getting rid of global namespace map |
| 09:22 | rhickey | special op all class-naming primitives, like instance? and resolve |
| 09:22 | rhickey | moving away from reflection for type info |
| 09:23 | rhickey | beyond that, I'd be willing to support an OSGi-specific recipe for dynamic loading |
| 09:23 | rhickey | when used in that context |
| 09:23 | cemerick | well, jdk7 may end up providing various clever mechanisms that would make such things less necessary (if there's any demand for them at all anyway) |
| 09:24 | cemerick | I get the impression that there's a lot of noise about osgi, but very few people actually using it outside of e.g. eclipse |
| 09:24 | rhickey | the dynamic case is still on the fringe - these things are oriented towards static relationships between modules |
| 09:26 | chouser | has the first one happened yet? |
| 09:26 | rhickey | but the bottom line is, Clojure's runtime was doing a lot of loading/resolution work for loaded code. Proxying that is incompatible with modularity systems that want to control which classes can see what |
| 09:26 | rhickey | chouser: March |
| 09:27 | rhickey | :) |
| 09:27 | chouser | oh. the month. ok, thanks. |
| 09:27 | cemerick | I figured the presence of jsr 292 features would motivate consideration by the modules folks. |
| 09:29 | rhickey | cemerick: It simply comes down to: no proxying of class resolution - the language must emit direct references in the compiled code, can't go through a central registry |
| 09:29 | rhickey | things are already better (import) |
| 09:30 | rhickey | other things need work (Namespace.namespaces) |
| 09:42 | fdaoud | good morning |
| 09:42 | stuartsierra | I can't upgrade someone from Watcher to Member on Assembla myself, can I? |
| 09:43 | chouser | stuartsierra: afaik only rhickey can do that. |
| 09:43 | rhickey | stuartsierra: who needs an update? |
| 09:43 | jcromartie | I was kind of surprised to realize that docstrings are supposed to come before the arg vector |
| 09:43 | jcromartie | (in defn) |
| 09:44 | jcromartie | I always put them after the args, and nothing ever complained |
| 09:44 | chouser | jcromartie: it makes sense when you consider multi-body fns |
| 09:44 | jcromartie | yeah |
| 09:44 | stuartsierra | rhickey: trolard |
| 09:44 | fdaoud | jcromartie: +1 |
| 09:45 | rhickey | stuartsierra: done |
| 09:49 | stuartsierra | rhickey: thx |
| 09:57 | avarus | hrm...sometimes I get "Exception in thread "main" java.lang.Exception: EOF while reading" and that's it...the last time I simply missed a ) |
| 09:57 | avarus | this time, too :> |
| 09:57 | jcromartie | chouser: just made an improvement to that |
| 09:57 | chouser | I have a patch to give a bit more info |
| 09:58 | jcromartie | (oops, didn't want the ":") |
| 09:58 | avarus | oh, makes sense now :) |
| 09:58 | avarus | cool, where? :) |
| 09:58 | chouser | avarus: if you're building your own clojure, you can try this patch: http://www.assembla.com/spaces/clojure/tickets/249 |
| 09:59 | avarus | but sometimes it tells me that there is no matching blabla |
| 09:59 | avarus | ah nice, I'll try it |
| 09:59 | avarus | thx |
| 09:59 | chouser | avarus: that's usually when you have an extra close. EOF is on an extra open |
| 10:00 | avarus | ok |
| 10:00 | jcromartie | minor nitpick: the api docs have an extremely tiny font |
| 10:00 | avarus | can you zoom with the ctrl+ + or mousewheel? |
| 10:00 | jcromartie | yeah I can |
| 10:00 | jcromartie | but that leads to more funkiness |
| 10:01 | avarus | hehe |
| 10:02 | jcromartie | I think the fixed-width fonts would be much more readable at even 10pt |
| 10:04 | avarus | perhaps a user stylesheet can help you for now |
| 10:04 | avarus | otherwise contact the webmaster and tell him if he had planned to ruin your eyes :P |
| 10:04 | avarus | ask him actually |
| 10:05 | jcromartie | avarus: the webmasters are here I believe :) |
| 10:05 | jcromartie | (not 100% sure on that thoug) |
| 10:05 | avarus | I have no idea |
| 10:07 | jcromartie | yay user styles |
| 10:07 | jcromartie | 10pt Monaco :) |
| 10:08 | avarus | cool |
| 10:08 | jcromartie | of course now it messes some sites up unless I make super-specific selectors :P |
| 10:08 | avarus | ah lol :) |
| 10:09 | jcromartie | div#content_view.wiki.wikiPage pre { font-size: 10pt; font-family: "Monaco" } |
| 10:12 | avarus | I'm just wondering...all clojure code I've seen so far is written like this: http://pastie.org/807601 but can't one write it like this: http://pastie.org/807603 ? |
| 10:14 | avarus | the ebook though because I wasn's sure about international shipment of the book |
| 10:14 | avarus | wasn't |
| 10:14 | avarus | and because it was cheaper :) |
| 10:14 | fr0og | dead-tree+ebook |
| 10:14 | avarus | hehe |
| 10:14 | Raynes | avarus: I'm buying the ebook as well. I never buy dead-tree non-fiction books. |
| 10:15 | avarus | I did in the past but handling a thick book beside the screen and keyboard sucked |
| 10:15 | _fogus_ | Raynes: You'll me disappointed to know that at least 75% of our book *is* fiction. :-p |
| 10:15 | Raynes | _fogus_: :p |
| 10:16 | avarus | so I bought a bigger screen so I can have the ebook and the editor open side by side :P |
| 10:16 | fr0og | _fogus_: I only browsed the book so far, so no comments on the content, but is there any reason why it is written in bold-face throughout? |
| 10:17 | chouser | avarus: one could write it that way, but one doesn't. |
| 10:17 | avarus | that's not bold for me |
| 10:17 | _fogus_ | fr0og: Odd. It shouldn't be. |
| 10:18 | avarus | chouser: got it...I just found it a bit confusing sometimes |
| 10:18 | fr0og | oh? is it just a very thick font, or is it evince |
| 10:18 | chouser | avarus: you find having all the closing parens on one line to be confusing? |
| 10:18 | avarus | I'm on evince, too |
| 10:18 | avarus | chouser: yes |
| 10:19 | avarus | perhaps because my editor doesn't support clojure |
| 10:19 | avarus | though gedit highlights the parens |
| 10:19 | zaphyr | avarus: sounds like you want a less losing text editor :) |
| 10:19 | Raynes | They should be stricken down from the heavens. |
| 10:19 | fr0og | it does look better in acroread actually, my apologies |
| 10:20 | avarus | yes, it's confusing how gedit highlights the parens |
| 10:20 | Raynes | Holy... For the last 30 minutes, I was under the impression that this was the year 2012. |
| 10:20 | chouser | avarus: I think you'll get used to it. One reason for doing it this way is that it's much more common in lisps than in c-like languages to having nothing much of interest after a close paren. |
| 10:20 | Raynes | I need to sleep more often. |
| 10:20 | zaphyr | there used to be a convention where you'd separate parens that were closed on a different line with a space, but i think that fell out of disuse and you'd get funny looks |
| 10:20 | avarus | chouser: ok, my brain still thinks c-ish I guess |
| 10:21 | zaphyr | but that was, hm. common lisp, circa 1980something :) |
| 10:21 | _fogus_ | avarus: If your editor supports Lisp then that should get you much of Clojure support |
| 10:21 | avarus | _fogus_: gedit doesn't even support lisp by default :D |
| 10:21 | chouser | but in practice, we all read code often outside our main editor |
| 10:22 | avarus | I'm in c mode now so at least strings get highlighted |
| 10:22 | zaphyr | :S |
| 10:22 | Raynes | That's horrible. |
| 10:22 | Raynes | Why do you subject yourself to such evil editors? |
| 10:22 | Raynes | :| |
| 10:22 | zaphyr | you'll find an editor with good lisp indenting will aide your understanding much quicker |
| 10:22 | cow-orker | finally got around to buy "the joy..." (paper+pdf) ... looking forward to the rest of the book :-) |
| 10:23 | avarus | Raynes: because the "external tools" plugin is useful :) |
| 10:23 | jcromartie | connections in clojure.contrib.sql are kind of awkward |
| 10:23 | jcromartie | although maybe it's MySQL's docs that are weird |
| 10:23 | Raynes | avarus: If GEdit can do it, Emacs can do it better. |
| 10:23 | Raynes | :p |
| 10:25 | avarus | Raynes: I'm sure of that |
| 10:25 | avarus | though I never used emacs |
| 10:26 | jcromartie | is get-connection deprecated? |
| 10:27 | avarus | see you later |
| 10:27 | avarus | bye |
| 10:31 | jcromartie | what's with all the fruit junk in the sql docs? |
| 10:50 | zaphyr | hmz. the only thing that i don't really like about "Programming in Clojure" is we seem to keep using multimethods waaay before the chapter on multimethods :( |
| 10:54 | LauJensen | Thats just to warm you up a little |
| 10:55 | zaphyr | yeah, it's not a major issue (especially since I come from CL), but I'd have liked a little quick box introducing them earlier |
| 10:56 | zaphyr | other than that minor quibble on presentation order, the content's good |
| 10:58 | jcromartie | how can I return SQL results to something outside of with-connection? |
| 10:59 | jcromartie | I've tried things like (vector results) |
| 11:00 | jcromartie | but does that not un-lazify the lazy seq returned by with-query-results? |
| 11:00 | ohpauleez | jcromartie: use a closure or a ref |
| 11:00 | ohpauleez | jcromartie: yes, that'll unlazy the results |
| 11:00 | jcromartie | it doesn't seem to work though |
| 11:00 | stuartsierra | jcromartie: you can also call 'doall' inside with-connection |
| 11:01 | ohpauleez | ahh good idea |
| 11:01 | jcromartie | (with-connection db (with-query-results results ["select * from venues"] (vector results))) |
| 11:01 | jcromartie | throws java.sql.SQLException: Operation not allowed after ResultSet closed |
| 11:01 | jcromartie | seems very strange to me... |
| 11:02 | jcromartie | or should I design this differently |
| 11:02 | jcromartie | this is a compojure app |
| 11:02 | stuartsierra | jcromartie: (vector a-sequence) creates [a-sequence] |
| 11:02 | stuartsierra | You probably want 'vec' |
| 11:02 | jcromartie | ah, yes |
| 11:02 | jcromartie | lovely! |
| 11:03 | stuartsierra | 'doall' will also un-lazy the sequence, without the need to create an intermediate vector |
| 11:06 | jcromartie | hmm |
| 11:06 | jcromartie | just (doall some-seq) |
| 11:07 | LauJensen | jcromartie: (let-query [users (query usertable [username email] (not= "frank" username)] (doseq [user users] (println user)))) |
| 11:08 | jcromartie | let-query? |
| 11:08 | jcromartie | oh that's your fancy layer :) |
| 11:08 | LauJensen | Thats just the ClojureQL frontend |
| 11:09 | LauJensen | or you could just to a normal run on whatever query you got (run [db query results] (doseq [r results] (println r))) |
| 11:12 | LauJensen | With the new front-end, it'll be more like |
| 11:12 | LauJensen | (->> (only (either (= :user %) (= :email "some@email.com")) |
| 11:12 | LauJensen | (from :table1 [:user :email]) |
| 11:12 | LauJensen | (run :mysql)) |
| 11:12 | LauJensen | But the design isn't quite final, however I feel quite convinced that whatever we agree on, you will love |
| 11:22 | jcromartie | looks nice LauJensen |
| 11:28 | zaphyr | hm, are there any plans to replace clojure.lang.Compiler with a clojure implementation? |
| 11:29 | stuartsierra | yes |
| 11:29 | zaphyr | goodie :) |
| 11:29 | chouser | zaphyr: http://www.assembla.com/wiki/show/clojure/Clojure_Compiler_in_Clojure |
| 11:29 | zaphyr | excellent, thanks |
| 11:33 | zaphyr | are there any notes to help trying to understand the current compiler? |
| 11:33 | zaphyr | I guess it's some kind of ANF based thing rather than CPS, given the lack of tco |
| 11:37 | chouser | a clojure fn that takes 2 args compiles to a java class with an invoke method that takes 2 args. so no automatic CPS |
| 11:37 | _fogus_ | There was a trick here (by cgrand?) a few days ago that had nested arrow macros: (-> blah blah ->> blah blah) -- something like that ... I can't find it |
| 11:39 | zaphyr | chouser: hmm, yeah, it seems surprisingly simple |
| 11:39 | stuartsierra | _fogus_: it was on the dev list |
| 11:39 | chouser | _fogus_: http://github.com/cgrand/clojure/commit/9f2e7ed8c678d5619ff7e8baad74a847b07a7973 |
| 11:40 | chouser | though I think he has imporoved versions committed since then |
| 11:41 | _fogus_ | stuartsierra: Great, thanks |
| 11:41 | chouser | zaphyr: keeping interop with java simple is definitely an explicit goal. |
| 11:41 | _fogus_ | chouser: And to you too sir |
| 11:42 | zaphyr | chouser, right, and worthwhile. might be nice to have some "I know what I'm doing" hints to get compiler plugins to do things like block compilation, or compile fns to statics when you know they won't change, with obvious caveats that you must know what this implies if you use it |
| 11:43 | chouser | zaphyr: static methods instead of instance methods, or ...? |
| 11:43 | zaphyr | static methods for a fn, instead of a class per fn |
| 11:45 | zaphyr | i.e. you lose everything- it's no longer first class, etc. but if it's say, part of some horrible matrix library, that's less of an issue |
| 11:47 | chouser | zaphyr: I don't know if that would buy you much. hotspot is really good with single-dispatch final instance methods. |
| 11:51 | zaphyr | true. I'm getting worst case 1/2 the speed of java so far, which isn't too bad since i'm completely new to clojure anyway |
| 11:52 | zaphyr | and in simple cases it matches, which is great |
| 11:53 | chouser | the two biggest sources of clojure code being slower than similar java are: runtime reflection due to insufficient type hints, and auto-boxing of numbers instead of using primitives |
| 11:53 | zaphyr | yeah, boxing is the big killer for me |
| 11:53 | chouser | the former is completely solvable, usually with just a few well-placed hints |
| 11:54 | chouser | the boxing is still more of an issue. you can have primitive locals, so your small tight loops can be good. |
| 11:54 | zaphyr | although i'm not sure of the deref cost when you're extracting a fn from a var, that must have some overhead, surely? |
| 11:55 | zaphyr | chouser: right, and i noticed looking at core.clj there is some :inline trickery going on, which surely must help if it does what i think it does |
| 11:55 | chouser | yes, a little, though the compiler now supports direct linking (is that the right phrase?) of vars, though that's not exposed for user code quite yet. |
| 11:55 | redalastor | Is there some css library that exists for clojure. Kinda like clj-html but for css? |
| 11:55 | chouser | yeah, the :inline is to help work around the fact that clojure fns only take and return Objects right now, so no primitive args or return values. |
| 11:56 | zaphyr | can i rely on it myself? i looked at definline but that looks more like cl's compiler-macro thing than an 'inline' |
| 11:56 | stuartsierra | you can use definline |
| 11:56 | zaphyr | see above :) |
| 11:56 | stuartsierra | It works more like a macro than a function though |
| 11:56 | chouser | and no persistent collections that can hold primitives yet. for now you have to use (mutable) java arrays for best performance |
| 11:57 | zaphyr | really i just want to say "beta reduce this into the code as is, because i told you" |
| 11:57 | zaphyr | without having to break the clarity of a function def |
| 11:57 | stuartsierra | definline is the closest you can get to that right now |
| 11:58 | chouser | the only benefit of definline over a macro is that you can still use what you define in a high-order function, unlike a macro. |
| 11:58 | zaphyr | yeah |
| 11:59 | chouser | persistent collections of primitives and clojure fns that accept primitive args are planned ... eventually. they complicate things enormously though. |
| 11:59 | zaphyr | 99% of the time though, clojure is fine. the only reason i'm griping is because i turned up with the specific intention of hurting it. it's stood up quite well really |
| 11:59 | zaphyr | chouser: right, that definately calls for a sufficiently smart compiler |
| 12:00 | zaphyr | definitely* |
| 12:01 | jcromartie | how do I coerce a struct into a hash-map? |
| 12:01 | chouser | which will be much more fun to develop when it's implemented in clojure instead of java. |
| 12:01 | chouser | jcromartie: (into {} thing) |
| 12:01 | zaphyr | chouser: heh, s/more fun/actually possible/ :) |
| 12:05 | jcromartie | OK this is weird, this function returns nil, while (doseq [x r] (println x)) prints them: http://gist.github.com/293778 |
| 12:05 | jcromartie | (if I put the doseq in the with-query-results) |
| 12:05 | chouser | dorun always returns nil |
| 12:06 | jcromartie | ah |
| 12:06 | jcromartie | doall |
| 12:06 | chouser | yes. :-/ |
| 12:06 | chouser | I get doall and dorun confused, and confuse the names occasionally with doseq |
| 12:06 | jcromartie | dosequis |
| 12:06 | chouser | I kinda with doseq was called dofor or do-for |
| 12:06 | chouser | wish |
| 12:07 | jcromartie | ui-related doseq |
| 12:08 | jcromartie | it will happen, just wait |
| 12:08 | chouser | ? |
| 12:08 | jcromartie | (dosequis) |
| 12:09 | zaphyr | what would that do? |
| 12:09 | stuartsierra | Open a beer. |
| 12:09 | zaphyr | man, implement it :) |
| 12:10 | zaphyr | there's no macrolet equivalent in clojure is there? |
| 12:11 | chouser | not yet, though I think there's something in contrib. |
| 12:11 | zaphyr | fair enough |
| 12:12 | chouser | clojure.contrib.macro-utils macrolet and symbol-macrolet. I've not used them. |
| 12:12 | zaphyr | thanks, i'll have a play with them in a bit |
| 12:13 | Mec | Is there a way to abort a repl in netbeans? |
| 12:13 | zaphyr | Mec: in enclojure I can't figure out how to close the IDE repl, but you can start and stop project repls from the project tree |
| 12:13 | chouser | Mec: not sure. have you tried http://blog.n01se.net/?p=85 |
| 12:15 | Mec | weird, my *print-length* is 40 but it deffinity went infinit |
| 12:16 | zaphyr | hands up who wants *print-circle*? :) |
| 12:16 | zaphyr | although i think it would be much harder to implement in clojure |
| 12:18 | Mec | ok rather than stopping at 40, it just keeps printing ... after that |
| 12:18 | chouser | :-( Does the CTRL-C thing work? |
| 12:19 | chouser | it may not in a GUI like that. |
| 12:19 | Mec | No it doesnt |
| 12:20 | chouser | zaphyr: is that anything like this? http://paste.lisp.org/display/83647 |
| 12:23 | zaphyr | chouser: yes, it's exactly like that! :) |
| 12:25 | zaphyr | Mec: I think if you hung the IDE repl you may have killed it :( |
| 12:27 | jcromartie | hmm |
| 12:27 | jcromartie | clojure.contrib.sql doesn't escape column names |
| 12:27 | jcromartie | that's bad |
| 12:28 | jcromartie | I'd like to use columns like "first-name" |
| 12:28 | Mec | ah well i'll just try not to hang my repl :x |
| 12:28 | jcromartie | but maybe I should stick with underscores |
| 12:28 | rsynnott | jcromartie: in my experience it's relatively unusual for ORMs and similar to escape column names |
| 12:29 | jcromartie | it's just a shame because the convention in Clojure is hyphenated names |
| 12:29 | jcromartie | and MySQL supports that |
| 12:29 | jcromartie | but I am not sure about other databases |
| 12:45 | zaphyr | Mec: if you right click on your project and 'start project repl' you may have more luck, although enclojure is a bit flakey |
| 12:46 | zaphyr | certainly i just broke out of (cycle [1]) successfully |
| 13:15 | LauJensen | Just passed 11k visitors today and still 5 hours remaining - The interest in Clojure is sky rocketing |
| 13:21 | cemerick | stuartsierra: HLS' issue (#23) is that if one has an ns A that requires ns B, but only ns A is specified for compilation (e.g. to clojure.lang.Compile), he wants A to get AOT-compiled but not B. |
| 13:21 | stuartsierra | oh |
| 13:21 | stuartsierra | that's a Clojure issue then, not contrib |
| 13:21 | cemerick | yeah |
| 13:22 | cemerick | though I don't think it's an issue at all |
| 13:22 | stuartsierra | and I'm not sure it's even possible |
| 13:23 | technomancy | LauJensen: awesome |
| 13:25 | cemerick | stuartsierra: wouldn't it just require *compile-files* to be rebound to false in load if the next ns isn't in the set of ns' specified for compilation (which would have to be in a new var)? |
| 13:26 | cemerick | I guess load doesn't know what ns it's aiming for. *shrug* |
| 13:26 | stuartsierra | maybe |
| 13:26 | stuartsierra | but those libraries are going to get loaded when the AOT-compiled namespace is initialized anyway |
| 13:27 | cemerick | yeah, I think HLS just doesn't want to have clojure/contrib/def*.class in his jar file |
| 13:27 | cemerick | or whatever |
| 13:27 | stuartsierra | he'll have to deal |
| 13:27 | stuartsierra | :) |
| 13:28 | cemerick | heh |
| 13:28 | cemerick | I'm a little sad about the general push towards minimal AOT compilation anyway. |
| 13:29 | hiredman | por que? |
| 13:29 | stuartsierra | I wish it were avoidable |
| 13:29 | stuartsierra | It might be good to AOT releases, but not SNAPSHOTs |
| 13:30 | cemerick | hiredman: because HLS has a point insofar as (a) if one is concerned about distributable size, you've got to prune out the duplicated stuff, and (b) not AOT'ing things "in place" and pushing that responsibility up to every single dev that needs to ship classfiles rather than source isn't nice, IMO. |
| 13:31 | cemerick | source-only distribution is more lightweight and apparently hip, but is nothing but a hassle for a lot of use cases. |
| 13:32 | cemerick | stuartsierra: I think it's an unavoidable fact of life that people build production stuff on snapshots, every day. *shrug* |
| 13:32 | hiredman | hmmm |
| 13:33 | chouser | who needs to ship classfiles? |
| 13:33 | chouser | why? |
| 13:33 | clojurebot | http://clojure.org/rationale |
| 13:33 | stuartsierra | The bigger problem with AOT-compilation is that it breaks compatibility between different version of Clojure |
| 13:33 | stuartsierra | This is especially problematic for snapshots, because one change to the compiler can break any AOT-compiled namespace. |
| 13:34 | cemerick | chouser: because some customers flip out otherwise. |
| 13:35 | cemerick | Nevermind that startup time is a serious consideration in many contexts. |
| 13:35 | _fogus_ | cemerick: (inc customers) |
| 13:35 | _fogus_ | That's been my experience |
| 13:36 | chouser | oh, if you're providing a lib to non-clojure developers? |
| 13:36 | cemerick | yup -- financial services, some gov't, etc etc |
| 13:36 | cemerick | heh, yeah |
| 13:36 | zaphyr | chouser: right, say (horror) you want to ship an EJB component |
| 13:36 | cemerick | chouser: you've been in open-source land too long, my friend :-) |
| 13:37 | _fogus_ | Customers tend care less than my bosses though |
| 13:37 | chouser | nah, it's just been a decade or so since I was producing (non-free) code to developers instead of some kind of end user. |
| 13:37 | chouser | end users don't care |
| 13:38 | cemerick | stuartsierra: I wonder if those issues aren't resolvable. I don't have any immediate solutions, of course. ;-) |
| 13:38 | cemerick | chouser: I guess I should have ;-) |
| 13:38 | cemerick | chouser: depends on who your end users are |
| 13:38 | stuartsierra | cemerick: they might be, but it would require changes to the compiler |
| 13:38 | cemerick | yeah |
| 13:39 | stuartsierra | I'm following the less-AOT trend, not pushing it. :) |
| 13:39 | hiredman | one resolution would be a stable abi |
| 13:39 | _fogus_ | Anyone know if there are any plans to produce warnings/errors when name-shadowing core fns? |
| 13:39 | cemerick | we have a couple of customers that pull apart every jar we send to them and run who-knows-what sort of verification tool on the contents. They *flipped* when a binary file was in there that they didn't recognize. |
| 13:40 | alexyk | hey guys, what's the latest and greatest version number for core which sync with contrib from build.clojure.org? |
| 13:40 | cemerick | stuartsierra: yeah, I know |
| 13:40 | hiredman | hah |
| 13:40 | hiredman | wow |
| 13:40 | cemerick | in their context, I totally understand |
| 13:40 | hiredman | _fogus_: lexically? |
| 13:40 | alexyk | what did I miss which elicited a hah and a wow from hiredman?! :) |
| 13:40 | hiredman | I doubt it |
| 13:40 | _fogus_ | hiredman: yes |
| 13:40 | LauJensen | technomancy: Past quarter 7 Googlers have hit my site searching for "autoloading failed to define function swank-cloju" |
| 13:41 | stuartsierra | alexyk: both core and contrib have SNAPSHOTS on build.clojure.org, they should sync with each other |
| 13:41 | hiredman | _fogus_: do you really have a problem with doing that often? |
| 13:41 | alexyk | stuartsierra: 1.1.0-SNAPSHOT? |
| 13:41 | cemerick | stuartsierra: do you not like a prior suggestion of mine: simply AOT everything by default, but produce -sources artifacts that contain those minimal set of .class files? |
| 13:41 | alexyk | or 1.2.0-...? |
| 13:41 | _fogus_ | hiredman: I do not, but I am sympathetic to the potential frustrations |
| 13:41 | stuartsierra | cemerick: not much :) |
| 13:42 | stuartsierra | I'm aiming for maximum compatibility right now. |
| 13:42 | alexyk | technomancy: does lein look at clojars first, or build.clojure.org can preemt that? |
| 13:42 | hiredman | _fogus_: is it really one of those? I don't recall it ever being a problem |
| 13:42 | cemerick | stuartsierra: I'll pick up a new épée for you :-D |
| 13:43 | stuartsierra | heh |
| 13:43 | stuartsierra | I was a foil fencer, actually. |
| 13:43 | cemerick | stuartsierra: how about the source jar as the primary artifact, and a full AOT as a -binary artifact? |
| 13:43 | alexyk | so, 1.2.0-SNAPSHOT or what? |
| 13:43 | stuartsierra | alexyk: yes |
| 13:43 | alexyk | cool |
| 13:43 | stuartsierra | cemerick: that's a good idea |
| 13:43 | _fogus_ | hiredman: You've never named a seq something like keys, then tried to call the keys function and produced an error? (this is a totally fabricated example and certainly never happened to me... never... no way... stop looking at me like that!) |
| 13:44 | stuartsierra | Annoying to implement, though. |
| 13:44 | cemerick | stuartsierra: I could take a poke at it this weekend. |
| 13:45 | stuartsierra | Another possibility is to make a profile that AOT-compiles everything. |
| 13:45 | stuartsierra | That would be easier. |
| 13:45 | cemerick | that just pushes the complexity to hudson, no? |
| 13:46 | stuartsierra | I was thinking of making it an option for people to build themselves. |
| 13:46 | stuartsierra | Not part of the standard snapshot builds. |
| 13:46 | cemerick | hrm |
| 13:47 | hiredman | _fogus_: not that I recall, but I'm sure I have, and once I eval -> run the problem is pretty obvious |
| 13:47 | cemerick | stuartsierra: that's not a huge improvement over the current situation. |
| 13:47 | stuartsierra | cemerick: What is it you're looking for? Fully AOT-compiled contrib? |
| 13:48 | _fogus_ | hiredman: I definitely do it far less than I did in the beginning, but I fail to see the downside to providing a warning especially for the benefit of newcomers. Maybe I'm missing something |
| 13:48 | hiredman | so 98% of the time it is not a problem, and in that 2% the fix is immediately obvious |
| 13:48 | cemerick | right, which we produce for ourselves already anyway. Trying to make the path easier for others, and hopefully establish a little precedent for libs. :-) |
| 13:48 | hiredman | _fogus_: there is a downside, noise |
| 13:48 | hiredman | I do shadow names from core when I want to |
| 13:49 | hiredman | and I don't want a warning everytime I do |
| 13:49 | stuartsierra | cemerick: I'd approve of the precedent IF we can fix the compatibility problems, but that's a big IF |
| 13:49 | _fogus_ | hiredman: As do I, but I try not to if I can avoid it. Well, noise could be eliminated with some sort of *warn-on-shadow* |
| 13:50 | zaphyr | it wouldn't be horribly un-clojure like to make a (with-graphics g & body) macro to make drawing a little less um.. baggy in clojure than java would it? |
| 13:50 | cemerick | stuartsierra: you mean breakage when the clojure.core api changes? |
| 13:50 | zaphyr | i.e. binding *g* to g within body |
| 13:50 | stuartsierra | I mean breakage whenever the compiler internals change. |
| 13:51 | cemerick | right |
| 13:51 | fdaoud | _fogus_: kudos, how'd you convince Manning to have two simultaneous Clojure books? |
| 13:51 | stuartsierra | Right now, something AOT-compiled under 1.0 doesn't work under 1.1 |
| 13:51 | hiredman | _fogus_: defaults to on or off? surely the majority of developers would not be newbies so you would default to off, then you have to explain the flag just like *warn-on-reflection* to newbies when they have the issue |
| 13:51 | stuartsierra | Even if the source is API-compatible |
| 13:51 | a_strange_guy | Hi there, |
| 13:52 | cemerick | stuartsierra: that's fundamentally not a problem if one is talking about a maven toolchain. It'd be incredibly rare for someone to independently force a different clojure.core dependency. |
| 13:52 | a_strange_guy | what is the process to file tickets? do i need the CA for that? |
| 13:52 | stuartsierra | Yes, with libs that get updated often. |
| 13:52 | stuartsierra | But what about all the stuff on Clojars? |
| 13:52 | stuartsierra | That's really what drove the less-AOT idea. |
| 13:52 | _fogus_ | fdaoud: I had nothing to do with their decision. I think they liked the idea of having two books that approach Clojure from different angles |
| 13:53 | fdaoud | _fogus_: well that's excellent. I couldn't even convince them to have one book on Stripes ;) |
| 13:53 | _fogus_ | hiredman: Default to "on" of course. The majority of users night not now be newbies, but I imagine that one of the goals is to make it as newbie friendly as possible (within reason) |
| 13:54 | cemerick | stuartsierra: clojars is the land of lein, which I don't know well at all. However, insofar as version A of a lib depends (perhaps transitively) on clojure.core version B, it will do so forever. The trouble only happens when people start throwing around jars willy-nilly. |
| 13:55 | stuartsierra | cemerick: But with source code, it doesn't necessarily have to depend on clojure.core version X. |
| 13:55 | stuartsierra | I.e., most code written for 1.0 works with 1.1, but NOT if it's AOT-compiled. |
| 13:55 | hiredman | _fogus_: so then if I don't want the noise I have to set! it to off everytime I open a repl? |
| 13:56 | cemerick | stuartsierra: yeah, I understand that, but talking about source distros puts us back to where we started. |
| 13:56 | hiredman | stuartsierra: is there a list of what doesn't work? |
| 13:56 | hiredman | the only issue I see regular enough to remember it is the RestFn thing |
| 13:56 | ordnungswidrig | hi all |
| 13:56 | stuartsierra | hiredman: It's not an API problem. It's binary incompatibility between what the compiler generates. |
| 13:56 | hiredman | stuartsierra: right |
| 13:56 | _fogus_ | hiredman: Or better yet, as a flag to clojure.main |
| 13:57 | hiredman | :( |
| 13:59 | hiredman | stuartsierra: is there a list of abi changes? |
| 13:59 | stuartsierra | yes, in the Clojure source |
| 13:59 | stuartsierra | as CHANGES.txt |
| 14:00 | stuartsierra | in the release branch |
| 14:00 | hiredman | oh |
| 14:00 | hiredman | that would explain why I've never seen that file |
| 14:10 | jcromartie | using clojure.contrib.sql, how would I get the IDs of the records I am insterting? |
| 14:12 | jcromartie | or should I manage my own IDs? |
| 14:12 | jcromartie | I could generate UUIDs or something like that |
| 14:12 | Kruppe | I'm having serious difficulty setting up slime and clojure so that clojure.core/compile works from the slime repl. It works on my simple test file from a clojure repl outside of emacs and slime, and the I've set the classpath to be the same in both. The error I get is "No such file or directory [Thrown class java.io.IOException]". Is there anything obvious this might be? |
| 14:13 | cemerick | jcromartie: that's database dependent |
| 14:13 | jcromartie | OK so how about a general approach? |
| 14:13 | jcromartie | should I perhaps be generating my own UUID |
| 14:16 | technomancy | Kruppe: is there a reason you're compiling manually rather than using a build tool? |
| 14:16 | cemerick | jcromartie: I don't think there is a general approach for obtaining the primary key of the last inserted row. You can use a UUID, or some natural key, but that decision is highly app-specific. |
| 14:16 | technomancy | Kruppe: probably classes/ is not on your classpath, but why don't you try Leiningen instead? it handles that stuff for you. |
| 14:17 | jcromartie | cemerick: yeah I mean just in general, are there people here using clojure.contrib.sql who have solved this? |
| 14:17 | Kruppe | technomancy: it is on my classpath :( |
| 14:18 | Kruppe | technomancy: ill look into Leiningen though |
| 14:20 | cemerick | jcromartie: c.c.sql is just a wrapper around jdbc. There's this, although many jdbc drivers don't support it: http://java.sun.com/javase/6/docs/api/java/sql/Statement.html#getGeneratedKeys%28%29 |
| 14:20 | jcromartie | hmm |
| 14:21 | jcromartie | I think I am just going to have a required unique short id |
| 14:21 | jcromartie | it works for a few reasons in this case |
| 14:25 | stuarthalloway | how do I tell from build.clojure.org what names I can use in leiningen dependencies? |
| 14:26 | arohner | jcromartie: you can usually grab the next id from the sequence before inserting, and do it yourself |
| 14:26 | jcromartie | true |
| 14:28 | stuarthalloway | nevermind. link is /snapshots -- which isn't linked anywhere on the main page |
| 14:33 | jcromartie | hmm, this is a fun one: Caused by: java.lang.RuntimeException: java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 5 to TIMESTAMP. |
| 14:33 | jcromartie | just trying to print the result of a query |
| 14:38 | wtetzner_ | is there a way to define something such that it only takes that value if it hasn't been bound yet? |
| 14:38 | chouser | defonce |
| 14:38 | wtetzner_ | oh |
| 14:38 | wtetzner_ | thanks |
| 14:38 | chouser | that's meant for defining something that will survive a reload of the source file. Is that your use case? |
| 14:39 | dakrone | what's the constructor method called when proxying a java class? (proxy [MyClass] (MyClass [] ((proxy-super) ...) ? |
| 14:39 | wtetzner_ | yes, that's exactly what i want |
| 14:39 | chouser | dakrone: you don't get to override the ctor |
| 14:40 | cemerick | quote from a friend I showed clojure to once: "Oh, so if I say (defonce foo (ArrayList.)), that list is immutable now?" :-D |
| 14:40 | fdaoud | we need amit and luke and we have all the clojure book authors here at once |
| 14:40 | cemerick | _fogus_: simple solution: stop writing python ;-) |
| 14:40 | chouser | dakrone: instead, provide your users a function (defn make-foo [a b] (proxy [MyClass] [a] (foomethod [] ...))) |
| 14:40 | qed | what does it mean for something to be debogonised? |
| 14:40 | the-kenny | _fogus_: I always type (if instead of if( in ObjC, Java etc. |
| 14:41 | dakrone | chouser: okay, I'll do that, thanks |
| 14:41 | chouser | dakrone: note you've got a spot there in proxy to pass args to the superclass ctor. |
| 14:42 | chouser | dakrone: and all your proxy methods are closures, so they can use the args passed into your make-foo fn |
| 14:42 | _fogus_ | cemerick: I like Python! (plus it allows me to feed my kids :p) |
| 14:42 | dakrone | chouser: cool |
| 14:42 | the-kenny | _fogus_: Looks like xkcd is true.. with python, you can do everything |
| 14:44 | _fogus_ | the-kenny: Hacking Python in Emacs makes me almost omniscient. |
| 14:44 | the-kenny | _fogus_: And you can fly, right? |
| 14:44 | drewr | _fogus_: do you use pymacs? |
| 14:44 | cemerick | funny, I could never make a dime with python |
| 14:45 | the-kenny | _fogus_: http://xkcd.com/353/ :) |
| 14:45 | _fogus_ | M-x superman-mode |
| 14:50 | bobo_ | i followed http://riddell.us/tutorial/slime_swank/slime_swank.html but get NoClassDefFound clojure/main when invoking slime. any clues? |
| 14:50 | _fogus_ | drewr: I am not, but one of these days I plan to get it working |
| 14:58 | hyp3rvigi1ant | bobo_: I would recommend this approach: http://github.com/technomancy/swank-clojure (scroll down to "Installation") |
| 14:58 | bobo_ | hyp3rvigi1ant: ok il give it a go |
| 15:05 | bobo_ | that was almost to easy |
| 15:10 | esj | qed: bogons are reputedly the fundamental particles of bogusness |
| 15:17 | zaphyr | esj: I thought that was Lenats? |
| 15:18 | zaphyr | hehe, douglas lenat, makes Cyc :) |
| 15:18 | esj | It is perhaps for this reason that "bogosity" is jokingly said to be measured in microlenats according to the Jargon File, the lenat being considered too large for practical use. |
| 15:18 | zaphyr | hahahaha |
| 15:18 | esj | from our friends at Wikipedia |
| 15:18 | zaphyr | that would be it :) |
| 15:31 | duncanm | hmm - what's the best way to represent a fixed-size grid using clojure's data structures? |
| 15:32 | ulfster | duncanm: probably 2dimensional vectors |
| 15:32 | chouser | or one-dimentional with fns to do the math from 2d |
| 15:41 | DeusExPikachu | how do you edit a remote file in emacs such that when you C-c C-l it, it loads correctly in the remote swank server? |
| 15:44 | the-kenny | DeusExPikachu: Maybe with TRAMP? |
| 15:44 | DeusExPikachu | doesn't work |
| 15:44 | DeusExPikachu | gives an error, like file not found |
| 15:44 | the-kenny | hm ok. Can you define "remote file" for me? Where does the swank server run? |
| 15:45 | DeusExPikachu | so on the server, there is a file bar.clj in directory foo/src |
| 15:45 | DeusExPikachu | I can connect to server with tramp and edit it in emacs |
| 15:45 | DeusExPikachu | but C-c C-l gives error |
| 15:46 | dnolen | DeusExPikachu: is SLIME connected to the remote REPL? |
| 15:47 | DeusExPikachu | yeah, I started swank on the server with "lein swank", ssh tunneld 4005 and used slime-connect to localhost |
| 15:47 | the-kenny | I'm not sure - Does slime-load-file load the contents locally and pushes them to swank or does it say "hey there, swank, load this file from your file system"? |
| 15:48 | dnolen | DeusExPikachu: oh I see, C-x C-e works, just not C-c C-l ? |
| 15:48 | DeusExPikachu | yeah |
| 15:49 | duncanm | hmm |
| 15:49 | duncanm | chouser: i don't know how to do a scheme-like vector-set! with clojure vectors |
| 15:50 | duncanm | chouser: i can store the vector in a ref, but how do i replace one specific element by index? |
| 15:50 | kotarak | ,(assoc [1 2 3] [1] 0) |
| 15:50 | clojurebot | java.lang.IllegalArgumentException: Key must be integer |
| 15:50 | the-kenny | ha! |
| 15:50 | kotarak | ,(assoc [1 2 3] 1 0) |
| 15:50 | clojurebot | [1 0 3] |
| 15:50 | the-kenny | DeusExPikachu: slime-load-file (the fun bound to C-c C-l) loads the file locally in emacs and pushes the contents of the file to swank to evaluate it. |
| 15:50 | duncanm | ahh |
| 15:51 | the-kenny | DeusExPikachu: Looks like it doesn't work together with elpa |
| 15:52 | DeusExPikachu | btw, I can manually load the file using (load-file "src/bar.clj") |
| 15:53 | the-kenny | DeusExPikachu: Seems logical to me |
| 15:56 | _ato | DeusExPikachu: have you tried C-c C-k ? or did you want to load one by name, rather than the current file? |
| 15:57 | DeusExPikachu | _ato, I hacked C-c C-k to work specially for my sbcl stuff, so I kinda prefer using C-c C-l for clojure |
| 15:57 | _ato | fair enough |
| 16:00 | DeusExPikachu | where's the definition for slime-load-file? I might just tweak it myself |
| 16:11 | tcrayford | otherwise I'd roll with using mexpand-all, but this has to keep the rest of the code the same |
| 16:11 | jcromartie | OK new rule: when your library hits an unexpected EOF, you are NOT ALLOWED to just say "EOF while reading" |
| 16:12 | somnium | tcrayford: ah, you only want -> or ->> to expand. why not use clojure.walk and check for lists starting with -> or ->> |
| 16:12 | jcromartie | because then the REPL tells me, essentially, that there was an EOF while reading whatever.clj |
| 16:12 | tcrayford | ooh!? |
| 16:13 | tcrayford | clojure.walk has an implimentation of macroexpand-all as well as contrib.macro-utils |
| 16:13 | alexyk | somnium: what's the latest congomongo in clojars, still 0.1.1? |
| 16:13 | somnium | alexyk: yup |
| 16:13 | duncanm | user=> java.io.FileNotFoundException: Could not locate swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0) |
| 16:13 | duncanm | hmm |
| 16:14 | alexyk | somnium: liebke pushed it as 1.0.0, you should fight |
| 16:14 | duncanm | ahh |
| 16:14 | duncanm | i get it |
| 16:14 | the-kenny | duncanm: added swank-clojure to the lib-directory? |
| 16:14 | somnium | alexyk: author's humility :) |
| 16:14 | the-kenny | (swank-clojure-1.1.0.jar or something like this) |
| 16:14 | alexyk | 1.0.0 is a filed-wise bit not on 0.1.1 |
| 16:14 | tcrayford | somnim that might work |
| 16:14 | tcrayford | cheers for the pointer at walk |
| 16:14 | somnium | alexyk: filed-wise ? |
| 16:15 | alexyk | somnium: 0=>1 in 0.1.1 => 1.0.0 :) |
| 16:16 | somnium | alexyk: the root group is being squatted too, Im more concerned with the accumulating patches I still havent gotten to |
| 16:16 | tcrayford | ,(postwalk |
| 16:16 | tcrayford | (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll)) |
| 16:16 | tcrayford | '(->> 1 (+ 1)) |
| 16:16 | tcrayford | ) |
| 16:16 | clojurebot | EOF while reading |
| 16:17 | tcrayford | (postwalk (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll)) '(->> 1 (+ 1))) |
| 16:17 | tcrayford | ,(postwalk (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll)) '(->> 1 (+ 1))) |
| 16:17 | clojurebot | java.lang.Exception: Unable to resolve symbol: postwalk in this context |
| 16:17 | tcrayford | weird |
| 16:17 | tcrayford | works on my repl |
| 16:17 | somnium | ,(use 'clojure.walk) |
| 16:17 | clojurebot | nil |
| 16:17 | alexyk | if I want to exclude a jar from lein, should I use :excusions per a deoendency or there's a global way? |
| 16:17 | tcrayford | ,(postwalk (fn [coll] (if (and (seq? coll) (= (first coll) '->>)) (macroexpand-1 coll) coll)) '(->> 1 (+ 1))) |
| 16:17 | clojurebot | (+ 1 1) |
| 16:18 | tcrayford | yeah that works perfectly |
| 16:18 | tcrayford | and I can trivially use it for expanding ->> as well |
| 16:18 | alexyk | tcrayford: what's the use case for postwalk? |
| 16:19 | tcrayford | macroexpanding any ->> forms inside a list |
| 16:19 | alexyk | tcrayford: before applying ->>? |
| 16:19 | tcrayford | nope |
| 16:20 | tcrayford | I'm doing this as part of a refactoring tool, so if you have an expression that is currently in a ->> form, you can convert it to one without said form automatically |
| 16:20 | alexyk | ah, just expanding it for sure |
| 16:24 | qed | Lisp Chainsaw |
| 16:24 | alexyk | ok I have a sneaky jar which is copied by lein deps every time. How do you folks do explusions again? |
| 16:25 | alexyk | exclusions |
| 16:28 | alexyk | technomancy: ping |
| 16:29 | _ato | it's in the FAQ in the readme: http://github.com/technomancy/leiningen/blob/master/README.md |
| 16:29 | _ato | Q: Is it possible to exclude indirect dependencies? |
| 16:29 | alexyk | _ato: I try to do that and lein still copies teh damn jar |
| 16:29 | alexyk | so I was wondering why -- is there a tracking/verbose way to make it explain/ |
| 16:29 | somnium | _ato: oh, youre back. welcome back! |
| 16:30 | alexyk | also, do I have to push :exclusions into a dependency, why not have it globally? |
| 16:30 | alexyk | I've added the :exclusions to two deps, and it's still getting it |
| 16:30 | _ato | alexyk: not sure. I haven't looked into how that stuff works. Guess you do need technomancy then. :-P |
| 16:30 | somnium | _ato: any way I could get the congomongo root group? (it was accidentally squatted by a fork)) |
| 16:31 | _ato | somnium: yeah sure, just a sec |
| 16:32 | _ato | somnium: done |
| 16:32 | somnium | _ato: great, thanks! |
| 16:34 | technomancy | :exclusions need to be on a per-dependency level so you can block one version of a dependency while letting another one through |
| 16:34 | technomancy | leiningen is just exposing the underlying maven functionality |
| 16:35 | technomancy | alexyk: what's the offending jar? |
| 16:36 | alexyk | technomancy: so I use org.mongodb/mongo-java-driver "1.2.0-SNAPSHOT". But I also use congomongo which wants 1.1.0-SNAPSHOT. I tell congomongo, no-no, bad dep! -- and lein still gets the 1.1.0-SNAPSHOT. |
| 16:37 | alexyk | I thought maybe incanter tries to get it, and slapped another :exclusions on incanter -- no luck. I have explicit dep, [org.mongodb/mongo-java-driver "1.2.0-SNAPSHOT"] |
| 16:37 | technomancy | alexyk: have you tried ordering it so the one that depends on the correct version comes first in the dependencies list? |
| 16:38 | technomancy | alexyk: it could be a bug in the :exclusions support. I haven't used it myself. |
| 16:38 | technomancy | mattrepl might know; he implemented it |
| 16:38 | alexyk | technomancy: the fact is. congomongo depends on 1.1.0; I checked I can safely fool it with 1.2.0, so nobody depends on it per se. |
| 16:38 | alexyk | I want to supplant 1.1.0 by 1.2.0 |
| 16:39 | alexyk | ah! mattrepl likes to reply that a missing feature is left as an exercise to the reader. We'll see about a buggy one! :) |
| 16:39 | mattrepl | alexyk: bah basicauth is deprecated |
| 16:39 | mattrepl | =) |
| 16:39 | alexyk | mattrepl: I lived it down already :) |
| 16:40 | alexyk | so, what about 'em exclusions? |
| 16:40 | mattrepl | they're actually officially removing it this summer, just a heads up |
| 16:40 | alexyk | mattrepl: that's ok, I've mastered oauth fine, your stuff works great |
| 16:40 | mattrepl | where's the project file at? |
| 16:41 | alexyk | mattrepl: http://paste.pocoo.org/show/173588/ |
| 16:42 | alexyk | I try to exterminate the mongo-java-driver-1.1.0-... which lein deps pulls from its rear orifice |
| 16:42 | tcrayford | somnium etc: cheers for that, everything works properly now |
| 16:42 | alexyk | btw, would be nice to have a top-level :exlusions like shown there -- does nothing though |
| 16:44 | mattrepl | hmm, looks fine |
| 16:44 | somnium | tcrayford: great |
| 16:45 | mattrepl | will try to duplicate |
| 16:45 | technomancy | alexyk: try putting a few trace lines in deps/make-exclusion to make sure the underlying API is getting called at all |
| 16:45 | tcrayford | ended up having to recur through it to expand ->> until it was no longer present, but otherwise its good |
| 16:45 | alexyk | technomancy: KDD deadline 2/2, for now will rm :) |
| 16:46 | alexyk | post-lein hook, manual |
| 16:47 | technomancy | KDD? |
| 16:48 | alexyk | technomancy: kdd.org |
| 16:48 | alexyk | a clojure-driven twitter-eatin' paper, lein-swankin', incanter-plottin'! |
| 16:49 | technomancy | nice |
| 16:49 | AWizzArd | ~seen rhickey |
| 16:49 | clojurebot | rhickey was last seen in #clojure, 424 minutes ago saying: stuartsierra: done |
| 16:49 | alexyk | somebody should do something in the real world with all the stuff you kids make up here |
| 16:50 | AWizzArd | rhickey: ping |
| 16:50 | mattrepl | alexyk: was gonna say.. jung, twitter, mongodb.. sounds interesting =) |
| 16:51 | alexyk | the real problem, my repls are gone after a day. clojure garbage strewn all over the ram |
| 16:51 | alexyk | I use compressed oops, and give it 30 gb -- it reaches that fast and starts saying, gc overhead reached |
| 16:52 | alexyk | then it's time to restart and reload painfully; mongodb is the persistent savior |
| 16:52 | alexyk | mattrepl: yeah, I inferred you plotting along the same lines :) |
| 16:53 | alexyk | tcrayford: a PhD? where? |
| 16:53 | mattrepl | muahaha... not for KDD though =) |
| 16:53 | alexyk | mattrepl: yeah, sensed $$$ too :) |
| 16:54 | mattrepl | unfortunately, none of that either |
| 16:54 | alexyk | ,(def $ 1000) |
| 16:54 | clojurebot | DENIED |
| 16:54 | alexyk | hmm |
| 16:54 | alexyk | ,(def a 1) |
| 16:54 | clojurebot | DENIED |
| 16:54 | tcrayford | alexyk, not a phd, just a bsc (at sheffield in ze uk) |
| 16:54 | alexyk | tcrayford: ah ok, you guys write a bsc thesis then? |
| 16:55 | tcrayford | confirm |
| 16:55 | alexyk | nice |
| 16:55 | tcrayford | well, dissertation |
| 16:55 | alexyk | mattrepl: I'm curious, will ping offline |
| 16:56 | alexyk | there's a gang of twitter clojurers already here |
| 16:56 | alexyk | we need t organize |
| 16:56 | alexyk | to |
| 16:56 | hiredman | anyone know a good way to generate an html file with side by side diffs of all the files in a directory? |
| 16:56 | tcrayford | the twitter ops guys have been playing around with clojure/hadoop for statistics |
| 16:57 | mattrepl | alexyk: use org.clojars.somnium/mongo-java-driver |
| 16:57 | alexyk | mattrepl: ah for exclusions! duh. |
| 16:57 | mattrepl | org.mongodb ns (or whatever it's called in mvn world) is incorrect |
| 16:58 | alexyk | well, it's correct for maven, if only folks wouldn't stuff the jars into clojars under their ns's... |
| 16:58 | somnium | alexyk: they only had the 1.0 jar on mvn at the time |
| 16:58 | alexyk | somnium: true. We need a clojars Nazi |
| 16:59 | alexyk | to move them into the right place |
| 16:59 | alexyk | or something |
| 16:59 | alexyk | e.g. it wouldn't let liebke upload congomongo |
| 16:59 | technomancy | squatting on the group for a project you don't own is not cool |
| 16:59 | alexyk | and enforce naming for things existing in mvnrepository |
| 17:00 | alexyk | sometimes people just want to package stuff and have it there |
| 17:00 | alexyk | and since clojars search was broken, they didnt find it |
| 17:00 | alexyk | we'll have a major problem soon |
| 17:00 | mattrepl | wonder if we could provide a symlink or such for groups that have not yet been claimed by the appropriate owner |
| 17:01 | mattrepl | have to vet it somehow |
| 17:02 | alexyk | mattrepl: should I still stick :exclusions under a dependency, or can I have one global as I've written? |
| 17:03 | mattrepl | no global support at the moment. it could be added, but the semantics of it are a little weird |
| 17:03 | mattrepl | you exclude it as a dependency of your dependencies yet it's listed as a project dependency |
| 17:03 | neotyk | Hi |
| 17:03 | neotyk | ~pastebin |
| 17:03 | clojurebot | excusez-moi |
| 17:03 | alexyk | mattrepl: it's just next to :dependencies |
| 17:03 | neotyk | where is pastebin that clojurebot picsup? |
| 17:04 | alexyk | it's a global exlusion, saying, don't auto-pull any version of it, except possibly what :dependencies mentions explicitly |
| 17:04 | alexyk | or, perhaps, :only flag on a dependency in this case |
| 17:04 | alexyk | meaning no other version |
| 17:05 | mattrepl | would rather see some way to improve version dependencies |
| 17:08 | alexyk | mattrepl: the problem is, I'm enforcing a version bump; the deps wnt an older one. Unless it's auto-detected, need to exclude |
| 17:08 | alexyk | want |
| 17:09 | mattrepl | well, needs to be approved by technomancy |
| 17:10 | hiredman | neotyk: lisppaste8 is the one with the pastebin |
| 17:12 | hiredman | clojurebot: ~paste |
| 17:12 | clojurebot | Pardon? |
| 17:12 | hiredman | clojurebot: ~url |
| 17:12 | clojurebot | Excuse me? |
| 17:12 | neotyk | http://clojure.pastebin.com/m3e22d711 |
| 17:12 | wtetzner_ | is there a way to check if a var is bound? |
| 17:12 | neotyk | I'm looking into add-watch |
| 17:13 | neotyk | can someone tell me why this code of "archtect?" is not getting called? |
| 17:13 | wtetzner_ | i want to create a binding form, like (binding [item 1 ..., item 2 ...]), but i want to keep the existing values only if that symbol is already bound |
| 17:13 | hiredman | what makes you think it isn't getting called? |
| 17:13 | neotyk | no printin' |
| 17:14 | hiredman | neotyk: println relies on *out*, which is thread localy bound, by say, swank-clojure |
| 17:15 | neotyk | so this code "works"? |
| 17:15 | hiredman | I don't know |
| 17:16 | neotyk | let me try outside emacsitor |
| 17:16 | hiredman | I am helping you test it |
| 17:17 | neotyk | hiredman: briliant |
| 17:17 | neotyk | it works |
| 17:17 | neotyk | as soon as outside of emacsitor |
| 17:18 | hiredman | http://www.thelastcitadel.com/lab/master-1.0.x.diff.html <-- diff of the abi of master and 1.0 |
| 17:19 | ctdean | neotyk: are your running in slime ? |
| 17:19 | neotyk | ctdean: yes |
| 17:19 | hiredman | line 1011 has the RestFn issue |
| 17:19 | tcrayford | check the terminal window where you ran swank from |
| 17:20 | tcrayford | or inferior lisp if you're using swank-clojure |
| 17:20 | ctdean | neotyk: try looking in *inferior-lisp*also |
| 17:20 | ctdean | :) |
| 17:20 | neotyk | yes it is there |
| 17:20 | neotyk | but not very helpful, right? |
| 17:22 | kotarak | ,(let [a [5] b [5]] [(identical? a b) (set [a b])]) |
| 17:22 | clojurebot | [false #{[5]}] |
| 17:23 | duncanm | hmm |
| 17:23 | duncanm | i'm trying to use agents, and I see RejectedExecutionExceptions |
| 17:23 | duncanm | how do I debug them? |
| 17:23 | duncanm | the stacktrace doesn't tell me where it's failing |
| 17:23 | chouser | that probably means you called shutdown-agents in that JVM already |
| 17:23 | duncanm | hmm |
| 17:23 | chouser | s/probably/usually/ |
| 17:23 | duncanm | oh, if i call that once, my JVM is toasted for all subsequent agents? |
| 17:23 | chouser | yessir |
| 17:23 | duncanm | oh! |
| 17:24 | duncanm | and the only way to fix that is to start anew? |
| 17:24 | chouser | I think so. |
| 17:24 | hiredman | ,(doc identical?) |
| 17:24 | clojurebot | "([x y]); Tests if 2 arguments are the same object" |
| 17:24 | hiredman | ^- |
| 17:24 | chouser | the thread pools used by send and send-off are static final. |
| 17:28 | duncanm | ahh |
| 17:28 | chouser | which means they can't be replaced. |
| 17:28 | chouser | I don't see any way in the api to start up a pool that's been shutdown. |
| 17:28 | duncanm | chouser: in a function that's used to update an agent, the first argument is usually the agent itself, right? |
| 17:28 | chouser | no, the value of the agent |
| 17:29 | hiredman | ~def shutdown-agents |
| 17:29 | the-kenny | ,(shutdown-agents) |
| 17:29 | clojurebot | java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread) |
| 17:30 | hiredman | ~def c.l.Agent |
| 17:31 | neotyk | ~def restart-agents |
| 17:31 | clojurebot | No entiendo |
| 17:43 | dsop | whats the best way to do kindof pattern matching, something like (defn foo [x] ([1] (println "foo") [2] (println "2foo"))) ? |
| 17:44 | chouser | for that example, I'd recommend 'case' or if you're on 1.1 'cond' |
| 17:44 | dsop | okay, I'll try to figure out how to use it, thanks. |
| 17:44 | Chousuke | isn't there a pattern matching macro in contrib somewhere too? :/ |
| 17:44 | the-kenny | When I read "pattern matching", I think of http://www.brool.com/index.php/pattern-matching-in-clojure |
| 17:44 | dsop | Chousuke: tit seems that there is match in contrib, but I don't want to use contrib |
| 17:45 | wtetzner_ | is there a way to do something like (binding []), but for symbols that are not already defined? |
| 17:45 | the-kenny | wtetzner_: let? |
| 17:46 | wtetzner_ | no, i need to be able to set! them |
| 17:46 | Chousuke | declare the vars first |
| 17:46 | technomancy | there's with-local-vars, but you probably shouldn't be doing that |
| 17:46 | wtetzner_ | technomancy: why not? |
| 17:47 | technomancy | because set! is almost always the wrong thing |
| 17:47 | technomancy | outside of a repl/screwing around context |
| 17:48 | technomancy | there are much better ways provided by Clojure of managing state |
| 17:48 | wtetzner_ | it's for a DSL i'm writing. I want to have something called defval, which will check if the var has a value already |
| 17:48 | wtetzner_ | so it would be set once |
| 17:49 | tomoj | 27 jars in lib/ for a blank project... :/ |
| 17:49 | wtetzner_ | so set! would only be called once, but i need to have "global" values |
| 17:50 | wtetzner_ | technomancy: anyway, thanks |
| 17:50 | tomoj | I must not understand you, that sounds like defonce |
| 17:52 | wtetzner_ | tomoj: it's like defonce, but i don't necessarily want to define things outside of an enclosing function |
| 17:52 | tomoj | ah yes, they'd leak out I guess? |
| 17:52 | wtetzner_ | also, i need to capture the values into a hashmap |
| 17:55 | AWizzArd | Why does this await not return when the agent function throws an Exception? |
| 17:55 | AWizzArd | ,(let [a (agent 0)] (await (send a (fn [_] (throw (Exception. "Bar Foos")))))) |
| 17:55 | clojurebot | nil |
| 17:56 | AWizzArd | okay, the bot does not react on this, but if i paste this into my repl it stops, the await seems to block forever |
| 18:02 | AWizzArd | schlafen wohl schon alle |
| 18:02 | wtetzner_ | is there a way to check if a var has already been defined? |
| 18:03 | arohner | wtetzner_: use resolve |
| 18:03 | AWizzArd | wtetzner_: yes, (resolve some-symbol) |
| 18:03 | wtetzner_ | ok |
| 18:03 | wtetzner_ | thanks |
| 18:21 | duncanm | hmm |
| 18:22 | duncanm | if i have a data structure like {1 ['foo 'baz], 2 ['mumble 'grumble]} and I want to get to {1 ['foo 'bar 'baz] 2 .... } - how do i do that? |
| 18:22 | duncanm | i need a mix of assoc-in and conj together... |
| 18:23 | duncanm | hmm |
| 18:23 | AWizzArd | duncanm: first you should write a function (vector-insert ...) |
| 18:23 | duncanm | i'm starting to think that I should just use a Map |
| 18:23 | duncanm | i need to index via x,y,z |
| 18:24 | AWizzArd | This was intentionally left out, because the performance would not be good. FingerTrees would make this easier. |
| 18:30 | jcromartie | what's a good way to filter through a hash-map and produce another map? |
| 18:30 | AWizzArd | in what way you want to filter? |
| 18:31 | jcromartie | I want all of the pairs with non-nil values |
| 18:31 | AWizzArd | jcromartie: you can do this with reduce. |
| 18:32 | somnium | ,(into {} (remove (fn [[k v]] (nil? v)) {:a 1 :b nil :c 2 :d nil})) |
| 18:32 | clojurebot | {:a 1, :c 2} |
| 18:32 | jcromartie | even better, somnium |
| 18:33 | jcromartie | thanks |
| 18:33 | jcromartie | I thought it would be something like that |
| 18:34 | AWizzArd | reduce could still be more efficient though |
| 18:34 | AWizzArd | ,(reduce (fn [m [k v]] (if-not (and k v) m (assoc m k v))) {} {:a 1, :b nil, :c 3, nil 5}) |
| 18:34 | clojurebot | {:c 3, :a 1} |
| 18:36 | tomoj | wrote my first emacs function :) https://gist.github.com/c120edd064ad145656eb |
| 18:36 | tomoj | if you're in a lein project in a .clj file under src/, it inserts the appropriate ns declaration |
| 18:37 | herdrick | question: i've got a working version of clojure, swank-clojure, slime, etc running. how to i update it? I just did a "git pull" for everything, then tried mvn to build things. Not good. Among other problems, i'm now getting "File error: Cannot open load file, swank-clojure-autoload" when I try to start Emacs. |
| 18:37 | herdrick | is ELPA the accepted way to install swank-clojure? and how much does it do - i.e. do I "git pull" and "mvn compile" myself before using it? does it install clojure? |
| 18:37 | herdrick | also, i just did a "mvn compile" in my swank-clojure dir and its messages said it downloaded a clojure 1.0 jar. apparently, i'm supposed to specifiy a local jar using the -o option. correct? if so, why is swank configured to go get an old one? |
| 18:37 | herdrick | or am i supposed to be using leinigen to manage this? |
| 18:38 | tomoj | personally, I use elpa to update slime/swank-clojure/etc and use leiningen to install clojure into each project |
| 18:38 | tomoj | that way you get to pick the clojure version per-project as well |
| 18:39 | herdrick | tomoj: ok, thanks |
| 18:39 | tomoj | and when I just want a repl, the elpa stuff installed clojure-1.1.0-master |
| 18:39 | tomoj | and M-x slime gives a repl to that to me |
| 18:39 | herdrick | tomoj: but when you M-x slime, doesn't it always use the same version of clojure? no matter what project you want to work on? |
| 18:39 | tomoj | yeah |
| 18:39 | dsop | I'm sorry I'm really new to lisp, how do I expand a list to a set of parameters, so that (foo (list 1 2 3)) is equal to the call of (foo 1 2 3 ) |
| 18:40 | tomoj | if you want to work on a specific project, you can use swank-clojure-project or lein swank |
| 18:40 | tomoj | those both use the project-specific clojure version you installed with lein |
| 18:40 | herdrick | dsop: you want: (apply foo (list 1 2 3)) |
| 18:40 | tomoj | M-x slime is useful when you just want to get to a repl to play with something outside of a project |
| 18:40 | dsop | herdrick: thank you |
| 18:41 | jcromartie | what's the test for wether something is seq-able? |
| 18:41 | herdrick | dsop: glad to help! |
| 18:41 | tomoj | and I think if you want to change the version M-x slime launches, you can just drop the jars into ~/.swank-clojure, though I haven't tried this |
| 18:42 | jcromartie | (isa? Seqable) |
| 18:42 | dsop | herdrick: is it usual that you define this as a arity overloading? |
| 18:42 | herdrick | tomoj: ok, i'll look up lein swank and swank-clojure-project |
| 18:42 | herdrick | thanks |
| 18:43 | herdrick | dsop: not sure what arity overloading is. it definitely is usual in the lisp world to use 'apply' a lot |
| 18:43 | Chousuke | if creating maps, into will most likely be most efficient for large ones, because it uses a transient map internally. |
| 18:44 | dsop | herdrick: I mean like (defn foo ([x] (apply foo x) ) ([a b c] ...)) |
| 18:44 | herdrick | tomoj: somehow i knew i was going to hate trying to update my clojure install. sure enough... |
| 18:44 | tomoj | yeah.. I run into trouble occasionally |
| 18:44 | dsop | herdrick: nevermind, it works so far, thank you :) |
| 18:44 | tomoj | the past couple days, though, I've set up clojure on bare emacs on two different boxes, and it was delightfully easy |
| 18:45 | tomoj | package.el, install the elpa stuff, install paredit, add my clojure-mode customizations, install lein, no problems at all starting fresh |
| 18:45 | herdrick | tomoj: hmmm... that's probably the way for me to go. my .emacs file is small enough - aside from the clojure stuff - to make starting over easy |
| 18:46 | herdrick | paraedit? |
| 18:46 | herdrick | paredit? |
| 18:46 | tomoj | yeah.. if you're using emacs you should look into it |
| 18:46 | tomoj | use paredit-beta.el |
| 18:46 | herdrick | i thought it was included in slime |
| 18:46 | herdrick | or swank |
| 18:47 | tomoj | dunno, I just grabbed paredit-beta.el |
| 18:47 | herdrick | dsop: ok, good luck |
| 18:47 | tomoj | it's in elpa but that one is old |
| 18:47 | dsop | hmm (defn foo ([x] (apply foo x) ) ([a b c] ...)) looks like a bad hack for lisp startes soehow |
| 18:47 | Chousuke | I don't think that's very common |
| 18:48 | dsop | okay. |
| 18:48 | Chousuke | it IS common in Clojure to use arity overloads to provide default values, though. |
| 18:48 | tomoj | herdrick: here is my paredit stuff for .emacs, may be useful https://gist.github.com/3416b90cf4b77d5c3af9 |
| 18:48 | AWizzArd | Oooh, very good. I just learned about the existance of http://code.google.com/p/google-collections/ |
| 18:48 | tomoj | though I don't guarantee usefulness or even that it works :) |
| 18:48 | AWizzArd | They have several immutable data structures, very interesting. |
| 18:49 | AWizzArd | Is the Apache 2 License compatible with the Eclipse License? |
| 18:49 | tomoj | just grabbed paredit-beta.el and put in on the load-path as paredit.el for that |
| 18:49 | dsop | Chousuke: but it is nice that I can do (hsv2rgb (rgb2hsv 242 212 0)) :) |
| 18:49 | herdrick | isn't there a documented standard way to install clojure with emacs? |
| 18:49 | herdrick | current, i mean... |
| 18:49 | tomoj | elpa is the standard way, I think |
| 18:49 | tomoj | not sure where it's documented |
| 18:50 | tomoj | or if |
| 18:50 | tomoj | I could write up my process sometime I suppose, if it's not out there already |
| 18:50 | Chousuke | dsop: well. that works. |
| 18:53 | herdrick | how does clojure-mode fit into this? i've got a clojure-mode.el that seems to be directing things |
| 18:54 | herdrick | should i just kill that? |
| 18:54 | tomoj | you would just use the elpa version for the putatively standard install |
| 18:54 | technomancy | herdrick: it's probably out of date; installing anything from clojure-mode has been deprecated for quite some time |
| 18:54 | herdrick | ah |
| 18:54 | herdrick | ok |
| 18:54 | herdrick | i'll wipe it out |
| 18:54 | technomancy | possibly since the summer |
| 18:54 | herdrick | hmmm |
| 18:55 | herdrick | so this is out of date: |
| 18:55 | herdrick | http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started |
| 18:55 | tomoj | I'm starting a blog post whether it's needed or not :) |
| 18:55 | technomancy | pretty much everything on the wiki is out of date, yeah. =( |
| 18:56 | herdrick | tomoj: needed! |
| 18:57 | herdrick | tomoj: i'll be ok, now, though, thanks |
| 18:57 | herdrick | tomoj: thanks, and bravo for doing it |
| 18:58 | herdrick | technomancy: bummer, eh? |
| 18:58 | technomancy | wikis are really hard to keep updated |
| 18:58 | technomancy | better just to link to the official documentation |
| 18:59 | tomoj | is there any? |
| 18:59 | technomancy | the swank-clojure readme is pretty thorough |
| 18:59 | technomancy | if it's not, file a bug |
| 18:59 | technomancy | I guess people just don't know to look there first. |
| 19:00 | tomoj | ah, yeah, looks good |
| 19:00 | tomoj | I guess I only remember hearing someone not understand how to follow the step "Install from ELPA using package.el" once |
| 19:01 | herdrick | technomancy: on this step: "3. Project: Put your project's dependencies in the lib/ directory," |
| 19:01 | herdrick | which /lib ? |
| 19:02 | technomancy | herdrick: lib inside your project root. if it doesn't exist you can mkdir it |
| 19:02 | technomancy | or better yet, use "lein new" from leiningen |
| 19:03 | herdrick | ok, thanks |
| 19:03 | technomancy | herdrick: http://vimeo.com/8934942 <= maybe start here |
| 19:03 | herdrick | i'm not using leiningen yet |
| 19:03 | tomoj | technomancy: do you know why I have lein-clojars and swank-clojure in my dev dependencies? |
| 19:03 | herdrick | technomancy: ah, excellent, thanks |
| 19:03 | tomoj | I've just always copied a working project.clj to a new project so those are always there |
| 19:04 | tomoj | don't remember why I put them there though |
| 19:05 | tomoj | lein new's not including them makes me wonder if they are unnecessary |
| 19:05 | hiredman | http://www.thelastcitadel.com/lab/abi-watch/ <-- abi diffs for the java part of clojure |
| 19:06 | tomoj | wow, I hadn't even seen that vimeo series at all |
| 19:24 | duncanm | if i just want to use condp for the ::> feature, what do i put it as the 'pred'? |
| 19:25 | hiredman | ,(doc condp) |
| 19:25 | clojurebot | "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must b |
| 19:25 | Chousuke | identity |
| 19:25 | duncanm | and condp doesn't have a :else, right? |
| 19:25 | hiredman | identity doesn't take two args |
| 19:26 | Chousuke | hmmh |
| 19:26 | somnium | do many people use condp with #(%1 %2) as the pred? |
| 19:27 | duncanm | i just like the :>> part, it's like the => in Scheme's COND |
| 19:27 | AWizzArd | somnium: no |
| 19:28 | somnium | I find it useful, but it looks a bit odd |
| 19:28 | herdrick | technomancy: i installed ELPA and swank-clojure on a fresh emacs install. but this line: (require 'slime) in swank-clojure.el is failing. can't find the file. |
| 19:29 | AWizzArd | duncanm: what is it doing? |
| 19:29 | herdrick | did i not delete enough dirs? |
| 19:29 | herdrick | pretty sure i cleaned everything up |
| 19:29 | duncanm | AWizzArd: http://gist.github.com/294229 |
| 19:30 | duncanm | AWizzArd: that doesn't look right |
| 19:30 | herdrick | hmm, sorry maybe not let me clean up some more junk bbiab |
| 19:31 | itistoday | is it possible to create a macro that takes a body with unbound symbols and bind them? |
| 19:32 | itistoday | i.e., i'm not an experienced clojure dev, so this is as far as i've gotten, and it throws an exception: |
| 19:32 | tomoj | if I understand what you mean, yeah, but it's generally frowned upon |
| 19:32 | itistoday | (defmacro foo [body] (binding [a 1] (cons 'do body))) |
| 19:33 | duncanm | itistoday: yeah, that's an unhygienic macro |
| 19:33 | chouser | but it's actually common |
| 19:33 | chouser | with-out-str, for example |
| 19:33 | itistoday | well 'body' would have an unbound 'a' symbol, that gets bound when you call foo |
| 19:33 | itistoday | (bound to 1) |
| 19:33 | itistoday | so is it possible to write that in clojure? |
| 19:34 | herdrick | hmm, i think everything is cleaned up |
| 19:34 | herdrick | tomoj: any thoughts? I installed ELPA and swank-clojure on a fresh emacs install. but this line: (require 'slime) in swank-clojure.el is failing. can't find the file. |
| 19:35 | Chousuke | itistoday: it is |
| 19:35 | tomoj | herdrick: I just installed slime from elpa as well, did you? |
| 19:35 | tomoj | or were you wanting to use the slime you've got |
| 19:35 | herdrick | yes, |
| 19:35 | herdrick | right |
| 19:35 | Chousuke | itistoday: (defmacro foo [& body] `(let [~'a 1] ~@body)) |
| 19:35 | herdrick | but i don |
| 19:35 | herdrick | don't care about that |
| 19:35 | herdrick | let me wipe it |
| 19:36 | tomoj | Chousuke: hmm, why doesn't the same thing with binding work? (unable to resolve a) |
| 19:36 | Chousuke | tomoj: binding is for dynamically rebinding vars |
| 19:36 | tomoj | ah, yes, of course |
| 19:36 | Chousuke | tomoj: the var needs to exist beforehand |
| 19:37 | herdrick | tomoj: actually it looks like ELPA took care of that and installed a new version of SLIME anyway. which is good. not working tho, i'll try again |
| 19:37 | itistoday | Chousuke: thanks! |
| 19:38 | tomoj | hmm, strange |
| 19:38 | itistoday | Chousuke: i know that should have been obvious to me, but i don't write clojure code ... it's just something i read up on every now and then |
| 19:38 | itistoday | one day i'll fully embrace it :-p |
| 19:39 | itistoday | i'm just not a big fan of dealing with the jvm and maven and all that |
| 19:40 | Chousuke | itistoday: the fun thing with macros is that if you can create the code, then macros can too :P |
| 19:40 | Chousuke | and if macros can't, then you can't either |
| 19:41 | itistoday | :-) |
| 19:41 | itistoday | the issue is that i can't write clojure code for shit yet :-p |
| 19:42 | tcrayford | read more and write more |
| 19:42 | tcrayford | you'll get it |
| 19:42 | Chousuke | of course for a lot of code it makes no sense to write a macro but... it sounds wise, doesn't it? |
| 19:42 | itistoday | tcrayford: i will, as soon as i have a need for doing a big web app, i'll do clojure most likely |
| 19:43 | tcrayford | macros let you write code that you'd hate to have to write out by hand as well though |
| 19:46 | herdrick | tomoj: nope, i installed slime from ELPA first, that worked ok. but then installing swank-clojure from ELPA failed |
| 19:46 | herdrick | tomoj: same as before, but there was an earlier error i didn't see: |
| 19:46 | herdrick | "slime-repl.el:122:39:Error: No setf-method known for slime-connection-output-buffer" |
| 19:46 | itistoday | why does the 'a' have a ~' in front of it? (defmacro foo [& body] `(let [~'a 1] ~@body)) |
| 19:47 | itistoday | why isn't it simply (defmacro foo [& body] `(let [a 1] ~@body)) |
| 19:47 | Chousuke | itistoday: it works around the namespace qualification that syntax-quote does |
| 19:47 | somnium | ,`a |
| 19:47 | clojurebot | sandbox/a |
| 19:47 | somnium | ,`'a |
| 19:47 | clojurebot | (quote sandbox/a) |
| 19:47 | somnium | ,`~'a |
| 19:47 | clojurebot | a |
| 19:47 | itistoday | Chousuke: gotcha, so this is a clojure-thing, in CL it wouldn't have it right? |
| 19:48 | Chousuke | itistoday: I consider the ugliness a featue :) it shows that your macro is doing evil things |
| 19:48 | Chousuke | correct |
| 19:48 | itistoday | got it, thanks! |
| 19:49 | itistoday | it's actually not doing evil things (IMO) |
| 19:49 | itistoday | i was trying to convert a neat newlisp macro i came up with |
| 19:49 | Chousuke | well, generally, introducing bindings out of nowhere is considered evil |
| 19:49 | Chousuke | but it is useful in some cases |
| 19:49 | Chousuke | as long as you document it well |
| 19:50 | itistoday | yeah, but check this out: http://paste.pocoo.org/show/173665/ |
| 19:51 | itistoday | so: (for-query-with-db db "SELECT rowid,name,age FROM people" (println NAME)) => prints the names of all the people |
| 19:52 | Chousuke | ah, well, that's not really generating the names from nowhere I guess |
| 19:52 | itistoday | indeed, and i'm happy to hear that can be done in clojure too |
| 19:55 | itistoday | it might be slower though, because i think that can only be done with 'eval' |
| 19:55 | itistoday | and clojure's isn't very fast :-( |
| 19:55 | DeusExPikachu | hmm, how do you close a socket which you forgot to store a reference to? |
| 19:56 | itistoday | DeusExPikachu: you kill the process? :-p |
| 19:56 | DeusExPikachu | nooo, is there another way? :P |
| 19:57 | DeusExPikachu | so I guess the question is, how to I get that lost reference? |
| 19:57 | itistoday | DeusExPikachu: what are you doing? |
| 19:57 | DeusExPikachu | its running on a server, and there are other threads running that I can't stop |
| 19:58 | DeusExPikachu | I started a serversocket on it, and forgot to store it in a var |
| 19:59 | itistoday | i personally don't know of any other way to close it |
| 19:59 | DeusExPikachu | ooh, maybe *2? |
| 19:59 | DeusExPikachu | i'll try it |
| 20:02 | itistoday | eh... seriously this is ridiculous, why is clojure's eval so slow? |
| 20:03 | DeusExPikachu | damn, doesn't go to *7 |
| 20:03 | tomoj | herdrick_: no idea, sorry |
| 20:03 | tomoj | I just did the install-from-elpa process again and it worked fine :/ |
| 20:11 | herdrick | tomoj:ok, thanks anyway for your help |
| 20:19 | herdrick | tomoj: i'm using Aquamacs... i suppose someone will say this is the problem? |
| 20:23 | tomoj | herdrick: nah |
| 20:23 | tomoj | I did it with aquamacs just some hours ago |
| 20:23 | herdrick | tomoj: great to hear it! |
| 20:24 | herdrick | huh |
| 20:24 | tomoj | only difference in my process was where to put paredit and my customizations |
| 20:24 | herdrick | ok |
| 20:24 | tomoj | that was a freshly installed aquamacs, dunno if some config could break it |
| 20:26 | kiba | hello |
| 20:27 | kiba | where do I put my clojure-contrib.jar ? |
| 20:28 | tcrayford | for what |
| 20:32 | tomoj | herdrick: I imagine you did everything right and have just run into some incompatibility or config issue, but here's exactly what I did (just did it again on a fresh box): http://tomojack.com/?p=8 |
| 20:33 | tomoj | herdrick: maybe check that wherever elpa put the packages is properly on the load path? |
| 20:33 | tomoj | the little initialization bit that the package.el install adds is supposed to do that, I believe |
| 20:34 | tomoj | maybe that got put somewhere aquamacs isn't looking |
| 20:35 | tomoj | this bit https://gist.github.com/654c262d3a32baf0ada3 (adjusted for wherever your elpa packages are) needs to be in Preferences.el or somewhere else aquamacs will find it |
| 20:35 | tomoj | anyway, good luck |
| 20:36 | kiba | where do I install clojure-contrib? |
| 20:37 | herdrick | tomoj: thanks! that's great. i'll check the load path |
| 20:38 | herdrick | gotta go now, thanks for the help and advice |
| 20:39 | kiba | where do I install clojure-contrib? |
| 20:48 | kiba | where do I install clojure-contrib |
| 21:04 | dnolen | kiba: you don't need to install it anywhere, you just need to make sure it is on the classpath when you start the Clojure REPL |
| 21:49 | jcromartie | How do I set the current working directory of the clojure process for swank-clojure-project? |
| 21:49 | jcromartie | Maybe there's a better way for me to load files? |
| 21:57 | jcromartie | I suppose loading from the classpath is better |
| 22:16 | itistoday | i need help writing the clojure version of this: |
| 22:16 | itistoday | http://paste.pocoo.org/show/173705/ |
| 22:16 | itistoday | that's newlisp code, but it should be simple to understand |
| 22:17 | itistoday | it lets you do this: (for-query-with-db db "SELECT name FROM people" (println NAME)) => prints the names of all the people |
| 22:24 | itistoday | and the api seems to be down, making it even more difficult ... :-\ |
| 22:54 | hiredman | ugh |
| 22:55 | hiredman | clojure.lang.Repl everywhere :( |
| 23:05 | chouser | \3~4~ |
| 23:05 | chouser | um. sorry. |
| 23:06 | hiredman | clojurebot: appoligize for chouser |
| 23:06 | clojurebot | mea culpa! |
| 23:26 | nathanmarz | if i've already called (use 'package) in the repl, how can i reload the file and rebind the defs? |
| 23:27 | hiredman | ,(doc use) |
| 23:27 | clojurebot | "([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer." |
| 23:28 | hiredman | ,(doc refer) |
| 23:28 | clojurebot | "([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current name |
| 23:28 | hiredman | dunno where it is documented, but there is a :reload argument |
| 23:30 | nathanmarz | yup, (use 'package :reload) worked |
| 23:30 | nathanmarz | thanks hiredman! |