2010-07-09
| 00:06 | ysph | (car '()) |
| 00:06 | ysph | sorry guys |
| 00:58 | fuchsd | What's the idiomatic way to run a function with side effects on every element in a list? Is it to use a sequence comprehension and then doseq it? |
| 01:00 | fuchsd | err, mapping the side effect function on the sequence and then doseq'ing it? |
| 01:00 | fuchsd | (using map) |
| 01:11 | ysph | fuchsd: does for do what you want? |
| 01:11 | fuchsd | I think I'm overthinking it; map seems to do it |
| 01:11 | fuchsd | Let's just say I want to print every item in a list, |
| 01:12 | fuchsd | I'd do it like this: |
| 01:12 | cemerick | fuchsd: doseq |
| 01:12 | fuchsd | ,(dorun (map println '("one" "two" "three"))) |
| 01:13 | ysph | cemerick's suggestion is the proper one |
| 01:13 | fuchsd | Ok, cool; thanks! |
| 01:14 | ysph | as in (doseq [x '("one" "two" "three")] (println x)) |
| 01:14 | fuchsd | Perfect, that's what I'm looking for |
| 01:15 | fuchsd | Thanks |
| 01:22 | ysph | fuchsd: btw, you might want to read about the bindings and filterings provided by for ((doc for)), they are the same in doseq |
| 01:24 | fuchsd | Oh, cool |
| 01:29 | fuchsd | i |
| 01:44 | Licenser | Morning my lispy friends |
| 01:49 | hiredman | ping? |
| 01:50 | hiredman | ping? |
| 01:50 | clojurebot | PONG! |
| 01:51 | Licenser | Pong |
| 01:51 | Licenser | Greetings hiredman |
| 02:43 | vibrant | morning |
| 02:43 | Licenser | Morning vibrant |
| 02:58 | harblcat | hi all, I have a question |
| 02:59 | harblcat | I've got a lot of calls I'm making to a java class, and I can't do anything better than (do (Toolkit/init) (Toolkit/setup ...) ...) |
| 02:59 | harblcat | it there a better way? |
| 03:00 | harblcat | I tried using doto, but I can't access the static methods of the class, I guess. |
| 03:07 | Chousuke | harblcat: for static calls, not really. |
| 03:08 | harblcat | aww.. |
| 03:09 | Licenser | It Looks like a uglyish toolkit so, perhaps there is an alternAtive? |
| 03:09 | Chousuke | you could always write your own macro for repeated static calls |
| 03:11 | harblcat | jcurses is what I am using, but there are a couple of other tools with the same thing going on... |
| 03:12 | harblcat | is there a way to at least shorten 'Toolkit' to 'T' or something? (def T Toolkit)? |
| 03:12 | Licenser | Write a wrapper for the rest of us? :) |
| 03:12 | harblcat | I'm not that good yet ;) |
| 03:13 | Chousuke | harblcat: hm, not that I know |
| 03:13 | Chousuke | I don't think alias works on classes either |
| 03:13 | Chousuke | but you could try I guess. |
| 03:18 | Licenser | I always feel pain when I see a system with 16 CPUs and it isn't mine :( |
| 03:25 | LauJensen | Good morning all |
| 03:28 | Licenser | Morning laujensen |
| 03:54 | cais2002 | looks like most ppl are from europe |
| 03:54 | cais2002 | anyone else in a timezone that's already late afternoon now? |
| 03:54 | mikem | cais2002: yep |
| 03:55 | cais2002 | hehe, yeah i know |
| 03:56 | Licenser | Cais2002 many people from he us don't show up until later |
| 04:04 | LauJensen | cais2002: I am in Europe, but I think we're promoting the UGT time standard nowadays |
| 04:07 | cais2002 | laujensen: now i got it.. |
| 04:07 | Licenser | Ugt? |
| 04:07 | clojurebot | ugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html |
| 04:07 | esj | Good Mood Folkses |
| 04:08 | Licenser | Wownice |
| 04:09 | Licenser | Morning esj |
| 04:10 | LauJensen | Good morning esj |
| 04:10 | LauJensen | ,ugt |
| 04:10 | clojurebot | java.lang.Exception: Unable to resolve symbol: ugt in this context |
| 04:10 | LauJensen | clojurebot: ugt |
| 04:10 | clojurebot | ugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html |
| 04:10 | LauJensen | clojurebot is knowledgable |
| 04:11 | Licenser | Jap and it even explains things when you jvust add a ? |
| 04:13 | Licenser | Cookies? |
| 04:14 | Licenser | clojurebot: Cookies |
| 04:14 | clojurebot | Pardon? |
| 04:14 | Licenser | :( |
| 04:14 | Licenser | He does not know cookies, what a sad way to live |
| 04:18 | LauJensen | ugT? |
| 04:18 | clojurebot | ugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html |
| 04:18 | LauJensen | cool |
| 04:19 | Licenser | Yap |
| 04:20 | Licenser | So I wonder how to explain him stuff |
| 04:23 | cais2002 | ?cookies |
| 04:23 | cais2002 | cookie? |
| 04:23 | LauJensen | clojurebot: Licenser is the man who puts licenses on everything |
| 04:23 | clojurebot | Roger. |
| 04:23 | LauJensen | Licenser? |
| 04:24 | clojurebot | Licenser is the man who puts licenses on everything |
| 04:24 | cais2002 | guys, is there a way to inspect all possible methods/fields of a given var/object? |
| 04:25 | LauJensen | cais2002: C-c I |
| 04:25 | Licenser | clojurebot: Cookies *nom* *nom* *nom* |
| 04:25 | clojurebot | Titim gan éirí ort. |
| 04:26 | Licenser | Cookies? |
| 04:26 | cais2002 | Laujensen: is that some emacs syntax? |
| 04:26 | cais2002 | how do I do it in repl? |
| 04:26 | LauJensen | cais2002: Yes, of course |
| 04:26 | LauJensen | In the repl, just hold Ctrl and hit c, let go, hit shift+i |
| 04:26 | LauJensen | C-c I |
| 04:26 | LauJensen | Then you'll be prompted for an object of a class to inspect. Try "String" for instance |
| 04:26 | LauJensen | And you'll see all fields and methods |
| 04:27 | LauJensen | Only works in SLIME |
| 04:27 | LauJensen | For all other IDEs, go find your webbrowser, wait for it to start. Navigate to the adress bar, type in "google.com", then navigate to the search field, type "string javadoc", click search and wait for the result. Once you have some results, there should be a link to sun/oracle docs. There you can see the same thing |
| 04:28 | bozhidar | ;-) |
| 04:29 | Licenser | Oh come on clojure. Jt don't be boring |
| 04:30 | bozhidar | btw anyone having problems with the SLIME REPL + paredit? |
| 04:30 | bozhidar | for some reason |
| 04:30 | bozhidar | it's the only mode in which paredit |
| 04:30 | LauJensen | haha |
| 04:30 | LauJensen | bozhidar: I refer you to my latest tweet |
| 04:30 | bozhidar | doesn't work normally |
| 04:31 | bozhidar | @LauJensen? |
| 04:31 | LauJensen | Thats right |
| 04:32 | bozhidar | hehe |
| 04:32 | bozhidar | I'm actually rather fond of paredit :-) |
| 04:32 | bozhidar | except for the [] pairing and skipping |
| 04:33 | LauJensen | Yea a few people were defending it last night as well |
| 04:33 | bozhidar | that works somewhat strange |
| 04:33 | bozhidar | compared to parenthesis |
| 04:33 | bozhidar | you can also switch to autopair |
| 04:33 | bozhidar | it's a lot less intrusive |
| 04:33 | bozhidar | but it's more general purpose |
| 04:34 | bozhidar | doesn't have anything lisp related in it |
| 04:34 | LauJensen | Im fine just using Emacs |
| 04:34 | bozhidar | like navigating sexps |
| 04:36 | esj | I like that it understands sexps and I can navigate them, rather than chars or lines, i think thats smart. |
| 04:36 | dissipate | hello |
| 04:37 | dissipate | anyone here use enclojure in netbeans? |
| 04:38 | LauJensen | dissipate: I've heard of 2 guys, but they're both Americans |
| 04:39 | dissipate | LauJensen, so consensus is enclojure is bad? |
| 04:39 | zmila | i used enclojure - but during some hours only :) |
| 04:39 | LauJensen | dissipate: No I think its the most featureful of all the inefficient IDEs available |
| 04:39 | LauJensen | The guys working on it do good work |
| 04:40 | LauJensen | dissipate: but did you read this? http://bestinclass.dk/index.clj/2010/07/trail-blazing-innovators.html |
| 04:40 | dissipate | well supposedly i can't even compile because it is running out of memory. lol |
| 04:40 | LauJensen | hehe |
| 04:42 | noidi | is there something like mapcat buf for "for" (i.e. forcat)? |
| 04:42 | noidi | I seem to keep doing a lot of (apply concat (for ...)) |
| 04:43 | dissipate | so emacs is the mac daddy? |
| 04:43 | noidi | most of them (apply hash-map (apply concat (for ...))), where I build [key value] pairs in the for |
| 04:44 | Chousuke | noidi: you could just do (into {} (for ...)) |
| 04:45 | Chousuke | it'll be a fair bit faster too |
| 04:45 | noidi | Chousuke, great, thanks! |
| 04:45 | dissipate | LauJensen, i'm a noob to clojure and emacs. what's the best way to get started? |
| 04:46 | LauJensen | dissipate: http://bestinclass.dk/index.clj/2009/12/clojure-101-getting-clojure-slime-installed.html |
| 04:47 | LauJensen | As you can see thats from last december so it might be outdated. You need to get clojure-mode and swank-clojure installed. When installing them like I do in that screencast, you also get slime and slime-repl from ELPA |
| 04:47 | LauJensen | Then when you download a new project (or make one), add lein-swank as a dependency, run 'lein deps' to pull that dependencen, then 'lein swank' to start a server. From emacs, you just hit M-x slime-connect to get a repl going for that specific project. |
| 04:47 | LauJensen | Another approach, which is the one I use, is shown in that first link I dropped |
| 04:48 | Licenser | We would really need some kind of out of the box way to do that all it is tiresome :( |
| 04:49 | dissipate | sounds like i'm already in over my head! |
| 04:49 | LauJensen | dissipate: Just take it one step at the time. I've given you 2 screencasts now, watch them first |
| 04:49 | dissipate | even getting enclojure set up was a task. |
| 04:49 | LauJensen | I show you a full installation on a fresh linux box, so it shouldnt be too tricky to keep up |
| 04:49 | LauJensen | And if there are questions Im here for a few hours, so shoot away |
| 04:51 | dissipate | enclojure in netbeans is incredibly memory hoggish |
| 04:51 | dissipate | and the whole thing is a good chunk of a gigabyte to download/install. seems crazy |
| 04:51 | bobo_ | dissipate: realy? i dont find it using more then just netbeans |
| 04:52 | dissipate | bobo_, i mean netbeans actually |
| 04:52 | dissipate | i just don't understand why an IDE needs to be hundreds of megabytes... |
| 04:53 | bobo_ | well, it supports alot, just the java version is 54MB |
| 04:53 | bobo_ | javaSE that is |
| 04:54 | dissipate | LauJensen, thanks for the screen casts. i will check them out. |
| 04:54 | LauJensen | np |
| 04:55 | bobo_ | dissipate: http://freegeek.in/blog/2009/08/setting-up-emacs-clojure-with-emacs-starter-kit/ is pretty good for emacs aswell |
| 04:57 | cais2002 | what does #^"[C" mean? |
| 04:59 | Licenser | cais2002: It is a java array |
| 04:59 | LauJensen | Its an old-school type hint |
| 05:02 | cais2002 | so the new style is just ^"[C" , right? |
| 05:03 | Licenser | One thing at is bad about the current repl is that it never forgets you introduce bugs reload the namespace but the old stuff stays :( |
| 05:04 | hsarvell | Lau: Yes nice screencast, for no2 I want to see what Emacs can do when it comes to actually coding Clojure. |
| 05:08 | Licenser | Wow very strange if I just reload thie ns it woke o.o |
| 05:19 | LauJensen | hsarvell: Thanks :) |
| 05:19 | LauJensen | cais2002: yea |
| 05:20 | LauJensen | Licenser: wow, you can wake up a namespace? |
| 05:27 | dissipate | bobo_, thanks for that link. |
| 05:54 | bartj | hi all |
| 05:56 | bartj | re: formatting/style guidelines, is there any quick way to know when I need to start/"break" an expression to a new-line ? |
| 05:56 | bartj | eg: (when (="p" "np") (println "win 1M$") (println "try more")) |
| 06:04 | LauJensen | bartj: Theres a style-guide on assembla, though I dont think it covers new-lines |
| 06:04 | LauJensen | Typically, use them when they enhance readability |
| 06:04 | LauJensen | (when x |
| 06:04 | LauJensen | (do y) |
| 06:04 | LauJensen | (dy z)) |
| 06:04 | LauJensen | but not |
| 06:04 | LauJensen | (map some fn |
| 06:04 | LauJensen | some coll) |
| 06:05 | bartj | LauJensen: does the start of an expression always warranty a new line ? (that seems to be the major difference in your examples) |
| 06:08 | Chousuke | bartj: just do what looks good and is easy to read |
| 06:09 | Chousuke | adding newlines to a map invocation can help if the function/coll are formed from some complicated expression |
| 06:10 | Chousuke | with when, the usual convention is to do a linebreak after the condition, but that's not always necessary either. |
| 06:11 | Chousuke | I guess in general macros tend to have some group of parameters and then a "body" |
| 06:11 | Chousuke | and there should be a line break before the body |
| 06:13 | eevar2 | bartj whatever you do, don't do this -- http://gregslepak.posterous.com/on-lisps-readability |
| 06:13 | Chousuke | heh :P |
| 06:14 | Chousuke | I honestly don't find the C-style parens any easier |
| 06:14 | eevar2 | meh, really should rework my sentences into something legible before hitting enter |
| 06:14 | Chousuke | You still need to trace the "invisible line" up to the matching level |
| 06:15 | eevar2 | indeed. and the guy is cheating by indenting with 2x the space in his 2nd example |
| 06:15 | Chousuke | the extra indentation is what helps in the example on that page, not the paren placement |
| 06:16 | bartj | eevar2: that link is really really good! thanks!! |
| 06:16 | Chousuke | bartj: :P it's an example of what not to do |
| 06:17 | Chousuke | bartj: people will complain if you put closing parens on their own lines. that's just not done in lisp-land |
| 06:17 | Chousuke | I agree though that it's somewhat arbitrary |
| 06:18 | Chousuke | but I don't agree that suddenly going C-style would make lisp any more approachable. |
| 06:19 | scottj | I didn't read gregslepak's post bc it's too long but he places trailing paren on reduce (functions) and hashes in a way I don't think even C-style languages do |
| 06:20 | bartj | Chousuke: sometimes, its useful to know what one must not do ... |
| 06:20 | Chousuke | btw, his example of stacking C braces is perfectly readable to me :D |
| 06:20 | Chousuke | it looks pretty good actually |
| 06:21 | Chousuke | I think because the code is closer together, it's easier to see which block things belong to |
| 06:21 | Chousuke | if it's spread out, it gets longer and you need to jump up and down to confirm the block level |
| 06:22 | bobo_ | i would say the method is to long no mather what style you type it in |
| 06:23 | Chousuke | well, yeah. |
| 06:23 | Chousuke | with C and similar languages I have a habit of commenting block ends with a note telling what they are. |
| 06:23 | Chousuke | so I don't need to jump up to confirm so often |
| 06:23 | Licenser | Coooooooookies |
| 06:24 | Chousuke | it's useful in lisp too, I think |
| 06:25 | Chousuke | if your function really gets long, a comment is a good "landmark" |
| 06:25 | bartj | Chousuke: may I urge you to write a styling document for Clojure |
| 06:25 | Chousuke | kind of like a 'you are here' dot on maps :P |
| 06:27 | Chousuke | bartj: did you check out the style notes on assembla? |
| 06:29 | bartj | Chousuke: link please ? |
| 06:29 | Chousuke | http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards |
| 06:29 | Chousuke | I suppose I could write a summary of what I think is important. hmm. |
| 06:31 | bartj | Chousuke: that link unfortunately has no information on "indentation" |
| 06:32 | Chousuke | bartj: well, indentation typically is either two spaces per level, or aligned with above code (in case of function parameters) |
| 06:33 | Chousuke | but you can break any rule if you think it helps readability |
| 06:33 | Chousuke | aligning params for example may result in too deep indentation |
| 06:35 | nipra | Highlighted matching parens, forward-sexp, backward-sexp, up-list, backward-down-list, ... are some of my good friends :-P Cheers! |
| 06:36 | bartj | Chousuke: Something along the lines of: http://lxr.linux.no/linux/Documentation/CodingStyle |
| 06:45 | nipra | For comments, we should follow advice on page 41: norvig.com/luv-slides.ps |
| 07:50 | Bahman | Hi all! |
| 09:16 | Raynes | ,(letfn [(f [] (keyword (name (gensym))) #(f))] (trampoline f)) |
| 09:16 | clojurebot | Execution Timed Out |
| 09:17 | Raynes | hiredman: Is clojurebot susceptible to the same thing you broke sexpbot with last night? |
| 09:20 | defn | ,(ns-publics 'clojure.core) |
| 09:20 | clojurebot | {sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, chunked-seq? #'clojure.core/chunked-seq?, find-protocol-impl #'clojure.core/find-protocol-impl, vector-of #'clojure.core/vector-of, object-array #'clojure.core/object-array, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, lis |
| 09:20 | defn | cool, hiredman finally fixed it, deleted my issue on github, never replied to me, never acknowledged there was a problem, but fixed it |
| 09:23 | Raynes | The issue is dead, all hail the issue. |
| 09:26 | defn | ,(letfn [(f [] (symbol (name (gensym))) #(f))] (trampoline f)) |
| 09:26 | clojurebot | Execution Timed Out |
| 09:28 | defn | Raynes: you could build a little timer with atoms |
| 09:28 | defn | maybe? |
| 09:28 | Raynes | Hrm? |
| 10:07 | cemerick | fogus_: any thoughts on the scala 2.8 pain being aired on the interwebs? |
| 10:18 | fogus_ | cemerick: There is a reason that we're still on 2.7.2 |
| 10:18 | chouser | "we"? |
| 10:18 | cemerick | fogus_: I've heard from three others via twitter to the same effect. |
| 10:19 | cemerick | is it your codebase that needs porting, or critical libs, or both? |
| 10:20 | fogus_ | cemerick: I mean my project team (but really just me) |
| 10:21 | fogus_ | cemerick: Just our codebase. I use Scala to pull together some Java libs. We do not use any other Scala save for Scala itself |
| 10:23 | fogus_ | moving from 2.7.2 to 2.7.3 was less than stellar. From 2.7.2 to 2.8 is a nightmare |
| 10:24 | cemerick | I'm mostly confused as to why it's not just called 3.0. There was some mention of it being "too late to change" the version number, but that seems really odd. |
| 10:24 | cemerick | I mean, as soon as the breaking change became evident, wasn't twiddling the pom an easy, self-evident fix? |
| 10:24 | fogus_ | I'm not sure either. The changes are pretty extensive and entirely pervasive |
| 10:24 | cemerick | (Says the bystander, in hindsight.) |
| 10:25 | fogus_ | cemerick: Every change is a breaking change |
| 10:25 | fogus_ | always |
| 10:26 | fogus_ | It's kinda sad because I pitched Scala to my group and it's kinda going the wrong way (IMO) since they bought off on it |
| 10:27 | fogus_ | "though #^ is just deprecated at this point – no breaking changes" LOL |
| 10:28 | fogus_ | cemerick: I get the impression that Stephan Schmidt thinks ^String is something more than it is |
| 10:29 | cemerick | fogus_: mmm, probably. Though, as I was telling chouser a few weeks ago, I'd like to see hints become more than just advice. |
| 10:30 | cemerick | He reminded me of this http://bit.ly/d84RO9 which was one of the more fun macros I've ever done. I do continue to like that style. |
| 10:30 | bobo_ | hm, is it the same way in clojure btw, if you compile with one version of clojure you cant use the library in another version of clojure? |
| 10:31 | fogus_ | As do I. Although, I wouldn't base my language choice on s^String, s:String, String:s, or ^String s |
| 10:32 | cemerick | bobo_: The language and libraries have remained remarkably stable, so something written for 1.1 or 1.0 will almost surely work in 1.2, etc. |
| 10:32 | cemerick | AOT-compiled classfiles *will* break if you build against 1.1 and try to run against 1.2 though, which is unfortunate. |
| 10:33 | bobo_ | ok, so the bytecode thing is same in other words? |
| 10:33 | cemerick | The solution there is to either just recompile (no source changes needed), or ship source instead of classfiles if you can. |
| 10:33 | cemerick | It's fair to say clojure is source-compatible from 1.1 to 1.2, but not binary compatible. |
| 10:35 | cemerick | The amount of squawking about 2.8 is remarkable though. Some indication of how large the base of users is. |
| 10:35 | cemerick | I wonder how much of it will be taken by more timid folks as unacceptable levels of FUD. |
| 10:36 | fogus_ | cemerick: I missed that thread originally... [b:String [c:Double :as list:java.util.List] {d:java.util.Random :d}] is surprisingly clean! |
| 10:39 | fogus_ | While it stinks that 2.8 breaks my work code, I'm more bitter that it breaks my BASIC DSL :p |
| 10:39 | cemerick | damn, not FORTRAN? |
| 10:40 | rfg | FORTRAN favours the brave. |
| 10:43 | yacin | with clojure.contrib.logging/with-logs, what should i be using as the "log-ns" argument? |
| 10:44 | yacin | i thought *ns* was bound to the current active namespace, so i was using that |
| 10:44 | yacin | but it prints "clojure.contrib.logging$fn__168$impl_write_BANG___176 invoke" which isn't particularly useful/helpful |
| 11:19 | gilescb | does anyone know which is the "trunk" congomongo? since somnium doesn't appear to be incorporating pulls? |
| 11:21 | gilescb | or does chaos reign supreme? |
| 11:30 | bigwavejake | i have a lazyseq. i need to force it to return all the results. how do i do it? |
| 11:30 | eckroth | (doseq myseq) ? |
| 11:30 | dnolen_ | bigwavejake: doall |
| 11:30 | dnolen_ | (doall (map inc [1 2 3 4])) |
| 11:30 | eckroth | dnolen_: can you describe the differences (in practice)? |
| 11:30 | dnolen_ | ,(doall (map inc [1 2 3 4])) |
| 11:30 | clojurebot | (2 3 4 5) |
| 11:31 | dnolen_ | eckroth: what do you mean? |
| 11:31 | eckroth | dnolen_: between doseq and doall |
| 11:31 | dnolen_ | ,(doseq [x (map inc [1 2 3 4])] x) |
| 11:31 | clojurebot | nil |
| 11:31 | bigwavejake | dnolen_: thanks! |
| 11:32 | dnolen_ | eckroth: doseq returns nil, it's for sideeffects |
| 11:44 | eckroth | dnolen_: oh wow, that's straightforward! thanks. |
| 12:41 | yesudeep | Can the recur form occur any number of times within the definition of a function? |
| 12:41 | chouser | yes, but only in tail positions |
| 12:42 | yesudeep | alright chouser. thank you. :-) |
| 12:44 | yesudeep | chouser: Does clojure barf with an error if the programmer mistakenly uses recur in a non-tail position? |
| 12:44 | yesudeep | I should probably try that out. |
| 12:45 | tomoj | ,(fn [] (inc (recur))) |
| 12:45 | clojurebot | java.lang.UnsupportedOperationException: Can only recur from tail position |
| 12:46 | yesudeep | hmmm.. nice tomoj. |
| 12:51 | eckroth | can I provide a method in defrecord without referring to any protocols? ie. can I make record methods without first defining a protocol? |
| 12:54 | Chousuke | eckroth: you can implement interfaces, but if you mean to ask whether it's possible to create new methods, then I don't think so. |
| 12:56 | eckroth | Chousuke: I think you're right; if I don't refer to a protocol, I get an unrelated error; if I refer to a protocol but make a method not in the protocol, I'm told I can't create new methods |
| 13:06 | lpetit | Hi, emacs users :-) |
| 13:07 | lpetit | I'm sick of my current logitech keyboard. After all those years, starting to feel the pain out of my wrists |
| 13:08 | lpetit | With so heavy use of the Control, Shift (and Alt ?) key in emacs, how do you manage not get hurt ? Is there a dirty secret concerning how to hit those keys ? Or do you all use special keyboards ? |
| 13:08 | lpetit | Or do I need to buy two new arms ? :-) |
| 13:09 | eckroth | lpetit: I find "mousing around" the worst for my right wrist; using Emacs is much better for me. Perhaps an alternative for you is Vi-like keybindings? |
| 13:10 | fogus_ | lpetit: You need one of these: http://world.std.com/~jdostale/kbd/SpaceCadet1.jpeg |
| 13:12 | lpetit | fogus_: hey, I'm not *that* old ! :) |
| 13:12 | maravillas | i like the thumbs up and down keys...very roman emperor |
| 13:14 | shadowspar | http://kinesis-ergo.com/contoured.htm |
| 13:16 | shadowspar | I don't use emacs, but I've used that ^^ kbd for 5 years, and it's made a huge difference for me |
| 13:16 | lpetit | eckroth: oh ? My right wrist doesn't suffer from mousing around: my arm rotates over my elbow, and the movements of the wrist while "mousing around" are small. No, it's really my left little finger, when reaching the Ctrl key which is the problem |
| 13:16 | shadowspar | the kinesis ones put all the modifier keys (except Shift) into the thumbwells, which might help |
| 13:17 | lpetit | shadowspar: now this looks really like star trek material. I like it ! |
| 13:17 | eckroth | lpetit: I understand the Ctrl key issue; however, I've been using Thinkpads all my life and I love the "trackpoint", but it's not good for my wrist; I also have terrible chair/desk pairings so my wrist is always bent when using the mouse :( |
| 13:19 | shadowspar | lpetit: it's not too bad to learn to type on since all the letter/number keys are in the same spot |
| 13:19 | shadowspar | a lot of ppl like them, but it's not the end-all and be-all of ergo keyboards by any means. there's a lot of stuff out there =) |
| 13:21 | cemerick | HYPER-SUPER-META-CONTROL....ASSEMBLE! |
| 13:21 | lpetit | I guess I'll have to find a local store where I can try them, so |
| 13:21 | cemerick | lpetit: the standard apple keyboards are very, very nice IMO. Very short key travel, which is key for me. |
| 13:24 | lpetit | cemerick: doesn't very short key travel mean the hands are even closer than with normal keyboards, and the elbows having a greater angle ? |
| 13:25 | cemerick | lpetit: no, key travel refers to the height of the key caps. The shorter the key travel, the less effort you need to expend in order to register a keypress. |
| 13:26 | lpetit | cemerick: ok. Must leave work and go home. Thanks for the input, alls |
| 13:26 | lpetit | bye |
| 13:28 | nickik | Can somebody help me with a problem setting up webdevelopment? |
| 13:29 | nickik | I made a new project with line and added compojure to the deps |
| 13:31 | nickik | then i downloaded everything with lein deps |
| 13:34 | yacin | if i want to serialize a java object with print-dup, but all the information isn't in the constructor, can i do something like: |
| 13:35 | yacin | #=(.add (java.util.ArrayList.) 4) |
| 13:35 | yacin | ? |
| 13:35 | yacin | or does read-string not understand arbitrary clojure exprs? |
| 13:37 | cemerick | yacin: I think that'd work, though you'd want #=(doto (ArrayList.) (.add 4)) |
| 13:38 | defn | clojurebot is nowhere close to SKYNET when compared to this: http://techcrunch.com/2010/07/08/anybots-arrington-robot/ |
| 13:38 | yacin | hmm, it doesn't seem to evaluate the expression |
| 13:38 | yacin | (clojure.core/let [G__14535 (java.util.ArrayList.)] (.add G__14535 4) G__14535) |
| 13:38 | defn | yacin: um yeah, that would just read everything you typed in |
| 13:39 | defn | so it couldnt stop naughty things from happening |
| 13:39 | defn | you could arbitrarily execute code on the server |
| 13:39 | yacin | i realize the implications of something like this |
| 13:39 | yacin | but i want to do it anyway |
| 13:39 | defn | you just did...at your own REPL |
| 13:40 | cemerick | yacin: read doesn't evaluate anything, eval does |
| 13:41 | defn | yacin: im sorry i missed what you were trying to do there |
| 13:41 | yacin | i don't understand why #=(java.util.ArrayList.) returns an instance then, instead of just the expression |
| 13:41 | defn | i thought you were trying to do: |
| 13:41 | yacin | no worries |
| 13:41 | defn | ,#=(java.util.ArrayList.) |
| 13:41 | clojurebot | EvalReader not allowed when *read-eval* is false. |
| 13:41 | defn | to the bot |
| 13:41 | yacin | no, i have a java class that doesn't have all the necessary information in its constructor |
| 13:41 | qbg | Why is EvalReader so restricted? |
| 13:41 | yacin | so i need to create it, and run some methods to add the extra data |
| 13:41 | yacin | in order to make a suitable print-dup for it |
| 13:42 | yacin | if that makes sense |
| 13:43 | yacin | it seems to eval when the form is just a constructor, but not when it's wrapped with doto, which i would like |
| 13:45 | ohpauleez | What does #= do? |
| 13:45 | cemerick | it's part of an undocumented, unsupported serialization framework |
| 13:46 | ohpauleez | ahh, gotcha |
| 13:46 | chouser | unsupported? |
| 13:46 | cemerick | last I heard on that topic was "it'll change, don't depend on it continuing to be there"? |
| 13:47 | chouser | oh, interesting. |
| 13:47 | yacin | so, is what i'm trying to do possible? |
| 13:47 | ohpauleez | Also, a quick clojure in commercial apps update |
| 13:47 | yacin | otherwise, i'll have to parse everything, which won't be fun =\ |
| 13:48 | ohpauleez | I know of one instance where clojure will probably be used in a large, commercial, video game |
| 13:50 | chouser | yacin: #=(eval (doto (java.util.ArrayList.) (.add 4))) |
| 13:50 | chouser | but don't tell anyone I told you that, and I'm by no means recommending it |
| 13:50 | yacin | yeah, i just tried it myself |
| 13:51 | chouser | you might do better to create a class with a static method to create ArrayLists |
| 13:51 | cemerick | a binary print/read is way more sane in any case |
| 13:52 | yacin | chouser: yeah, i might go ahead and do that instead |
| 13:52 | cemerick | Just a stable fn in a namespace will do |
| 13:52 | yacin | i just need to get it done fast right now |
| 13:52 | cemerick | chouser: the only way to go when you've got a mix of clojure and java bits |
| 13:52 | cemerick | Plus, legible print/read is godawful slow. |
| 13:57 | chouser | oh, indeed. a function rather than a static method |
| 13:58 | chouser | I can never remember what exactly #=() supports |
| 13:58 | chouser | cemerick: optimize first! debug later! :-) |
| 13:59 | cemerick | chouser: I prefer to do both. :-) |
| 13:59 | cemerick | print/read is simply too slow for many, many things, of course |
| 14:00 | slyrus | stupid mutable (?) vector question: if I have '((1 "foo") (2 "bar") (4 "moose")) and I want ["foo" "bar" nil "moose"] from that, is there an easy way to do that? |
| 14:00 | chouser | why nil? |
| 14:01 | chouser | oh, I see. |
| 14:03 | qbg | slyrus: It would be rather easy to write such a function |
| 14:04 | slyrus | why, trivial: (loop ... for x in '... do (setf (aref ...)) :) |
| 14:04 | slyrus | i mean, yeah, trivial |
| 14:04 | slyrus | in common lisp... for me anyway |
| 14:04 | qbg | Find the size of the vector to create, and then use reduce |
| 14:07 | cemerick | I just feel dirty now: https://gist.github.com/1d7cdc705e6b71721207 |
| 14:08 | chouser | ,(reduce (fn [v [i x]] (conj (reduce (fn [v _] (conj v nil)) v (range (- i (count v) 1))) x)) [] '((1 "foo") (2 "bar") (4 "moose"))) |
| 14:08 | clojurebot | ["foo" "bar" nil "moose"] |
| 14:08 | chouser | I'm sure there's a better way |
| 14:08 | slyrus | thanks chouser |
| 14:08 | chouser | that assumes keys are in order |
| 14:08 | qbg | My method: http://gist.github.com/469794 |
| 14:10 | chouser | qbg's handles out-of-order keys |
| 14:10 | slyrus | cool. I guess there's no vector-push-extend in this language :) |
| 14:10 | chouser | though I think it's O(n log n) instead of O(n) |
| 14:11 | qbg | If log_32(n) is small enough, then that log n should be small enough |
| 14:11 | slyrus | I was trying to use an atom and swap! and not getting anywhere |
| 14:11 | ohpauleez | Is there a reason why you both used (fn ..) and not #()? |
| 14:12 | chouser | different reasons |
| 14:12 | chouser | well, we both used it once for destructuring the key/value pairs |
| 14:12 | chouser | I used it a second time because I was ignoring the second arg |
| 14:12 | ohpauleez | ahhh right, cool |
| 14:13 | chouser | should have used repeat nil like qbg did instead. :-) |
| 14:17 | qbg | Learning Clojure shouldn't be too hard if you come from CL |
| 14:21 | chouser | cemerick: you made a magic auto-generated function! |
| 14:21 | slyrus | qbg: it seems to be two things: learning the differences (how CL concepts map onto clojure) and breaking old/bad habits |
| 14:21 | cemerick | chouser: dirty, filthy, ashamed. |
| 14:21 | cemerick | However, I've got a 14-slot record, and it's not going to get any smaller. :-/ |
| 14:22 | qbg | slyrus: It also helps a lot if you used SLIME with CL |
| 14:23 | slyrus | qbg: is there any other way? :) |
| 14:23 | slyrus | speaking of slime... how do I tell an emacs buffer that I want to switch slime connections? |
| 14:24 | slyrus | ah, slime-cycle-connections |
| 14:27 | laz0r | can anyone help me setting up swank-clojure with elpa? I seem to have the problem that elpa installed the wrong clojure version (1.1.0, I think I need 1.2.1) |
| 14:29 | slyrus | learning clojure is a mixed bag for me... part "man, this would be really trivial in common lisp" and part "oh, that's really nice!". the latest example of the latter is (map :my-keyword ...) that's much nicer than cl's alist/plist/etc... cruft |
| 14:29 | technomancy | laz0r: you don't need swank-clojure from elpa; just get clojure-mode and slime-repl and follow the instructions in the http://github.com/technomancy/swank-clojure readme |
| 14:29 | technomancy | heh; plists... =) |
| 14:32 | laz0r | technomancy: I tried already before trying to install with elpa, but found that readme a bit confusing |
| 14:33 | laz0r | I did however get lein to work, and 'lein deps' did install clojure-1.2.0 in the lib/ subdirectory of swank-clojure |
| 14:34 | laz0r | is that what I am supposed to do? |
| 14:34 | qbg | laz0r: You create a project and add swank-clojure as a dev-dependency |
| 14:35 | qbg | Then after running 'lein deps', you should be able to run 'lein swank' and connect to the project with SLIME |
| 14:38 | anonymouse89 | any swarmiji users? |
| 14:38 | technomancy | anonymouse89: I think there is only one user of swarmiji |
| 14:38 | anonymouse89 | :( |
| 14:40 | laz0r | qbg: ok, so I create a dummy project which just consists of a project.clj file, in which I put that just one line like: ":dev-dependencies [[swank-clojure "1.2.1"]] |
| 14:40 | laz0r | and then I run 'lein deps'? |
| 14:40 | qbg | You create the project with 'lein new <project name>' |
| 14:41 | anonymouse89 | In that case, my application is very cpu-intensive and currently uses agents to get full utilization on all local cores. I'm looking to span multiple boxes. |
| 14:41 | qbg | And yes, after adding that line, run 'lein deps' |
| 14:41 | anonymouse89 | I'm a bit clueless about the simplest way to do this |
| 14:44 | slyrus | qbg: this seems to work for me: http://gist.github.com/469794 |
| 14:44 | slyrus | and thanks for your help! |
| 14:47 | qbg | slyrus: Note the following: |
| 14:47 | qbg | ,(assoc [nil] 5 "hello") |
| 14:47 | clojurebot | java.lang.IndexOutOfBoundsException |
| 14:47 | qbg | But: |
| 14:47 | qbg | ,(assoc [nil] 1 "hello") |
| 14:47 | clojurebot | [nil "hello"] |
| 14:50 | laz0r | qbg: ok, lein deps did install swank-clojure-1.2.1, but it is now in a subdirectory of my dummy project |
| 14:51 | qbg | Yes, 'lein deps' will put all of the dependencies into libs/ |
| 14:51 | laz0r | can I somehow replace the swank-clojure-1.1.0 file in ~/.swank-clojure to make emacs use 1.2.1 automaticly? |
| 14:51 | qbg | Yes, just replace it :) |
| 14:51 | laz0r | ah, ok |
| 14:52 | qbg | Though it should only ever use that swank-clojure if you use 'M-x slime' |
| 14:52 | laz0r | thats exactly what I want it to do |
| 14:53 | qbg | I just have a symlink to the jar in my clone of the swank-clojure repo |
| 14:53 | laz0r | I wanted to play around with clojure, I had an old installation and thought 'oh well, I might as well upgrade it first' |
| 14:59 | laz0r | mh, now slime does not start anymore |
| 14:59 | laz0r | Searching for program: no such file or directory, lisp |
| 14:59 | laz0r | I installed it with elpa, so I assume it should work |
| 15:01 | qbg | Sounds like something happened to what is in your .emacs |
| 15:02 | qbg | You could fix that, or use swank-clojure from a project |
| 15:02 | qbg | (2nd option is likely much easier) |
| 15:14 | threepwood | can i say (re-find (re-matcher #"foo" "foobar")) more concisely? re-matches only does a complete match. |
| 15:16 | qbg | ,(first (re-seq #"foo" "foobar")) |
| 15:16 | clojurebot | "foo" |
| 15:16 | qbg | ? |
| 15:16 | ataggart | ,(re-find #"foo" "foobar") |
| 15:16 | clojurebot | "foo" |
| 15:19 | threepwood | thanks |
| 15:31 | slyrus | qbg: I see. interesting behavior there. http://gist.github.com/469794 should be more robust then. |
| 15:32 | laz0r | qgb: you are right, it is a lot easier like that |
| 15:32 | laz0r | oops, qbg i mean |
| 15:33 | laz0r | still, I wonder whats wrong with my config... maybe I will find out |
| 15:33 | qbg | laz0r: Did you remove elpa or something like that? |
| 15:34 | laz0r | it is removed right now yes, but I was just trying around to find out whats wrong |
| 15:35 | laz0r | I just saw that it is complaining about a version mismatch |
| 15:35 | laz0r | but only after I installed that latest slime to try that out |
| 15:35 | qbg | Ignore the version mismatch |
| 15:36 | laz0r | I think a solution would be to set the inferior-lisp-program to execute clojure |
| 15:43 | ericthorsen | I have some code that uses genclass and has a dependency build order problem...I'm now using the maven plugin and cannot get past this. |
| 15:44 | ericthorsen | What is the current recipe for this? Declaring the namespaces using the compileDeclaredNamespaceOnly does not seem to work (I read that somewhere) |
| 15:47 | cemerick | ericthorsen: what does your dependency DAG look like? |
| 15:48 | ericthorsen | Very simple, no cycles...A depends on B both are genclass java classes. A instantiates a B so during AOT it is looking for the class file |
| 15:48 | cemerick | ericthorsen: Add a (:require B) to A |
| 15:49 | cemerick | ericthorsen: ... *before* the relevant import! :-) |
| 15:51 | ericthorsen | cemerick: you rock!!! Thank you |
| 15:52 | cemerick | yes, yes I do ;-) |
| 15:52 | cemerick | np |
| 15:52 | cemerick | ericthorsen: how's the enclojure-ing going? |
| 15:52 | cemerick | I haven't upgraded to 6.8 yet. |
| 15:52 | ericthorsen | cemerick: Very good...I have a mate from sun helping out...we are skying every other week |
| 15:53 | cemerick | nice |
| 15:53 | cemerick | I saw the assembla invite with a sun.com email, thought something might be up |
| 15:54 | ericthorsen | cemerick: I'm testing going back to multiple modules again in hopes to simplify contributions....in the past classloader hell...but I'm hoping for better luck now. Should know before the end of the weekend |
| 15:54 | cemerick | sounds good |
| 15:55 | ericthorsen | cemerick: I think if we can get some of minor but time consuming irritants out of the way...we can make it much easier for people to contribute there |
| 15:55 | bulters | g'day all... |
| 15:56 | cemerick | ericthorsen: yeah; not sure if you noticed, but I'm going to be trying my hand at getting ccw to use the enclojure repl server |
| 16:07 | bigwavejake | I have to pass a seq to a variadic Java method with the following signature: process(Map<String,Object> attributes, String... processingComponentIdsOrClassNames) |
| 16:07 | bigwavejake | How do I pass the seq of Strings? |
| 16:08 | bigwavejake | (.process my-obj attributes ["Class1"]) doesn't work |
| 16:18 | TakeV | Is it possible to use Clojure with a scripting language? |
| 16:25 | dakrone | TakeV: how so? do you mean calling a scripting language from Clojure? |
| 16:26 | dakrone | I've had some success calling ruby via Java's ScriptingEngineManager |
| 16:26 | dakrone | same with javascript |
| 16:26 | bigwavejake | I found an answer for pushing Clojure seqs into a variadic Java method: pass them like this: (into-array ["Class1"]) |
| 16:27 | TakeV | dakrone: Yeah, that's exactly what I mean. Looking into JavaScript or Groovy right now. |
| 16:29 | dakrone | TakeV: here's a good article I used as a reference for some of the work I was doing: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/ |
| 16:29 | TakeV | Thank you. |
| 17:24 | ohpauleez | anyone in here use moustache a lot? |
| 17:29 | Raynes | ohpauleez: Doesn't qualify as "a lot", but I used it in tryclojure. |
| 17:30 | ohpauleez | Raynes: Is there a way to get this to work without using a Ring Handler style function... ["index" names] {:get (fn-returns-str names)} |
| 17:30 | ohpauleez | that you know of |
| 17:31 | ohpauleez | I haven't looked at what is really happening in the code yet, so if you don't know off the top of your head, that's totally cool |
| 17:32 | Raynes | No clue. |
| 17:32 | ohpauleez | cool, thanks anyway though! |
| 17:42 | Raynes | ohpauleez: Couldn't you wrap that in a function? |
| 17:42 | Raynes | ohpauleez: Just came to me that that might work. |
| 17:42 | ohpauleez | that's what i just did |
| 17:43 | Raynes | Dunno why I didn't think of that at first. |
| 17:43 | Raynes | :p |
| 17:43 | ohpauleez | I originally avoided it for readability of the routing table |
| 17:43 | ohpauleez | but it's not so bad |
| 17:44 | arohner | maven accepting invalid checksums into the central repository is one of the most idiotic things I've ever heard |
| 17:44 | arohner | seriously, wtf maven? |
| 17:45 | arohner | and serving checksum files that can be read by maven 2.1, but not maven 2.0 (lein uses maven 2.0) |
| 17:58 | technomancy | maven 2.1 has a bug that hangs the JVM that they don't seem to be in any hurry to fix =( |
| 17:58 | arohner | technomancy: ouch |
| 17:59 | arohner | does 2.2.1 have any crazy bugs? |
| 18:11 | lancepantz | does anyone have an example of using log4j with clojure.contrib.logging? |
| 18:24 | arohner | lancepantz: http://gist.github.com/470168 |
| 18:24 | lancepantz | thanks! |
| 18:30 | arohner | lancepantz: that's also using commons-logging btw |
| 18:30 | arohner | nm |
| 18:34 | lancepantz | arohner: i was actually looking for an example with clojure.contrib.logging |
| 18:35 | arohner | lancepantz: oh, sorry. reading FTW |
| 18:35 | lancepantz | :) |
| 18:36 | timcharper | Would I make richhickey cry if I used metadata as a memoize cache bucket ? |
| 18:37 | Raynes | timcharper: Dunno. Ask him, he's right over there. :p |
| 18:38 | timcharper | rhickey: would it make you cry if I used metadata as a momoize cache for fetching associated records from a database ? |
| 18:38 | timcharper | hahah.. ^momoize^memoize |
| 18:41 | lancepantz | timcharper: i believe thats essentially what lancet does if you call a task twice |
| 18:46 | timcharper | is that considered an abuse of meta-data ? |
| 18:46 | timcharper | (looking at lancet now) |
| 20:25 | dnolen | anybody have luck getting the mysql connector from jarvana ? |
| 20:31 | ecret | can someone offer some tips on integrating clojure code inside a java project? I realize I could treat the java stuff as a jar and override classes but is there maybe some other ways? |
| 20:32 | ecret | i have a large java codebase, that is down to one jar. I would like to start new changes in clojure inside it and am curious for tips. I know clojure and java, perhaps its a vm question? |
| 20:36 | Lajla | ecret, I love you, hug me like you'd hug the Microsoft Chief Software Architect. |
| 20:37 | ecret | Lajla, my last job I had to start putting .net controls inside a win32 application |
| 20:37 | ecret | so i would not hug him |
| 20:37 | ecret | i realize its a poor question. i was hoping maybe there was a magical way |
| 20:39 | Lajla | ecret, I atually know crap about clojure, all people here hate me, I'm just here to talk Finnish. |
| 20:39 | Lajla | Of which I also know crap. |
| 20:39 | Lajla | Sorry man. |
| 20:39 | Lajla | But I stil love you. |
| 20:42 | wdouglas | I'm having an issue getting swank-clojure to show stacktrace of locals in the repl, I'm using 1.1 with swank clojure 1.2.1 just trying with a simple let and swank.core/break |
| 20:43 | technomancy | wdouglas: local inspection requires clojure 1.2 |
| 20:43 | wdouglas | technomancy: thank you sir |
| 20:50 | technomancy | np |
| 20:50 | dysinger | I'm looking to hire some clojure devs - if anyone's wanting work |
| 20:58 | technomancy | yeah, come work for dysinger and enjoy working from environments like http://www.flickr.com/photos/technomancy/3797798785/ and http://twitpic.com/23bgqb =) |
| 20:59 | dysinger | or my version http://www.hoopgirl.com/blog/kauai.jpg |
| 20:59 | dysinger | (not my photo but close) |
| 20:59 | dysinger | :) |
| 21:00 | dysinger | too bad we didn't get any beach computing photos from May |
| 21:01 | technomancy | dysinger: http://www.flickr.com/photos/technomancy/4673178238/ |
| 21:05 | scottj | are there docs for what to do to replace dependency foo with your own foo when both projects use lein? |
| 21:06 | technomancy | scottj: yeah, change the group-id to org.clojars.$USER and publish to clojars |
| 21:06 | technomancy | assuming you can't get your changes accepted upstream for some reason. (but you should try really really hard to do so) |
| 21:07 | scottj | well I'm thinking for developing the changes and testing them out in the first place |
| 21:07 | technomancy | oh sure. if you don't need to share across a team you can just do lein install instead of pushing to clojars. |
| 21:08 | technomancy | or use checkout dependencies |
| 21:32 | bulters | anyone here aware of a manual on how to set up emacs/clojure-swank? |
| 21:34 | hiredman | clojurebot: emacs? |
| 21:34 | clojurebot | emacs is an out-moded belief system |
| 21:34 | hiredman | clojurebot: clojure-mode? |
| 21:34 | clojurebot | clojure-mode is an Emacs mode for Clojure, found at git://github.com/jochu/clojure-mode.git |
| 21:34 | hiredman | clojurebot: slime? |
| 21:34 | clojurebot | slime-install is an automated elisp install script at http://github.com/technomancy/emacs-starter-kit/blob/2b7678e9a331d243bf32cd8b591f826739dad2d9/starter-kit-lisp.el#-72 |
| 21:34 | hiredman | hmmm |
| 22:04 | mudge | hello |
| 22:10 | mudge | i know that if you want to compile clj files to .class files you can use the compile function, like so: (compile 'namespace) but what if you want to compile all the clj files in a whole directory? |
| 22:10 | dnolen | Database for a Concurrent World, http://dosync.posterous.com/22516635 |
| 22:10 | dnolen | s/Database/Databases |
| 22:15 | lancepantz | mudge: you have to do it yourself |
| 22:16 | lancepantz | mudge: you can use read-file-ns-decl and find-clojure-sources-in-dir from clojure.contrib.find-namespaces |
| 22:17 | lancepantz | then a doseq, and viola |
| 22:17 | mudge | lancepantz: oh, i see, neato |
| 22:18 | lancepantz | i believe that currently if you compile a ns, it will transitively compile all refered to nses |
| 22:18 | lancepantz | but i think that is changing, there was a discussion about it on assembla the past week or so |
| 22:19 | mudge | hmm, but actually I'm compiling from ant like so: <java classname="clojure.lang.Compile" fork="true" failonerror="true"> |
| 22:19 | mudge | Ant |
| 22:22 | lancepantz | that's going to be a little tricky, i'm not an expert there |
| 22:22 | lancepantz | i'm not familier with using the Java task to call clojure |
| 22:23 | mudge | k |
| 22:25 | mudge | i have a different question |
| 22:25 | mudge | lets say that you have a clojure file with some code in it and you want to use a function in a different clojure file, how do you do that? |
| 22:26 | chouser | "some code" but not a lib with its own namespace |
| 22:26 | qbg | mudge: Have the first file correspond to a namespace and then use or require it from the other namespace |
| 22:26 | mudge | okay, cool |
| 22:27 | mudge | do all clojure files have a namespace declared at the top? |
| 22:27 | mudge | can namespaces span multiple files? |
| 22:27 | mudge | just want to know how things are done |
| 22:27 | lancepantz | they do not all have an ns, but its very good practice to do so |
| 22:27 | qbg | Usually you have one file per namespace |
| 22:27 | mudge | oh okay |
| 22:28 | qbg | Though exceptions are made for huge namespaces |
| 22:28 | mudge | how would a namespace span more than one file? |
| 22:29 | qbg | The way clojure.core does it is that the main file loads the other files at some point |
| 22:29 | mudge | yea, that makes sense |
| 22:29 | mudge | like an "include" in C ? |
| 22:30 | mudge | read in other files to make a big file? |
| 22:30 | lancepantz | mudge: there is a function, load-file |
| 22:31 | qbg | and there is also load |
| 22:31 | mudge | okay |
| 22:31 | qbg | It is sort of like include from C, but it is just another function call in the file |
| 22:32 | mudge | i get it |
| 22:51 | absalom | Are there really clojure jobs that allow one to program in environments like the ones linked earlier? |
| 22:51 | absalom | I've been programming professionally in CL for a long time, but usually in secret. |
| 22:55 | mudge | wowsers, I just figured out that to have compiled clojure code to .class files I don't have to compile every namespace and use gen-class for every namespace |
| 22:55 | mudge | i can just use gen-class and compile a single clojure file --- and everything that clojure file requires or uses will automatically be compiled to .class too! |
| 22:55 | mudge | this makes me happy |
| 22:58 | mudge | so I'm thinking that you don't want to write clojure in a java way, you just want to be able to interoperate with java |
| 22:58 | mudge | would everyone agree with me? |
| 22:59 | hiredman | is that something in dispute? |
| 23:02 | mudge | no, it's just that I'm writing a module for an existing java application, and I found myself writing clojure code as if it was java ---- writing new namespaces and treating them like classes by writing methods |
| 23:02 | mudge | instead of using a namespace to organize functions |
| 23:02 | mudge | and implementing interfaces with my namespaces, and extending my namespaces etc. |
| 23:03 | mudge | instead of all that, i could just use namespaces to organize my functions, and use proxy if I need extra functionality in existing java classes |
| 23:04 | mudge | i'm figuring out what my coding style should be in clojure |
| 23:04 | mudge | anybody have any good tips on coding style in clojure, specifically structure of programs |
| 23:05 | mudge | i'm wondering what's good ways to structure programs in clojure |
| 23:05 | hiredman | functions in namespaces |
| 23:05 | mudge | maybe writing one main file, and writing libraries of functions for that one main file to use |
| 23:06 | mudge | hiredman, yes, so functions in namespaces to be used as libraries, right? what do you do to structure the main flow of your program? |
| 23:07 | mudge | use one namespace for that? and that namespace then just uses other namespaces as libraries of functions? |
| 23:08 | hiredman | mudge: depends on what kind of program you are writing and how it interacts |
| 23:09 | mudge | well how do you do things hiredman? |
| 23:09 | mudge | how have you done things? |
| 23:09 | hiredman | ~source |
| 23:09 | clojurebot | source is http://github.com/hiredman/clojurebot/tree/master |
| 23:09 | hiredman | it ain't super but it's something |
| 23:09 | mudge | okay |
| 23:11 | hiredman | generally stuff can be divided pretty cleanly between namespaces |
| 23:12 | hiredman | but really I don't think any of my personal projects has gotten large enough for it to be a huge concern |
| 23:12 | hiredman | I certainly didn't spend time thinking about what namespaces functions should go in while writing clojurebot |
| 23:12 | mudge | okay |
| 23:13 | mudge | by the way, i know there would be problems with clojure bot using "def" or "defn" but it sure would be cool to be able to do that with clojure bot |
| 23:13 | aria42 | Anyone know in Slime how to send a form to the REPL rather than the mini-bubber? |
| 23:15 | scottj | unclear |
| 23:15 | hiredman | mudge: *shrug* |
| 23:25 | mudge | so all things in clojure usually lowercase? |
| 23:25 | mudge | namespaces and function names are all lowercase? |
| 23:25 | mudge | is that the convention? |
| 23:25 | scottj | yeah |
| 23:27 | aria42 | no ideas? |
| 23:28 | mudge | green slime? |
| 23:28 | mudge | slime has mini bubbers? |
| 23:28 | aria42 | s/bubbers/buffer/ |
| 23:28 | aria42 | I'm not sure what bubbers are, but I'm sure emacs interacts with it |
| 23:30 | mudge | why do clojure file names user underscores, but the namespaces use hyphens? file test_this, namespace test-this |
| 23:32 | aria42 | I believe its because java package and class identifiers don't allow hyphens and since namespaces map to java packages |
| 23:33 | mudge | makes sense |
| 23:38 | scottj | aria42: you mean how to show the result in the repl instead of in the minibuffer? I don't know what it means to send the form the minibuffer |
| 23:38 | aria42 | yes. |
| 23:39 | aria42 | so C-X C-E evals and sends result to mini-buffer |
| 23:39 | aria42 | and is there a command that will send the form to the slime-repl and evaluate |
| 23:40 | scottj | I think you'll have to write some elisp |
| 23:41 | aria42 | that's never a good thing |
| 23:41 | aria42 | sigh, you're probably right, I'm a little shocked this isn't baked in |
| 23:41 | scottj | aria42: tried #lisp? CLer's tend to have more experience with slime |
| 23:43 | hiredman | C-c C-c evals the current form and C-c C-k compiles the current file |
| 23:44 | scottj | hiredman: not what aria42 is looking for |
| 23:44 | scottj | wants the code to be send to the repl and the output to appear there |
| 23:45 | scottj | "sent to" as in the code is visible in the repl |
| 23:46 | hiredman | C-k C-x o C-y |
| 23:46 | aria42 | hiredman: Thanks! |