2010-03-18
| 00:12 | defn | hmmm... |
| 00:13 | defn | so i have an idea -- id like to make something like: (what? [1 2 3] [3 2 1]) => (reverse [1 2 3]) |
| 00:14 | mikem | defn: looks like a "function inference engine" :D |
| 00:15 | defn | yeah i guess that's exactly what it is |
| 00:15 | defn | i remember seeing why the lucky stiff's "what_method?" |
| 00:16 | defn | you could do basic stuff that was similar to the above what_method?([x, y, z] [z, y, x]) |
| 00:16 | defn | i wonder if it might be easier to implement something like that in clojure, that the "code is data" thing might make life a bit easier... |
| 00:22 | defn | ooohhh a fuzzy inference engine maybe? |
| 00:25 | defn | ah-ha! no way! http://vimeo.com/9843950 |
| 00:27 | rubknob | defn, i haven't had a chance to look at _why's style of programming but what are your opinions on his style? |
| 00:38 | lancepantz | do you guys pronounce lein as 'line' or 'lean' ? |
| 00:42 | Raynes | lancepantz: 'line' |
| 00:43 | Raynes | Leiningen is pronounced 'LINE-ing-N', afaik. |
| 00:45 | lancepantz | thanks Raynes |
| 01:52 | defn | rubknob: my opinion on his style is that it's artsy and creative |
| 01:56 | defn | Does anyone have a working circumspec setup? |
| 02:17 | crowb4r | what is circumspec? |
| 02:22 | defn | stuart halloway's testing framework |
| 02:22 | crowb4r | defn: ahhh |
| 02:22 | defn | none it looks to be working ATM |
| 02:22 | defn | or maybe i just dont know how to set this up |
| 02:22 | defn | i havent read a single blog post or anything on it |
| 02:22 | defn | and his video shows it working, with no mention of beyond some very general information |
| 02:22 | defn | as to how |
| 02:27 | rfg | hmm, I have a macro defined in one namespace that is used in another namespace. When I compile the second namespace usually all is fine, but on OS X I'm getting "No such namespace" errors on my Java class imports. |
| 02:42 | rfg | Where I have (new BorderLayout) it gets expanded to (new java.awt.BorderLayout) but later on when I do (.add canvas# BorderLayout/CENTER), BorderLayout is not resolved. |
| 03:15 | hiredman | clojurebot: ping? |
| 03:15 | clojurebot | PONG! |
| 03:21 | sunkencityryleh | . |
| 03:22 | sunkencityryleh | I don't get "lein swank" to work it just says "swank is not a task" although I have [leiningen/lein-swank "1.2.0-SNAPSHOT"] as a dev-depencency |
| 03:23 | hiredman | have you run lein deps? |
| 03:24 | sunkencityryleh | yes |
| 03:25 | sunkencityryleh | it has downloaded a jar (swank-clojure-1.2.0-break-20100308.145053-4.jar) but maybe I should go with an earlier version of lein-swank? |
| 03:35 | LauJensen | Morning team |
| 03:38 | TheBusby | morning |
| 03:40 | sunkencityryleh | ok, so if I'm running leiningen 1.1.0 I cannot run lein-swank 1.2.0 ? |
| 04:12 | LauJensen | sunkencityryleh: No, not that Im aware of |
| 04:13 | sunkencityryleh | LauJensen: ok, it's weird because none of the leiningen plugs I install as dev-dependencies work |
| 04:13 | LauJensen | You mean they aren't added to the CP when you fire M-x swank-clojure-project? |
| 04:14 | sunkencityryleh | I'm trying "lein swank" |
| 04:14 | sunkencityryleh | or "lein run" |
| 04:15 | sunkencityryleh | but it just says that "swank is not a task" |
| 04:15 | sunkencityryleh | I guess I'll have to try to find a project with a working project.clj file and start from there |
| 04:17 | LauJensen | http://www.bestinclass.dk/index.php/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure/ |
| 04:17 | LauJensen | sunkencityryleh: Check out the deployment section and git clone the repo |
| 04:18 | sunkencityryleh | thnx, cloning it now |
| 04:19 | LauJensen | np |
| 04:20 | sunkencityryleh | should I be able to run "lein swank" on that? |
| 04:20 | sunkencityryleh | or do you somehow initiate the swank session from emacs through project.clj? |
| 04:22 | LauJensen | second - Ive never used lein swakn |
| 04:25 | sunkencityryleh | ok |
| 04:26 | Raynes | sunkencityryleh: You need to add lein-swank to your dev-dependencies. |
| 04:26 | Raynes | leiningen/lein-swank "1.1.0" |
| 04:27 | sunkencityryleh | Raynes: I had it there, but now I think I see what's missing from the project file, needed :main as soon as I added "[leiningen/lein-swank "1.2.0-SNAPSHOT"]" to dev-dependencies on LauJensens project I could run "lein swank" |
| 04:27 | sunkencityryleh | what I mean is that ":main foobar" was missing from my project.clj |
| 04:33 | sunkencityryleh | ok the problem was something completely different: dev-dependencies need to be placed in lib/ and doesn't honour :library-path directives |
| 04:34 | sunkencityryleh | now I got it running |
| 04:34 | hiredman | you might file a bug |
| 04:35 | sunkencityryleh | will do. at least they need to be there to show up as lein $TASK |
| 04:46 | sunkencityryleh | ok filed the bug. Been trying to crack that one for a while, it's a bit tedious to have to reboot the server for every change. doing the clojure appengine thing so I need to have the lib directory in WEB-INF |
| 05:45 | Raynes | I can't believe it just took me 10 minutes to write a pangram checker. :| |
| 05:45 | Raynes | I guess when there is like 20 thousand ways to do it, and you're not sure which one is best, they kind of begin to melt your brain. |
| 05:53 | LauJensen | Raynes: use set? |
| 05:53 | Raynes | LauJensen: That's what I went with. |
| 05:54 | Raynes | LauJensen: It filters out anything that isn't a character and then turns it into a set and compares it against a set of all characters in the alphabet. |
| 05:57 | Raynes | If that isn't good enough, I'll happily admit I suck. |
| 05:57 | Raynes | inb4anotherredneckjoke |
| 06:03 | LauJensen | Didnt mean to knock you |
| 06:11 | defn | sorry to harp on this, but im really interested in playing with it |
| 06:11 | defn | has anyone successfully set up circumspec? |
| 06:12 | Raynes | LauJensen: Did you get the message I sent after you send "Didn't mean to knock you" |
| 06:13 | LauJensen | no |
| 06:13 | Raynes | LauJensen: <Raynes> You didn't. I was just putting that out there. I usually write code that sucks. I don't think I've ever written a piece of Clojure code that wasn't improved exponentially when I let someone else fiddle with it. |
| 06:15 | esj | oh oh, the instructions say to "be brave" |
| 06:15 | Raynes | esj: That's probably why they have a name that reminds everybody of circumcision. |
| 06:28 | Licenser_ | greetings my lispy friends! |
| 06:29 | LauJensen | Greetings and salutations! |
| 06:29 | Raynes | Greetings, sir Licenser. |
| 06:29 | LauJensen | (too slow) |
| 06:29 | Raynes | ;) |
| 06:29 | Licenser_ | :) |
| 06:31 | sunkencityryleh | why do I get "IncompatibleClassChangeError" when I try to (use 'ring.adapter.jetty), I can load ring.adapter.httpcore fine. |
| 06:42 | spariev | so far, defn is the only one who's brave here at #clojure :) |
| 06:42 | esj | I heard him practicing his "FREEDDOOMM" shout earlier |
| 06:46 | Licenser_ | why is defn brave? |
| 06:48 | spariev | Licenser_: he's trying to setup http://github.com/stuarthalloway/circumspec with phrase "Be brave" in README :) |
| 06:49 | zmila | my salutations and thanks to lpetit! i'm waiting for new release of CCW plugin |
| 06:50 | Licenser_ | ahh sneaky |
| 06:50 | Raynes | Two words: auto indentation |
| 06:51 | Licenser_ | defn: if you manage to do it make a blog post so the less brave of us can follow |
| 06:53 | zmila | auto ident is promised to be in the next CCW version |
| 06:54 | lpetit | Hi |
| 06:54 | lpetit | I confirm. I'm currently polishing it on my machine |
| 06:54 | lpetit | s/polishing/debugging/ :-) |
| 06:54 | lpetit | zmila: salutations too |
| 06:55 | Licenser_ | is CCW any good? AKA better then enclojure? |
| 06:55 | lpetit | Licenser_: not as feature complete, yet |
| 06:55 | zmila | i'm using ccw for some monthes, and installed enclojure last week |
| 06:57 | zmila | enclojure has some minor advantages, but its repl uses pretty-print wich has bug - it doesn't follow *print-length* and displays the whole sequence |
| 06:57 | lpetit | My rationale is really not to get people migrate from other IDEs to ccw, but rather to do my best so that people used to eclipse can continue use it when migrating to clojure. If people migrate from other IDEs, great, but that's not the goal. I think every people should be able to stay on the IDE he likes. |
| 06:58 | zmila | our team for ages uses eclipse with java and related |
| 06:58 | Licenser_ | lpetit: I just still look for a IDE that I like. I am not really happy with EMACS nor with enclojure |
| 06:59 | lpetit | zmila: I would be happy to get from you a thorough description of what you like and dislike about ccw |
| 06:59 | LauJensen | Hey Laurent |
| 06:59 | lpetit | Licenser_: what is it you dislike about enclojure ? |
| 06:59 | lpetit | LauJensen: Hi Lau ! |
| 06:59 | Licenser_ | Mostly that it is slow, that it is not so nice do interact with the REPL |
| 07:00 | Licenser_ | but the NB 6.8 logo looks way cooler then the Eclipse one |
| 07:00 | lpetit | Licenser_: sure this is a great reason :-) |
| 07:00 | zmila | lpetit - i posted some feature-requsts to your project |
| 07:00 | lpetit | zmila: oh it was you ? :-) |
| 07:00 | zmila | most wanted - code folding |
| 07:01 | Licenser_ | lpetit: it is! My work laptop is horrible slow I have to look at the logo 1-2 minutes I |
| 07:01 | Licenser_ | need to see something nice during that time so I don"t flip and run amok |
| 07:02 | lpetit | zmila: ok. I also need to rework on the outline, it's currently based on the clojure reader, not so great for parsing potentially broken source code. |
| 07:02 | zmila | my laptop (some aser) is enough to run eclipse with bunch of plugins (gwt, scala, clojure) |
| 07:03 | lpetit | Licenser_: sorry, can't do anything for this :-) |
| 07:04 | lpetit | Time to go eat smth, cu |
| 07:04 | zmila | lpetit - now the most annoing is some vague paredit behaviour: when i type ( inside existing s-exprs, the plugin inserts ). |
| 07:05 | zmila | similar is when i try to put ), the paredit just jumps to the end of )))) to corresponding brace |
| 07:06 | Maddas | Licenser_: Time to pick up meditation! |
| 07:06 | Maddas | Every time to look at the logo, there's your mini meditation-retreat :-) |
| 07:06 | Licenser_ | Maddas: I startet martial arts classes :P |
| 07:07 | Maddas | I have a feeling that shadow boxing for a minute to kill the time will not calm you down, but whatever works :P |
| 07:07 | LauJensen | Licenser_: How recently ? |
| 07:08 | Licenser_ | a year ago, did it half a year then had a accident and had to pause half a year now I was allowed to start again |
| 07:08 | LauJensen | ok |
| 07:08 | lpetit | zmila: this is expected behavior, no ? paredit tries hard to keep parens correcty balanced. So if you type (without double quotes) "(defn [arg] (hello))" then at each time you will have syntaxically correct code. |
| 07:08 | esj | i have some experience of accidents in martial arts classes... |
| 07:08 | Licenser_ | Maddas: but training choking techniques on my co workers does wonders! |
| 07:08 | Licenser_ | esj: no no it was a work accident |
| 07:09 | Licenser_ | I tore my miniscus when I was at a customers site and got attacked by network cables |
| 07:09 | lpetit | zmila: may I close issue http://code.google.com/p/counterclockwise/issues/detail?id=60 ? |
| 07:10 | esj | Licenser_: have mercy. I tore my meniscus, and some other stuff in the knee learning that I could in fact not fly |
| 07:10 | Licenser_ | o.O |
| 07:10 | zmila | yes, this issue was due my bad mixing of versions |
| 07:11 | lpetit | zmila: but indeed there is some bug in the parser. Hopefully also corrected in the next release |
| 07:11 | lpetit | ' |
| 07:12 | lpetit | Folks, if you just type counterclockwise in your local google, how far in the list do you see "counterclockwise - Project Hosting on Google Code" ? |
| 07:12 | Maddas | 7th |
| 07:12 | zmila | first |
| 07:12 | Raynes | 4th |
| 07:12 | lpetit | 7th in England, not so bad |
| 07:13 | lpetit | first ???? Where are you located ? |
| 07:13 | lpetit | Raynes: yeah, me too, 4th in France |
| 07:13 | lpetit | That's great ! :-) |
| 07:13 | lpetit | Must really go eat smthg, cu |
| 07:13 | Raynes | I'm in the USA. :> |
| 07:14 | lpetit | Raynes: oh :-) |
| 07:15 | Licenser_ | lpetit: #9 |
| 07:15 | Licenser_ | in germany |
| 07:16 | LauJensen | lpetit: 3.rd in DK |
| 07:16 | zmila | lpetit, what is the best way to edit "(defn [arg] (inc arg))" to get "(defn [arg] (if (odd? arg) (inc arg))" ? in any try i have to twice delete auto-inserted ) and lately put one ). |
| 07:17 | Licenser_ | TM allows things like marking a region then pressing " to encapsulate it in " which I found very nice |
| 07:24 | esj | Raynes: what brand of coffee do you drink... I want some. |
| 07:24 | Raynes | esj: I drink Lipton Black Tea. ;) |
| 07:24 | esj | this seems impossible. |
| 07:25 | Raynes | But the reason I've been up all night is because I woke up at 10:00pm. |
| 07:25 | LauJensen | Raynes: you mean 2200 hours |
| 07:25 | Raynes | Yeah. That. |
| 07:25 | esj | LauJensen: No, he means 17:00:00 UTC |
| 07:26 | esj | ;) |
| 07:26 | LauJensen | oh - Another american staying up all night to crash the economy...well its not the first time I guess :) |
| 07:26 | esj | oh, i thought it was already crashed ? |
| 07:26 | Raynes | Huh? Why is java.util.Date not recognizing daylight savings time. :( |
| 07:27 | Raynes | My $time command is borked because of it now. |
| 07:27 | esj | Raynes: a world of pain. Check out the Chrono project in Incanter |
| 07:27 | Raynes | <Raynes> $time |
| 07:27 | Raynes | <sexpbot> Raynes: The time is now Thu Mar 18 05:26:24 CST 2010 |
| 07:31 | Licenser_ | clojurebot: what time is it? |
| 07:31 | clojurebot | multimethods is what separates the boys from the men. |
| 07:31 | Licenser_ | thank you clojurebot, you're helpful as always. |
| 07:32 | LauJensen | Raynes: Daylight Savings Time doesnt start here for another 3 days I think |
| 07:32 | Raynes | LauJensen: It started several days ago here, so there. |
| 07:32 | Raynes | :p |
| 07:32 | LauJensen | Im just saying, you sure your java lib knows that? |
| 07:33 | esj | if it uses tz then yes. |
| 07:33 | Raynes | LauJensen: I don't know what Date knows. I know people filed bug reports about it back in 06. |
| 07:33 | Raynes | And I think the bugs are still standing. |
| 07:33 | LauJensen | You mean THE date? I thought you knew, we're all using Joda nowadays |
| 07:33 | sunkencityryleh | it's not possible to load ring.adapter.jetty while at the same time having appengine-tools-sdk in classpath. bummer :( maybe I can start a swank-server inside the app somehow in dev mode instead. |
| 07:33 | Raynes | Joda it its. |
| 07:34 | Raynes | is* |
| 07:35 | esj | joda is wrapper in chrono |
| 07:35 | Raynes | esj: clj-time is on Clojars. |
| 07:35 | _mst | Java also ships with its own timezone files. A lovely surprise for sysadmins everywhere :) |
| 07:49 | defn | ahhhh, scotch at 7am... |
| 07:52 | defn | Mardon me padam. I fool so feelish. I'm under the alfluence of inkahol. Teny meeple pink I'm drunk but they may not think they so bad off as I am. |
| 07:52 | defn | afluence* |
| 07:52 | defn | </off-topic> |
| 07:54 | defn | haha -- im only sipping -- worked all night and missed the St. Patrick's day festivities... |
| 08:13 | defn | ,$ |
| 08:13 | clojurebot | java.lang.Exception: Unable to resolve symbol: $ in this context |
| 08:14 | defn | is $ anything in clojure? |
| 08:14 | Chousuke | no |
| 08:14 | defn | heh, is that a ridiculous question? or is it intentional? |
| 08:15 | Raynes | defn: It's my bot's command prepend. Does that count? ;) |
| 08:15 | defn | we have everything except $, %, ; -- what am I missing? |
| 08:16 | Raynes | ,. |
| 08:16 | clojurebot | java.lang.Exception: Unable to resolve symbol: . in this context |
| 08:16 | Raynes | Oh yeah, dot is used. |
| 08:16 | Raynes | Heh. |
| 08:16 | spariev | ,:- |
| 08:16 | clojurebot | :- |
| 08:16 | defn | what's that thing?! :) |
| 08:16 | Licenser_ | , |
| 08:16 | clojurebot | EOF while reading |
| 08:16 | Licenser_ | ,:-P |
| 08:16 | clojurebot | :-P |
| 08:16 | Raynes | ,() |
| 08:16 | clojurebot | () |
| 08:17 | defn | ,::--PP |
| 08:17 | clojurebot | :sandbox/--PP |
| 08:17 | Licenser_ | ,-3 |
| 08:17 | clojurebot | -3 |
| 08:17 | defn | ,(doc :) |
| 08:17 | Raynes | LauJensen: If that presentation pops up, let me know so I can brag to all my (fictional) friends. :D |
| 08:17 | clojurebot | Invalid token: : |
| 08:17 | LauJensen | hehe - will do |
| 08:18 | defn | ;-xyz |
| 08:18 | defn | ,-xyz |
| 08:18 | clojurebot | java.lang.Exception: Unable to resolve symbol: -xyz in this context |
| 08:19 | defn | (def -f 42) |
| 08:19 | defn | ,(def -f 42) |
| 08:19 | clojurebot | DENIED |
| 08:19 | sunkencityryleh | in the olden days run-server would start a jetty instance and then return, but with this new run-jetty it just keeps on having control of the thread, do I manually need to start a thread? |
| 08:19 | Licenser_ | no def for you |
| 08:19 | Raynes | That's a no-no. |
| 08:19 | Licenser_ | ,(eval 1) |
| 08:19 | clojurebot | DENIED |
| 08:19 | defn | -x works, huh? |
| 08:20 | defn | weird |
| 08:20 | defn | err (def -x 1) |
| 08:20 | Licenser_ | defn: clojure bot does not allow to def stuff |
| 08:20 | Licenser_ | , (set! a 1) |
| 08:20 | clojurebot | java.lang.Exception: Unable to resolve symbol: a in this context |
| 08:20 | Licenser_ | ,(set! *warn-on-reflections* true) |
| 08:20 | clojurebot | java.lang.Exception: Unable to resolve symbol: *warn-on-reflections* in this context |
| 08:20 | defn | (def $f 1) works |
| 08:21 | Licenser_ | ,(set! *warn-on-reflection* true) |
| 08:21 | clojurebot | java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set |
| 08:21 | Licenser_ | good :) clojurebot does not break! |
| 08:21 | Licenser_ | ,*clojure-version* |
| 08:21 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"} |
| 08:22 | spariev | is it ok to use keywords like :- and :+ ? |
| 08:22 | Licenser_ | ,(set! *clojure-version* {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}) |
| 08:22 | clojurebot | java.lang.IllegalStateException: Can't change/establish root binding of: *clojure-version* with set |
| 08:22 | Licenser_ | :D |
| 08:22 | spariev | i mean is it considered good style ? |
| 08:22 | defn | how could that be good style? |
| 08:22 | defn | :) |
| 08:22 | Licenser_ | defn: like for writing parsers |
| 08:22 | defn | oh i see |
| 08:23 | spariev | I'm writing parser right now and use :- |
| 08:23 | defn | i can see some cases where it might be novel |
| 08:23 | Licenser_ | see :P |
| 08:23 | Licenser_ | then I |
| 08:23 | Licenser_ | 'd say yes |
| 08:23 | defn | spariev: could you give an example line where you use :- |
| 08:23 | spariev | ie (when (= "-(" open-paren) :-) |
| 08:23 | Licenser_ | like to represent 1 + 1 |
| 08:23 | Licenser_ | {:function |
| 08:23 | spariev | writing parser for lucene queries |
| 08:23 | defn | very cool |
| 08:23 | Licenser_ | {:function :+ :args [1 1]} |
| 08:24 | spariev | compatible with sphinxsearch syntax |
| 08:24 | defn | Gene? |
| 08:24 | clojurebot | markov chain generator is http://groups.google.com/group/clojure-study-dc/browse_frm/thread/026ccdc8acb102f9?pli=1 |
| 08:24 | lpetit | zmila: currently, none that is satisfactory. I also (since I'm eating my own dogfood when writing ccw) have to select a space around the bracket to be able to delete one. When paredit gets more feature (not the next release, the next - next), you will be able to "slurp" an sepxr into another, like this (consider the cursor is located where I place the pipe char | ) : "(defn [arg] |(inc... |
| 08:24 | lpetit | ...arg))" -> EDIT -> "(defn [arg] (if (odd? arg))|(inc arg))" -> BACKSPACE -> "(defn [arg] (if (odd? arg)|)(inc arg))" -> SLURP -> "(defn [arg] (if (odd? arg) |(inc arg)))" |
| 08:25 | spariev | Only with lisp you can have smilies in your code :-) |
| 08:25 | defn | ,(:-) |
| 08:25 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :- |
| 08:25 | defn | ,'(:-) |
| 08:25 | clojurebot | (:-) |
| 08:26 | defn | i want to make a tshirt with that on it |
| 08:26 | Licenser_ | it is cool |
| 08:26 | Licenser_ | I bet you could make a smily brainfuck interpreter in clojure |
| 08:27 | defn | it's just so distinct -- i really love that about clojure -- it has a real flavor to it |
| 08:27 | defn | the java flavor was always like swallowing a rock |
| 08:27 | defn | but this is awesome |
| 08:27 | zmila | lpetit, ok. but maybe it's reasonable to make auto-insert be configurable? say i turn it off, type a lot of code, then press "reformat" (nice feature request:) or do balance by myself |
| 08:28 | defn | spariev: that's very cool you're working on lucene + sphinxsearch -- do you have any public code? |
| 08:29 | lpetit | zmila: or with another possibility of paredit, which is to encapsulate an sexpr in surrounding parens : "(defn [arg] (inc arg)|)" -> GO TO MATCHING BRACKET -> "(defn [arg] |(inc arg))" -> SURROUND WITH PARENS -> "(defn [arg] (|(inc arg)))" -> EDIT -> "(defn [arg] (if (odd? arg)| (inc arg)))" |
| 08:29 | Licenser_ | lpetit: that |
| 08:29 | Licenser_ | 'd be awsome :) |
| 08:30 | Licenser_ | I also really want a SLURP key on my keyboard now :( |
| 08:30 | lpetit | zmila: in paredit, there's a keyboard shortcut to say : insert the next character I type "as is", do not use paredit. Or you can disable paredit by going to the workbench clojure preferences |
| 08:31 | lpetit | What could be the slurp keyboard shortcut for Eclipse ? What could be the SURROUND WITH PARENS keyboard shortcut for Eclipse ? |
| 08:31 | zmila | lpetit, maybe. i can't find "select till matching paren" |
| 08:31 | defn | i really wish paredit worked properly on {}, and in slime |
| 08:31 | lpetit | defn: what do you intend by "worked properly on {}" ? |
| 08:31 | defn | slurping and spitting like () or [] |
| 08:32 | lpetit | zmila: like in java editing : Ctrl + Alt + P |
| 08:32 | spariev | defn: well, it's more like lucene instead sphinx - we are moving from sphinx to lucene-backed (zoie + bobo, to be more precise) search, and I want to make as little changes in frontend as it possible |
| 08:32 | defn | err slurping and barfing |
| 08:32 | lpetit | defn: I guess there are some additions to paredit.el floating around the community. Though not integrated into technomancy's "bundle" |
| 08:33 | zmila | lpetit - C-A-P just jumps to matching brace, not selects the text inside |
| 08:33 | defn | i used the bundle as a template |
| 08:33 | lpetit | zmila: oh, "select" till matching paren, not I don't have this one right now |
| 08:33 | defn | i think it is a much better experience to learn elisp while you learn clojure |
| 08:34 | LauJensen | "learn elisp", whats to learn ? |
| 08:34 | defn | i didnt know a lisp -- or do you mean that sarcastically? |
| 08:34 | lpetit | zmila: I guess it will be like in java editing, but not named "select to matching bracket", but rather "Expand selection to enclosing element" ( Shift + Alt + Up) |
| 08:35 | LauJensen | defn: Im just saying there's not a whole lot to learn, its a homoiconic prefix notated lisp, just like clojure. the scope of its use is very simple and after a skim of the API you're good to go |
| 08:35 | LauJensen | oh course if you're drunk, its another story I'll give you that :) |
| 08:36 | lpetit | zmila: a contributor contributed this, it will be included in the next release, too. He did not make this by extending paredit, though, so the underlying implementation wil change over time, when I port it to paredit (and it will handle edge cases better as well then, I guess) |
| 08:37 | lpetit | "a contributor contributed", wow, I'm really a good writer :-) |
| 08:37 | zmila | lpetit, ok. there are also C+S+[ or C+A+( unbound (for "wrap in [" or "wrap in (") |
| 08:38 | LauJensen | lpetit: You're a frenchmen from france, its ok |
| 08:38 | zmila | new Runnable.run() :) |
| 08:38 | lpetit | zmila: I would not mind if you put an entry or this in the bug tracker, as a reminder. And then you can also "follow" the bug and see when it is implemented |
| 08:39 | zmila | ok, lpetit. I'll create new issue for slurp or wrap |
| 08:40 | lpetit | And maybe a separate one for For C+S+[ / C+S+{ / C+S+( |
| 08:40 | lpetit | oh you said "or wrap", sorry. Seperate issues for slurp and for wrap, please |
| 08:40 | lpetit | zmila: thx |
| 08:40 | lpetit | LauJensen: :-p |
| 08:42 | defn | LauJensen: I don't like how (:a |:b :c) -> OPEN PAREN -> (:a (|):b :c) -> SLURP -> (:a (| :b) :c) works |
| 08:42 | LauJensen | What are we talking about now defn ? |
| 08:42 | zmila | lpetit, do you have any architectural docs for your ccw project? if i decide to try to contribute to the plugin, how do i start? besides downloading the sources |
| 08:43 | defn | bah, sorry |
| 08:44 | lpetit | zmila: alas, not yet |
| 08:45 | lpetit | zmila: you are already familiar with eclipse plugin dev ? |
| 08:45 | defn | LauJensen: Maybe I'm just not as smart as you. To me, homoiconicity, prefix notated lisp, was not something I just intuitively realized in one afternoon. |
| 08:46 | defn | homoiconic* |
| 08:46 | zmila | lpetit, not yet. but this skill is in my wish-list :) |
| 08:46 | LauJensen | defn: I dont remember how long it took me, but for Raynes it came naturally |
| 08:46 | Raynes | Homoiconicity made sense to me rather instantly. |
| 08:46 | LauJensen | defn: (and I wasn't making any remakrs about your IQ, which Im sure is quite high) |
| 08:47 | zmila | now i'm in a project where the whole UI is build like eclipse: workbench/editors/views/plugins |
| 08:47 | Raynes | I think I have an IQ of 108. |
| 08:47 | Raynes | But that was a year ago. |
| 08:48 | defn | Raynes: I guess I just don't believe you just instantly understood the implications of a homoiconic language. |
| 08:48 | defn | That seems to border on certain arrogance. |
| 08:48 | Raynes | Code that writes code. I'm not sure what is ambiguous about that. |
| 08:49 | Raynes | Maybe I only think I understand it then? |
| 08:49 | LauJensen | defn: Thats out of line imho- The fact that raynes either understood, or failed to understand all of the implications does not warrent that you call him arrogant |
| 08:49 | Raynes | It's alright. Maybe I am being arrogant. I /think/ I understand the implications. Maybe I'm wrong. |
| 08:50 | defn | I think you're reading me wrong here |
| 08:50 | lpetit | zmila: maybe you can open a bug to remind me to write a wiki page on how to start with installing the ccw dev environment ? :-) |
| 08:50 | defn | What I'm trying to say is that yeah, code writing code, that's not very difficult to think about. A robot building a robot. I just don't think I understood out of the box how to apply that. |
| 08:51 | defn | i need to know what a robot is before i can use it, you know? |
| 08:52 | defn | and there again I suppose you could probably claim that, yeah, a language is composed of little pieces, and you just use them -- but again I would feel like I would be cheating a bit to say I knew all of them |
| 08:52 | zmila | lpetit, in our team exists following convention: one who asks smth, after receiving answer, must write what he get into wiki :) |
| 08:53 | Raynes | I never said I was instantly an expert on homoiconicity. |
| 08:53 | defn | zmila: haha, that is an excellent idea |
| 08:53 | Raynes | I knew about it before I learned Clojure. |
| 08:53 | Raynes | Macros came easy to me, however. |
| 08:53 | defn | Ah, not to me. |
| 08:53 | Raynes | Understanding them, that is. |
| 08:53 | zmila | so, if you tell me "how to ..." - then I write this for you (and for all new-comers) |
| 08:53 | Raynes | Writing them? Heh. |
| 08:54 | Chousuke | I find designing macros much trickier than writing them |
| 08:54 | lpetit | zmila: give me your google account, now ! :è) |
| 08:54 | lpetit | :-) |
| 08:54 | lpetit | zmila: and I open up the wiki for you :-) |
| 08:54 | defn | yeah i think maybe my definition of understanding is just including the whole application rather than just 'getting the idea' |
| 08:54 | Chousuke | I mean, for any one problem a macro can solve, there are n different macros you can write |
| 08:54 | defn | Chousuke: yeah, it is a different layer |
| 08:55 | Raynes | Well, I wasn't lying when I said that Lisp came easy to me. My only real exposure to anything else was primarily Haskell, so I didn't have much of anything else bleeding my mind dry of resources. |
| 08:55 | defn | ah-ha -- I came from Ruby. A lot of it made a whole mess of sense to me. |
| 08:55 | defn | Other things not so quickly |
| 08:56 | Raynes | Metadata is what I had trouble with. |
| 08:56 | Raynes | I could not understand what it was useful for. |
| 08:56 | Raynes | I still never really use it. |
| 08:56 | defn | I think I'm close to my 6 month mark with clojure and I feel like I'm building some muscle |
| 08:56 | defn | Raynes: oh man! it's great! |
| 08:56 | Chousuke | and you need to consider several attributes. How well does it fit with existing code or language idioms? Is it flexible enough that the user is not tempted to write the pattern manually anyway? Does it make the code clearer? ... all kinds of questions |
| 08:57 | defn | i remember being in a daniel dennett lecture and I began thinking about some very elabroate silly AI idea with metadata, you can use it for all sorts of cool purposes |
| 08:58 | Chousuke | I often hear people saying that lisp has little syntax, but what do you call all those little mini-languages that macros implement using the basic syntactic elements? :/ |
| 08:59 | Chousuke | lisp can have a *lot* of syntax if you don't restrain yourself :P |
| 08:59 | defn | haha |
| 09:00 | defn | i love this line i heard awhile back... i think it was in code complete, about a guy "meditating for 4 hours and then emitting a single, elegant statement" |
| 09:00 | defn | something like that, anyway |
| 09:00 | Chousuke | Which is why I think macros should be designed to reuse syntactic elements so that their semantics approximate their use in other macros |
| 09:00 | defn | Chousuke: could you show me what you mean? |
| 09:01 | Chousuke | defn: eg. it would be silly to write a macro in Clojure that takes arguments in a list. |
| 09:01 | Chousuke | You should use a vector instead |
| 09:02 | Chousuke | it would be trivial to write CL-style let or defun but it wouldn't be idiomatic :/ |
| 09:02 | Raynes | There still isn't anything for SOAP in Clojure-world is there? |
| 09:06 | defn | Chousuke: ahhh! |
| 09:06 | Raynes | You know... clojars.org could have been a full-fledged Clojure project forge. |
| 09:06 | chouser | github's really good at most of that |
| 09:06 | defn | it can't be still? |
| 09:07 | defn | github doesnt have let you see what the 70th most popular clojure project is |
| 09:07 | defn | i really dislike that limitation |
| 09:07 | Raynes | chouser: Github is great, but that's not my point. |
| 09:07 | defn | Raynes: i agree with you 100% |
| 09:07 | defn | err 90%, i think it still has the potential to be |
| 09:08 | Raynes | Maybe we should tell ato. |
| 09:08 | Raynes | Sadly, he isn't here right now. :( |
| 09:08 | defn | he's a busy man I'm sure |
| 09:08 | Raynes | Indeed, but we should still run it by him. |
| 09:08 | defn | that code is publicly available fwiw |
| 09:08 | Chousuke | I wish clojars.org at least had links to the official project page :P |
| 09:08 | Raynes | I don't do web-development. |
| 09:08 | Raynes | :| |
| 09:08 | Raynes | Ever. |
| 09:08 | defn | "patches welcome." |
| 09:09 | Raynes | If he says that, we'll go get a guy name Patches to run it by him. :p |
| 09:10 | defn | ive met a starsizio, but never a patches |
| 09:10 | defn | ive also never met a bertrand |
| 09:10 | defn | but that's another story entirely |
| 09:17 | Raynes | http://rosettacode.org/wiki/Color_of_a_screen_pixel#Clojure |
| 09:18 | Raynes | Oops, wrong window. |
| 09:46 | LauJensen | defn: ping? |
| 09:48 | spariev | just received email about updates to Practical Clojure book |
| 09:48 | spariev | two new chapters on parallel programming and datatypes/protocols |
| 09:54 | rfg | spariev: they haven't sent me an e-mail :( |
| 10:40 | patrkris | is there a smart way to ad hoc suppress printing in the REPL for the evaluation of a form? |
| 10:43 | bmason | patrkris: check out with-out-str |
| 10:44 | bmason | might not be exactly what you're looking for but it's the right area of the API I'd wager |
| 10:45 | patrkris | bmason: it's fine for me, thanks! |
| 10:47 | Chousuke | you can also bind *out* to a dummy Writer |
| 10:47 | bmason | right... and I think with-out-str uses bind internally |
| 10:52 | patrkris | is there an easy way to get several values from a map given a set of keys and have the result as a list/vector? |
| 10:53 | patrkris | the latter in the order of the keys given |
| 10:53 | chouser | (map your-map keys) |
| 10:53 | chouser | heh |
| 10:53 | chouser | that's not very clear. vocab collision |
| 10:53 | chouser | ,(map {:a 1, :b 2, :c 3} [:c :a]) |
| 10:53 | clojurebot | (3 1) |
| 10:54 | patrkris | chouser: of course! I should've figured that out myself! :) |
| 10:56 | fliebel | chauser: wait… you just used a map as a function? |
| 10:57 | fliebel | *chouser |
| 10:57 | patrkris | fliebel: yes he does |
| 10:57 | Chousuke | fliebel: they are functions :) |
| 10:58 | patrkris | fliebel: which I should have known how to utilize |
| 10:58 | fliebel | uuuhm… let me see... |
| 10:58 | fliebel | ,({:a 1, :b 2, :c 3} :c) |
| 10:58 | clojurebot | 3 |
| 10:58 | fliebel | wow |
| 10:59 | Chousuke | fliebel: associative things in general are functions of keys to values |
| 10:59 | Chousuke | fliebel: works for vectors too |
| 10:59 | Chousuke | and sets; the values are just the keys themselves. |
| 10:59 | fliebel | How about the other way around? |
| 10:59 | fliebel | ,(:c {:a 1, :b 2, :c 3}) |
| 10:59 | clojurebot | 3 |
| 10:59 | Chousuke | for keywords and symbols, yes. |
| 11:00 | fliebel | So any collection is a function that will return the value corresponding to the key? |
| 11:00 | arnihermann | Can anyone take a look at this macro: http://paste.pocoo.org/show/191133/ |
| 11:00 | Chousuke | fliebel: any Clojure associative collection |
| 11:01 | arnihermann | when I expand it, I get weird fn back |
| 11:01 | arnihermann | (fn* ([] (clojure.core/for [pred__2980__auto__ state__2981__auto__ :let [[p0 p1 p2 p3] pred__2980__auto__] :when (and (= cell) (= b))] {?y 2, 2 1}))) |
| 11:01 | Chousuke | fliebel: neither lists nor seqs are functions |
| 11:01 | fliebel | ok :( so I can't do ([:a :b :c] 0) |
| 11:01 | arnihermann | I meant, (fn* ([state__3078__auto__] (clojure.core/for [pred__3079__auto__ state__3078__auto__ :let [[p0 p1 p2 p3] pred__3079__auto__] :when (and (= cell) (= b))] {?y 2, 2 1}))), which looks odd (fn ([...] ...) |
| 11:01 | Chousuke | fliebel: you can. that's a vector, not a list :) |
| 11:02 | Chousuke | fliebel: it's associative |
| 11:02 | Chousuke | arnihermann: fn is a macro |
| 11:02 | Chousuke | arnihermann: expands to fn* |
| 11:02 | fliebel | uuuhm, Whats the difference between a vector, seq and a list? All of them are a bunch of values, right? |
| 11:02 | Chousuke | arnihermann: you can treat fn* as fn without destructuring |
| 11:03 | Chousuke | fliebel: a vector is an indexed collection, a seq is a list-like "virtual" collection, and a list is just a list: no indexes |
| 11:03 | arnihermann | ah |
| 11:04 | arnihermann | not sure how I fix this... |
| 11:04 | fliebel | Chousuke: which means? I can't get the nth item of a list? |
| 11:04 | Chousuke | fliebel: you can, but not in constant time |
| 11:04 | zmila | nth element from list is O(n), nth of vector is O(1), i guess |
| 11:04 | Chousuke | for the meaning of "constant" as applied to clojure collections... |
| 11:05 | esj | has anybody tried to store a set using congomongo ? I get an error it can't serialize the set, and was wondering if there is a good reason why that should be the case. |
| 11:05 | fliebel | uuuhm, okay, so why would I want to use a list or seq? |
| 11:05 | Chousuke | fliebel: why not? for a lot of your data, you don't care about the index. |
| 11:05 | esj | i mailed somnium but I think he's on holiday, probably skiing ! |
| 11:05 | zmila | depends on what operations your want to perform on the collection |
| 11:05 | Chousuke | fliebel: and seqs can be lazy, unlike vectors |
| 11:06 | fliebel | I knew that one… But for the rest it's a matter of efficiency? |
| 11:07 | Raynes | I is clean, shaven, and ready to go. :D |
| 11:07 | dpritchett | I really enjoyed Ch 4 on sequences in Programming Clojure |
| 11:07 | arnihermann | Chousuke: without destructuring? |
| 11:07 | dpritchett | I have not built much with clojure yet but it certainly helped me understand |
| 11:08 | esj | Raynes - surely its bedtime by now ? |
| 11:08 | esj | youth of today ! |
| 11:08 | Raynes | esj: Absolutely not! It's time to take rentals back to movie gallery and get some chow. |
| 11:09 | Chousuke | arnihermann: yeah. the code for destructuring is generated by the fn macro and fn* doesn't need to support it. |
| 11:10 | Chousuke | ,(macroexpand '(fn [[a b]] [b a])) |
| 11:10 | clojurebot | (fn* ([p__6668] (clojure.core/let [[a b] p__6668] [b a]))) |
| 11:12 | Raynes | ,(macroexpand '(macroexpand blah)) |
| 11:12 | clojurebot | (macroexpand blah) |
| 11:12 | Raynes | :D |
| 11:13 | arnihermann | Chousuke: still not following, sorry :) can you propose a solution? |
| 11:13 | arnihermann | code bit? |
| 11:14 | Chousuke | arnihermann: oh, I don't think that applies to your problem |
| 11:14 | Chousuke | arnihermann: what is your problem, anyway? |
| 11:14 | Chousuke | how does the macro fail? |
| 11:14 | arnihermann | code should be generated (fn []) but not (fn ([])) |
| 11:14 | arnihermann | notice the extra parenthesis |
| 11:14 | arnihermann | around [] |
| 11:14 | arnihermann | right? |
| 11:14 | Chousuke | arnihermann: ah, that's not an issue. |
| 11:15 | Chousuke | arnihermann: that's part of fn syntax |
| 11:15 | arnihermann | hmm |
| 11:15 | raek | fliebel: it's a common clojurian practice to use vectors when you want some kind of literal sequence in you code |
| 11:15 | arnihermann | (expand-true '(cell ?x ?y b) '?player) |
| 11:15 | arnihermann | java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Named (NO_SOURCE_FILE:0) |
| 11:15 | Chousuke | (fn [foo] bar) is just shorthand for (fn ([foo] bar)) |
| 11:15 | arnihermann | I get this error |
| 11:15 | arnihermann | when calling the code |
| 11:15 | arnihermann | ok, right |
| 11:15 | arnihermann | of course |
| 11:15 | raek | so, you will mostly see vectors in example code |
| 11:16 | arnihermann | and I don't understand the error msg |
| 11:16 | Chousuke | arnihermann: why are you quoting the parameters to expand-true? |
| 11:17 | raek | fliebel: (linked) lists and vectors have different performance for various operations |
| 11:17 | fliebel | I see |
| 11:17 | arnihermann | Chousuke: I don't want them evaluated |
| 11:17 | raek | it's efficient to add to the front of a list but to the back of a vector |
| 11:17 | Chousuke | arnihermann: they aren't. |
| 11:17 | Chousuke | arnihermann: parameters to macros are not evaluated |
| 11:17 | arnihermann | Chousuke: aaaa forget |
| 11:17 | Chousuke | arnihermann: they're just the plain symbols and whatever you pass |
| 11:17 | arnihermann | Chousuke: right |
| 11:17 | arnihermann | Chousuke: of course, I forgot |
| 11:17 | arnihermann | :\ |
| 11:17 | raek | seqs are sequencial views of a collection (vector, list, map, java.util.Collection, etc) |
| 11:18 | raek | and not a collection type per se |
| 11:18 | Chousuke | seqs can also be constructed from simple functions, so there doesn't need to be an actual collection backing it. |
| 11:19 | arnihermann | Chousuke: (expand-true (cell ?x ?y b) player)java.lang.Exception: Unable to resolve symbol: state__3440__auto__ in this context (NO_SOURCE_FILE:141) |
| 11:19 | psykotic | and in the airplane i wrote this hack: |
| 11:19 | arnihermann | Chousuke: the error now |
| 11:20 | arnihermann | Chousuke: but now I'm generating new symbol? |
| 11:20 | arnihermann | state# |
| 11:20 | psykotic | http://gist.github.com/336461 |
| 11:22 | Chousuke | arnihermann: that would mean the generated code contains the state# symbol in some way that makes it refer to a global instead of the local variable |
| 11:23 | Chousuke | clojurebot: macro help |
| 11:23 | clojurebot | macro help is http://clojure-log.n01se.net/macro.html |
| 11:23 | Chousuke | arnihermann: could you fill in that, please? |
| 11:27 | ldp | Has anyone used vimclojure? |
| 11:27 | ldp | And is it any good? |
| 11:27 | fliebel | I do, and I like it. |
| 11:27 | ldp | fliebel: Thanks. :) |
| 11:27 | fliebel | You need to run nailgun in the background to get auto completion though. |
| 11:28 | ldp | fliebel: Explain? |
| 11:28 | fliebel | vimclojure relies on some strange java lib for a few more advanced features. |
| 11:29 | fliebel | I run it without it most of the tie unless I need to do extensive debugging. |
| 11:29 | ldp | fliebel: Ah, I see. |
| 11:29 | ldp | fliebel: Mind explaining how exactly I install vimclojure? I can't get it working. :/ |
| 11:30 | fliebel | There is some strange video somewhere about it, but it took me a while as well. |
| 11:33 | Chousuke | http://kotka.blip.tv/#1894565 this one? |
| 11:36 | petrus | ldp: blog post about using vim with clojure: http://writequit.org/blog/?p=386 |
| 11:36 | arnihermann | Chousuke: not sure I follow, again, sorry :) |
| 11:37 | Chousuke | arnihermann: I can help you better with the macro if you provide the information requested on the macro help page. |
| 11:38 | spariev | suppose I want iterate seq for side effects, what's more idiomatic - doseq or map wrapped with doall ? |
| 11:38 | Chousuke | I would say doseq |
| 11:38 | chouser | spariev: do you need the return value as well? |
| 11:38 | _invis | hi everyone |
| 11:38 | _invis | Hope you could help me |
| 11:39 | _invis | I want to use Emacs + CLojure... :) |
| 11:39 | arnihermann | Chousuke: thanks, will do |
| 11:39 | _invis | do all the same like here http://vimeo.com/2419596 |
| 11:39 | Chousuke | hm, that's a bit old. |
| 11:39 | _invis | but When I start emacs I have message Cannot open load file, clojure-auto |
| 11:40 | Chousuke | yeah. it's outdated :( |
| 11:40 | _invis | what I should update ? |
| 11:41 | spariev | chouser: ie I need to modify some java objects and doto won't fit |
| 11:41 | spariev | chouser: so I dont need return value |
| 11:42 | spariev | doseq feels so imperative |
| 11:42 | chouser | spariev: then yes, I'd suggest doseq. |
| 11:42 | polypus | ~ping |
| 11:42 | clojurebot | PONG! |
| 11:42 | spariev | chouser: thanks |
| 11:42 | Chousuke | spariev: that's the point. you're doing imperative things so make it look so :) |
| 11:42 | _invis | Guys plz help me to start emacs with clojure :( |
| 11:43 | spariev | yep, but it makes me sad :) |
| 11:43 | Chousuke | hm, I always forget what the best blog/source for installing emacs/clojure-mode is ;/ |
| 11:44 | _invis | I did 90% like in this video |
| 11:44 | _invis | and all was ok |
| 11:44 | _invis | but Cannot open load file, clojure-auto WTf it mean |
| 11:44 | Chousuke | it means it's trying to load a script that no longer exists. |
| 11:44 | _invis | it was in clojure-mode.el ?? |
| 11:45 | _invis | in 2008.. :( ? |
| 11:45 | Chousuke | something like that |
| 11:45 | _invis | hmm |
| 11:45 | Chousuke | _invis: I suggest you just install ELPA and use it to install the packages |
| 11:45 | _invis | so i just need to new emacs config |
| 11:45 | Chousuke | are you using the starter kit? |
| 11:45 | _invis | I trying ELPA |
| 11:45 | _invis | but it was bad |
| 11:45 | Chousuke | http://technomancy.us/126 |
| 11:47 | _invis | ty, i will try |
| 11:57 | chouser | how wrong would it be for me to use lazy-seq just for its ability to synchronously produce and cache a single value? |
| 11:58 | chouser | the natural solution would involve manual locking and perhaps an atom. |
| 12:00 | ldp | fliebel: I still can't get it to work. :/ |
| 12:01 | fliebel | I don't know how to help you… I just did what they said and after some trying it worked. I could pastebin the content of some files if you're in doubt. |
| 12:01 | chouser | oh! I should use a delay. that's better. |
| 12:02 | Chousuke | chouser: delays may be underused in Clojure :/ |
| 12:02 | Chousuke | At least, it's all too easy to forget that clojure has them, because there are so many neater tools available. |
| 12:03 | ldp | fliebel: can I have your vim rc and the location to where you copied the vimclojure files? |
| 12:03 | chouser | bleh, I need a delay that takes args. |
| 12:03 | psykotic | well, they're heavily used through lazy-seq, but not so much manually |
| 12:03 | Chousuke | chouser: a memoized function? :/ |
| 12:03 | psykotic | (doesn't lazy-seq call delay?) |
| 12:04 | Chousuke | ~def lazy-seq |
| 12:05 | Chousuke | apparently not :P |
| 12:05 | chouser | no, I need to do work with args the first time its called, have the cached item avaible directly afterwards, but if the fn is called again just complain. |
| 12:05 | fliebel | ldp: I think so… but I'm not sure anymore where they are. |
| 12:06 | Chousuke | hm |
| 12:07 | Chousuke | ,(let [a (#^{:once true} fn* [] (print "foo") 1) ] [(a) (a)]) |
| 12:07 | clojurebot | [1 1] |
| 12:07 | clojurebot | foofoo |
| 12:07 | Chousuke | what does that actually do? :/ |
| 12:09 | ldp | fliebel: ls ~/.vim perhaps? :/ |
| 12:10 | fliebel | ldp: http://pastebin.com/mK72wMxW is my vimrc |
| 12:11 | fliebel | but there was more to it... |
| 12:11 | Chousuke | don't forget the local.properties file |
| 12:12 | ldp | fliebel: doesn't work. :/ |
| 12:12 | Chousuke | how does it actually fail? |
| 12:12 | dakrone | I believe it should be let g:clj_highlight_builtins=1 ldp & fliebel |
| 12:12 | ldp | dakrone: Neither work |
| 12:13 | Chousuke | do you have the nailgun server running? |
| 12:13 | dakrone | okay, I'm coming into the conversation late, what's happening? |
| 12:13 | ldp | Chousuke: I don't want nailgun. :/ |
| 12:14 | Chousuke | ldp: then you need to remove the clj_want_gorilla thing I think |
| 12:14 | Chousuke | it depends on nailgun |
| 12:14 | dakrone | ldp: what error are you getting? |
| 12:14 | ldp | dakrone: There's no error, it just doesn't work. |
| 12:14 | dakrone | can you describe what part doesn't work? |
| 12:15 | ldp | syntax highlighting and rainbow paran |
| 12:15 | ldp | let me check if there's something wrong with ~/.vim |
| 12:16 | dakrone | ldp: do you see the same output from this: http://pastie.org/875642 |
| 12:16 | fliebel | ldp: did you add the file handler? I remember there was something to do berfore it enabled vim mode |
| 12:16 | dakrone | minus the eclim file |
| 12:16 | ldp | Yay, it works now. |
| 12:16 | ldp | I re-copied the files. |
| 12:16 | fliebel | what was wrong? |
| 12:16 | ldp | directory structure. |
| 12:16 | dakrone | must have been missing a file |
| 12:16 | ldp | Or that. |
| 12:16 | ldp | Rainbow parens are awesome. :) |
| 12:17 | Chousuke | :P |
| 12:17 | Chousuke | I don't even look at parens anymore |
| 12:17 | dakrone | they're quite useful for reading other people's code |
| 12:17 | ldp | Chousuke: I'm not used to parens, though. |
| 12:17 | ldp | Chousuke: braces, yes, but not parens. :p |
| 12:17 | ldp | Ruby has pampered me. |
| 12:18 | chouser | parens are critical in Clojure. huge difference in meaning between (foo) and foo |
| 12:18 | Chousuke | ldp: most of the time I don't need to care about where the parens are because paredit puts them in the right place. :) dakrone's point is valid though |
| 12:18 | dakrone | I was never really clear on what paredit does, does it just auto surround your code with parens? |
| 12:19 | Chousuke | dakrone: it maintains correct s-expression structure at all times |
| 12:19 | dakrone | oh okay |
| 12:19 | dakrone | there's no real good explanation of what it does for non-emacs users online that I could find |
| 12:19 | Chousuke | dakrone: unless you screw up somehow, it's impossible to write just "((" or "(let [foo))" in paredit |
| 12:20 | dakrone | Chousuke: what if you want to write ((func-that-returns-a-fn ...))? |
| 12:20 | The-Kenny | dakrone: that's no problem |
| 12:20 | Chousuke | you *type* ((func-that-returns-a-fn |
| 12:20 | Chousuke | and that's it. |
| 12:21 | The-Kenny | emacs insert a ) when you type a ( |
| 12:21 | dakrone | okay, I thought you said it would prevent you from writing ((, or does it evaluate enough to know that it's a valid form? |
| 12:21 | Chousuke | the thing is that if you have ((foo)), you can't delete the )) before you've deleted foo |
| 12:22 | Chousuke | using only backspace that is. of course, there are more advanced s-expr manipulation commands |
| 12:22 | ldp | I just wanted to say, you guys are pretty awesome. :) |
| 12:22 | ldp | Clojure is going to be fun to learn. |
| 12:22 | Chousuke | for example, paredit has a command that allows you to move foo so that ((foo)) becomes (foo ()) |
| 12:23 | miltondsilva | Chousuke: is there some tutorial that explains those commands? |
| 12:23 | Chousuke | http://mumble.net/~campbell/emacs/paredit.html there's this at least |
| 12:23 | chouser | in standard vi, that command is dwhP |
| 12:24 | miltondsilva | yes but I have no idea how to interpet that :P |
| 12:24 | Chousuke | chouser: imagine foo is an entire form. now what do you do? :) |
| 12:24 | miltondsilva | oh forget it |
| 12:25 | miltondsilva | I can see there are keys and the examples are more sane... I read some other version that I couldn't understand |
| 12:25 | dakrone | chouser: uhh... delete-word move-left paste-word |
| 12:25 | dakrone | chouser: so essentially it brings you right back to where you are |
| 12:25 | chouser | (((foo bar baz))) --> ((foo bar baz)()) is d%hP |
| 12:25 | dakrone | oh wait, P will paste previously |
| 12:25 | chouser | dakrone: right |
| 12:25 | dakrone | so paste it to the left by one space |
| 12:26 | dakrone | I read it as dwhp |
| 12:26 | The-Kenny | enebo: Yeah, that too :P |
| 12:26 | chouser | my point is not that stock vim has 100% the convenience of paredit |
| 12:27 | chouser | but that stock vim is a 90% solution for so many situations, including editing of clojure code, that it's difficult to justify the effort required to replace it, just for that last 10% :-/ |
| 12:27 | enebo | esj, The-Kenny: Yeah ^K is the shit...down with d$ :) |
| 12:27 | chouser | d$ == D |
| 12:27 | enebo | ah yeah |
| 12:27 | The-Kenny | enebo: In paredit, C-K is different to "delete to end of line" |
| 12:28 | dakrone | d$ == C |
| 12:28 | The-Kenny | In paredit, it kills sexps, not lines |
| 12:28 | enebo | heh...I joined this convo late with the accidental ping :) |
| 12:28 | esj | ;) |
| 12:28 | enebo | I regularly use both vi and emacs... |
| 12:29 | enebo | but emacs is like some mother ship always orbiting my screen somewhere...vi is for quick and remote edits |
| 12:29 | Chousuke | heh, yeah |
| 12:29 | miltondsilva | emacs = O.S. |
| 12:30 | Chousuke | emacs is more like the JVM than an OS |
| 12:30 | Chousuke | it's a platform |
| 12:30 | replaca | enebo: you know about emacsclient, right? |
| 12:30 | Chousuke | for editing whatever editable things you can imagine |
| 12:30 | The-Kenny | Editing files in jar-files without manually extracting and re-packing is cool |
| 12:31 | miltondsilva | never thought of it that way, but now that you mentioned it it makes more sense |
| 12:34 | duncanm | i propose renaming BUT-LAST in clojure.contrib.string to something like DROP-RIGHT |
| 12:35 | The-Kenny | Emacs even has the power to create a powerful agendas, spreadsheets and full-featured gtd-setups out of text files :) |
| 12:35 | chouser | duncanm: there's drop-last also |
| 12:35 | duncanm | oh, is there? |
| 12:36 | duncanm | not in clojure.contrib.string, according to the docs |
| 12:36 | duncanm | drop-last is good too |
| 12:36 | chouser | ,(drop-last 3 (range 10)) |
| 12:36 | clojurebot | (0 1 2 3 4 5 6) |
| 12:36 | duncanm | yeah |
| 12:37 | duncanm | so s/but-last/drop-last/ and it'll be golden |
| 12:38 | ldp | can anyone explain references to me? |
| 12:39 | duncanm | ldp: did you read up on it first? |
| 12:39 | ldp | I did, and I don't really understand. |
| 12:40 | enebo | replaca: yeah |
| 12:41 | technomancy | boo... c.c.string has but-last and clojure.core has butlast. =( |
| 12:41 | duncanm | technomancy: eeew, that's even worse |
| 12:41 | duncanm | ,(doc butlast) |
| 12:41 | clojurebot | "([coll]); Return a seq of all but the last item in coll, in linear time" |
| 12:41 | duncanm | ,(doc drop-last) |
| 12:41 | clojurebot | "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll" |
| 12:41 | technomancy | duncanm: what's worst is the similarities. butlast isn't a terrible name |
| 12:41 | chouser | butlast is eager |
| 12:41 | technomancy | easily discoverable with find-doc |
| 12:42 | duncanm | hmm |
| 12:42 | absalom | So I'm a bit confused about the various clojure emacs modes... I have ELPA. Which modes should I install? swank-clojure and clojure_mode? And swank-clojure relies on slime? |
| 12:42 | duncanm | the names i'm most familiar with are from SRFI-1 in Scheme, but I know that CL has its own set of names |
| 12:42 | technomancy | absalom: all you need is swank-clojure; see the swank-clojure readme on github for details. |
| 12:42 | absalom | ah, ok thanks |
| 12:42 | technomancy | the dependencies will get handled for you |
| 13:01 | crowb4r | , (doc drop-last) |
| 13:01 | clojurebot | "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll" |
| 13:05 | slyphon | technomancy: hey, do you know, if i want to turn on paredit mode in the slime-repl buffer, er, where do i hook that? |
| 13:05 | technomancy | slyphon: should be able to use slime-repl-mode-hook |
| 13:05 | slyphon | ah, ok |
| 13:12 | chouser | there's no way to test if a promise has already been delivered or not. oh well. |
| 13:14 | crowb4r | So, is there any good code completion for clojure. The api ref on the site is nice, but still. |
| 13:14 | slyphon | crowb4r: depends on what editor? |
| 13:15 | crowb4r | the la clojure module seems to work for intelij, but for say emacs or just anything else in general. |
| 13:16 | dnolen | crowb4r: if you're Emacs and Vim it's pretty easy to setup TextMate like snippets. slime autocomplete for symbols is pretty good. |
| 13:24 | abrenk | stuarthalloway: I just took a look at circumspec - nice! |
| 13:25 | abrenk | stuarthalloway: project.clj is missing ":namespaces [circumspec.AssertFailed]" |
| 13:25 | stuarthalloway | abrenk: thanks, hope it is useful |
| 13:26 | stuarthalloway | ah, I haven't been using lein compile |
| 13:27 | abrenk | perhaps it would be better to use a JDK provided exception? |
| 13:27 | abrenk | using circumspec in a clojure 1.1 project resulted in a VerifyError |
| 13:28 | stuarthalloway | abrenk: lein compile added to master |
| 13:28 | stuarthalloway | circumspec is targeting 1.2 |
| 13:28 | stuarthalloway | it probably would not be hard to get it to work with 1.1 but I won't be doing it |
| 13:29 | abrenk | yeah, I solved that |
| 13:29 | abrenk | but being tied to a specific clojure version just because of AssertFailed is a pity |
| 13:30 | stuarthalloway | if that is the only issue just change your local project.clj to point to 1.1 and rebuild from scratch and you should be good |
| 13:32 | remleduff | I've got this simple function that I've written called files-in-dir, I have it at this gist: http://gist.github.com/336602. How would I go about making it a varargs so that it works for any number of directories passed? |
| 13:34 | dnolen | remleduff: (fn [arg1 arg2 & rest] ...) |
| 13:35 | remleduff | Yeah, I know that much, but actually using &rest is what I'm a little hazy on |
| 13:36 | wooby | remleduff, maybe something like http://gist.github.com/336610 |
| 13:36 | wooby | remleduff, that has some issues (& rest conflicting with the other 2 arg definition), and i'm new to things myself |
| 13:36 | abrenk | stuarthalloway: already did that and it works, thanks. I just wanted to provoke some thoughts if perhaps it would be better to build the framework without the need for AOT compilation. |
| 13:37 | dnolen | remleduff: rest just packages up the remaining arguments into a list. |
| 13:37 | dnolen | rest -> & rest |
| 13:38 | stuarthalloway | abrenk: the issue is in run-test. If I use any preexisting exception to represent test assertions, then it complicates the logic for separating test failures from errors |
| 13:43 | chouser | that's got to be the one most reasonable driving force behind wanting to derive a named class from an abstract (non-interface) class |
| 13:43 | chouser | perhaps it would be worth a defexception in contrib that uses ASM directly so that no AOT is needed at all. |
| 13:44 | technomancy | +1 |
| 13:44 | stuarthalloway | is there a way to add two type hints to the same name |
| 13:44 | technomancy | sorry, inc |
| 13:44 | stuarthalloway | and yes I have a real use case |
| 13:44 | chouser | stuarthalloway: what would that mean? |
| 13:45 | stuarthalloway | that the reference object implements two interfaces, of course |
| 13:46 | stuarthalloway | or is there a way to add the type hint to the call instead of the name. |
| 13:46 | chouser | yeah, add it to the call if you can |
| 13:46 | stuarthalloway | what does that look like? |
| 13:46 | chouser | the way compilation is done, clojure needs to know exactly one interface in order to emit the efficient calling code |
| 13:47 | chouser | (.foo #^Fooable x) |
| 13:47 | slyphon | technomancy: btw. i meant to tell you, i read the INTRO.md, good work :) |
| 13:48 | abrenk | stuarthalloway: ah, okay, I see the "catch" in run-tests. perhaps you could get away with a magic "circumspec: " string in Throwable's message? |
| 13:49 | technomancy | slyphon: great; thanks for the bulk of the text. I think it could use some more polishing wrt flow, but it's great to have either way. |
| 13:49 | stuarthalloway | chouser: right, hmm, I am doing something stupid |
| 13:49 | crowb4r | dnolen: Actually I use textmate on OS X, but the clojure bundle I found looked old and outdated. |
| 13:49 | slyphon | technomancy: yeah, i realised after writing it that you cover some of the maven-ness in another page |
| 13:50 | stuarthalloway | chouser: it doesn't appear I can add to the call unless I am calling through a symbol |
| 13:50 | dnolen | crowb4r: yeah tho it looks like people have done a lot of fork on some forks, would be cool if something new emerged. Would probably greatly increase adoption on OS X at least. |
| 13:51 | stuarthalloway | e.g. (.stuff #^SomeType (some expr)) doesn't seem to hint |
| 13:51 | chouser | huh ... couldn't callsite caching as is done for keywords work for reflective method calls too? instantly banishing all type hints? |
| 13:51 | chouser | stuarthalloway: really? that surprises me... |
| 13:51 | stuarthalloway | me too |
| 13:52 | crowb4r | stuarthalloway: I have your book, seems pretty good. I'm about 100 pages in. |
| 13:52 | stuarthalloway | crowb4r: thanks |
| 13:52 | chouser | stuarthalloway: I've got a case that works here. you must have something else going on. |
| 13:52 | stuarthalloway | chouser: yeah :-( |
| 13:53 | chouser | (defn foo [] 5) (.intValue #^Integer (foo)) ; no reflection warning |
| 13:54 | crowb4r | stuarthalloway: No problem, I might use it for the basis in a intro clojure presentation for some university computer club I'm in. I'm going to have to present it from a C# and C/++ perspective. |
| 13:56 | crowb4r | So, does anyone see a use of a clojure AIM (the instant messenger) lib. Or is the JAVA one good enough? |
| 13:56 | crowb4r | I don't know how much the language is pushing for it's own libs vs the already existing JAVA ones. |
| 13:57 | chouser | crowb4r: very close to "not at all" :-) |
| 13:57 | noidi | crowb4r, you might as well have written C/++/# ;) |
| 13:57 | noidi | sorry, C/C++ is a pet peeve of mine :) |
| 13:57 | stuarthalloway | chouser: figured it out |
| 13:57 | stuarthalloway | when extending a protocol, you get the type tag for free (expected) |
| 13:57 | chouser | ah, right. |
| 13:57 | crowb4r | noidi: I thought of that after I wrote it. |
| 13:57 | stuarthalloway | but you cannot override it (odd!) |
| 13:58 | chouser | eh? You weren't trying to use a protocol name as a hint, were you? |
| 13:58 | crowb4r | chouser: cool, then I might write a AIM lib in clojure. |
| 13:59 | Raynes | crowb4r: It's idiomatic to make direct use of Java APIs, but alternative Clojure ones are awesome. Convenience wrappers around hard-to-grok Java libraries are nice as well. |
| 13:59 | Raynes | Such as clj-apache-http. |
| 14:00 | crowb4r | I see that a lot of clojure projects and libs on git-hub. Is that the pretty much official place to put projects, libs etc? |
| 14:00 | stuarthalloway | chouser: no. what I got into was a corner case that will almost never hit anyone |
| 14:00 | crowb4r | Raynes: I have not looked at the clj-apache-http lib, what makes it nice? |
| 14:00 | Raynes | If you use Git (and you should ;) ), Github is the canonical hub. |
| 14:00 | stuarthalloway | RandomAccess is a signal interface |
| 14:00 | stuarthalloway | but the actual interface you want for hinting is List |
| 14:00 | Raynes | crowb4r: Because it's easy to use and looks pretty without dots. ;) |
| 14:01 | Raynes | Java I/O APIs are a bitch. |
| 14:01 | stuarthalloway | so extend-protocol's free behavior is not what you want in this (hopefully very rare) case |
| 14:01 | crowb4r | Raynes: I started using git actually when I wanted to start using clojure. svn and bzr were what I worked with. |
| 14:02 | Raynes | So, github is the place where most Clojure people put their projects. |
| 14:03 | noidi | there are also some projects on google code and bitbucket |
| 14:04 | stuarthalloway | in the clojure community we prefer git for its affinity for the reference model: unrelated commits are commutative :-) |
| 14:04 | Raynes | kotarak doesn't count. |
| 14:04 | noidi | stuarthalloway, isn't that true for hg as well? |
| 14:05 | stuarthalloway | noidi: yeah :-) |
| 14:05 | Raynes | Bitbucket is for bitrot. |
| 14:05 | Raynes | ;) |
| 14:05 | technomancy | are there still active projects on google code? |
| 14:05 | duncanm | i like using hg |
| 14:05 | Raynes | But still, Github is the most used. |
| 14:05 | technomancy | jclouds still hosts their wiki there, but the code is moved to github |
| 14:05 | Raynes | technomancy: Doesn't CCW use it? |
| 14:05 | mabes | you can use hghub.com :) |
| 14:06 | Raynes | duncanm: Begon! EEEEEVEEEL OOONNNEEE!!! |
| 14:07 | duncanm | Raynes: why so religious? |
| 14:07 | Raynes | duncanm: I'm not. I'm just bored. :| |
| 14:07 | duncanm | Raynes: i have to work on Windows, i find hg to work much better on Windows than git does |
| 14:07 | duncanm | i have git installed too, but i always have line-ending issues |
| 14:08 | duncanm | if git worked on windows, i could use git instead, i suppose |
| 14:08 | slyphon | argh, "windows" |
| 14:08 | duncanm | the people in my lab run windows, so that's what i use |
| 14:09 | slyphon | technomancy: ok, packaging n00b question, i have a .jks file i need to package up in my jar, how do i go about doing that? |
| 14:09 | duncanm | java (swing) runs well on windows, i find swing on OS X to be a lot less robust |
| 14:09 | technomancy | slyphon: what's a .jks file? |
| 14:09 | slyphon | java key store |
| 14:09 | technomancy | probably put it in resources/ |
| 14:09 | slyphon | we have a self-signed cert for a SOAP endpoint i need to connect to |
| 14:10 | slyphon | technomancy: will that get bundled with the jar? |
| 14:10 | technomancy | ja |
| 14:10 | slyphon | wewt! |
| 14:11 | crowb4r | technomancy: You still doing telecommuting for work? Just wondered from the rudel post you did. |
| 14:12 | duncanm | i've been trying to learn more about Classloaders; I thought it's suppose to let me incrementally redefine things, but I've never seen that happen from Java |
| 14:12 | duncanm | with Clojure and SLIME, i get incremental redefinition working beautifully |
| 14:14 | technomancy | crowb4r: yeah, but we generally use screen now in order to make sharing repls easier |
| 14:14 | stuarthalloway | duncanm: classloaders allow redefinition, but not very incremental |
| 14:17 | duncanm | stuarthalloway: ah right, you wrote that book on Java, i have it ;-) |
| 14:18 | duncanm | stuarthalloway: do you know if that module work in jdk7 will make classloaders obsolete? |
| 14:18 | chouser | stuarthalloway: so, you want to extend a protocol to RandomAccess, but then implement methods of List |
| 14:19 | stuarthalloway | duncanm: I doubt obsolete, but honestly I don't follow it |
| 14:20 | dnolen | technomancy: any good resources on setting up collaborative coding in Emacs with screen? |
| 14:21 | technomancy | dnolen: just search for multiuser gnu screen... it's pretty simple; just a few screen configs you need to tweak |
| 14:21 | stuarthalloway | chouser: no longer wanting, now doing: http://gist.github.com/336674 |
| 14:21 | dakrone | dnolen: basically all you need is :multiuser on, :acladd <username>, screen -x <screenid> |
| 14:23 | duncanm | stuarthalloway: neat |
| 14:24 | crowb4r | technomancy: Screen would seem like a good way to go for sharing. a little screen -x and working together then just opening a new window in the session then being able to work on your own, but still in the same session. |
| 14:25 | crowb4r | I do like having a gui emacs though. the mouse is nice sometimes. |
| 14:26 | remleduff | stuarthalloway: What is the "nil" block where you define your actual functions in Indexed? |
| 14:27 | remleduff | Oh, just making (chop nil) return nil? |
| 14:27 | stuarthalloway | remleduff: yes |
| 14:28 | remleduff | Or is that (chop nil 5) return 5? |
| 14:30 | dnolen | technomancy: dakrone: thx, I guess the issue with screen is that only one person can control the cursor at a time? |
| 14:30 | dakrone | no, you can both type, you'll be competing with each other |
| 14:30 | lancepantz | is it possible to set an enviornment var for a task in lein? |
| 14:30 | technomancy | dnolen: yeah, that's usually what you want when you're pairing over voip |
| 14:30 | technomancy | but rudel does not have that restriction |
| 14:31 | technomancy | lancepantz: the JVM doesn't support setting environment variables =( |
| 14:31 | lancepantz | ouch |
| 14:32 | lancepantz | i have a config who's location i've been reading in from the environment |
| 14:32 | lancepantz | i also run the app from a war, so that files location changes if i'm in jetty |
| 14:32 | lancepantz | how does one go about that? |
| 14:32 | remleduff | stuarthalloway: chop returns the thing with one element removed from the end? |
| 14:33 | stuarthalloway | should so do |
| 14:33 | dakrone | technomancy: what about adding pre and post commands for leiningen tasks? then you could run a shell script |
| 14:34 | technomancy | dakrone: that's on the pipeline. setting the environment variables in a shell won't have any effect on the JVM process though. |
| 14:35 | dakrone | oh yea, that's true |
| 14:35 | chouser | stuarthalloway: ah, I see. And it was hinting the arg in the method's arg vector that didn't work? |
| 14:36 | stuarthalloway | chouser: right |
| 14:36 | crowb4r | I think it's time to write a better clojure textmate bundle. |
| 14:37 | _invis | Hi guys. I use this guide http://technomancy.us/126 but after all I want to use some functions like that (setq swank-clojure-jar-path (concat clojure-home "clojure.jar")) |
| 14:37 | _invis | (setq swank-clojure-extra-classpaths (list |
| 14:37 | _invis | (concat clojure-home "./") |
| 14:37 | _invis | (concat clojure-home "swank-clojure/") |
| 14:37 | _invis | (concat clojure-home "clojure-contrib.jar"))) |
| 14:37 | _invis | (require 'swank-clojure) |
| 14:37 | _invis | But ELPA dont use slime.el How I can fix that ? |
| 14:38 | lancepantz | technomancy: couldn't you just use export? |
| 14:39 | technomancy | lancepantz: that will only affect processes spawned by that shell session. maybe that's what you want? I dunno. but to affect clojure code you'd have to export before launching the JVM. |
| 14:40 | lancepantz | yeah that would be fine in my case |
| 14:40 | lancepantz | i think hooks are a good idea |
| 14:41 | lancepantz | second thing i've been trying to do, is there a correct way to do something like an ant exec tag in lein |
| 14:42 | technomancy | lancepantz: yeah, that is probably best done with lancet |
| 14:42 | technomancy | if you want a literal ant task to be run |
| 14:42 | lancepantz | know of any example projects that do that? |
| 14:43 | technomancy | just leiningen really |
| 14:47 | lancepantz | technomancy: so i basically just make a build.clj using lancet syntax, right? |
| 14:49 | technomancy | sort of... I don't know; I've never really used written ant builds; I've only ever called it through the Java API |
| 14:49 | technomancy | maybe they amount to the same thing |
| 14:59 | remleduff | Do arrays in general not play nice with collections? |
| 14:59 | remleduff | I've been trying to concat an array to a seq for a while, and it wasn't working the way I expected :) |
| 15:00 | chouser | ,(concat '(1 2 3) (into-array [4 5 6])) |
| 15:00 | clojurebot | (1 2 3 4 5 6) |
| 15:01 | remleduff | Hmmph |
| 15:02 | remleduff | OK, thanks, I'll have to blame my own code again somewhere |
| 15:02 | chouser | feel free to paste somewhere a specific example that isn't behaving the way you expect. |
| 15:03 | remleduff | I think it's my expectation of the shape stuff is in not matching the reality |
| 15:03 | remleduff | I mean, "shape" |
| 15:04 | abrenk | Should I use "with-bindings" oder "binding" if I want to set prxml-indent? I can't really see the difference. |
| 15:05 | chouser | if you know the var you want to set when you're writing your code, use "binding" |
| 15:07 | etate | is there something like parenscript in clojure? |
| 15:08 | abrenk | chouser: thanks |
| 15:10 | remleduff | Is my problem that I can't concat two lazy seqs together, maybe? |
| 15:11 | remleduff | Don't think that's it either really |
| 15:12 | remleduff | ,(concat (map inc [1 2 3]) (map inc [6 7 8])) |
| 15:12 | clojurebot | (2 3 4 7 8 9) |
| 15:14 | duncanm | hmm, if i have (([a b]) ([c d])), what do i do to get to ([a b] [c d]) ? |
| 15:14 | duncanm | i tried FLATTEN in clojure.contrib.seq, but it's too aggressive and got me to [a b c d] |
| 15:14 | duncanm | hmm |
| 15:14 | duncanm | maybe just first |
| 15:15 | dnolen | ,(reduce concat '(([a b]) ([c d]))) |
| 15:15 | clojurebot | ([a b] [c d]) |
| 15:15 | LauJensen | ,(map first '(([a b]) ([c d]))) |
| 15:15 | clojurebot | ([a b] [c d]) |
| 15:15 | dnolen | duncanm: ^ |
| 15:15 | LauJensen | dnolen: ^ |
| 15:15 | LauJensen | :) |
| 15:22 | Fossi | hi |
| 15:22 | Fossi | ah, now the ident works again |
| 15:28 | arohner | etate: http://github.com/arohner/scriptjure |
| 15:39 | dcnstrct | I'm just now experimenting with clojure's concurrency support and I'm trying to figure out what approach I should be taking. My program needs to do long running calculations on each item in a vector. Each thread just needs to process it's chunk and write it to a file so there is no shared state at all. What clojure concurrency primitives should I be looking at ? |
| 15:40 | dakrone | dcnstrct: you could check out pmap |
| 15:40 | dakrone | for parallel map |
| 15:40 | hiredman | dcnstrct: pmap + doall |
| 15:41 | dcnstrct | ah ha |
| 15:41 | dcnstrct | I knew there had to be something else I was missing because vars, refs, and agents are all about shared state and I don't have any |
| 15:41 | dcnstrct | I'll investigate pmap thnx guys |
| 16:11 | KirinDave | Are there any good examples of architecture of systems using clojure? |
| 16:11 | KirinDave | Like, specifically when it's right to use deftype and when it's better to just use data structures. |
| 16:14 | slyphon | gah |
| 16:14 | slyphon | has anyone else been bitten by the log4j maven stupidity? |
| 16:14 | slyphon | where it tries to grab javax.jms/jms which points to a url that returns a 301? |
| 16:17 | remleduff | How do I get the equivalent of String[].class ? |
| 16:17 | Chousuke | hmm |
| 16:17 | Chousuke | ,(class (make-array String)) |
| 16:17 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$make-array |
| 16:17 | Chousuke | ,(class (make-array String 1)) |
| 16:17 | clojurebot | [Ljava.lang.String; |
| 16:18 | bozhidar | bingo |
| 16:18 | bozhidar | :-) |
| 16:18 | remleduff | Thanks :) |
| 16:18 | Chousuke | ,Class/forName("[Ljava.lang.String;") ought to work too then |
| 16:18 | clojurebot | java.lang.Exception: Unable to find static field: forName in class java.lang.Class |
| 16:18 | Chousuke | .... |
| 16:18 | Chousuke | except with different syntax |
| 16:19 | remleduff | ,(RT/forName "[Ljava.lang.String;") |
| 16:19 | clojurebot | java.lang.Exception: No such namespace: RT |
| 16:19 | Chousuke | ,(Class/forName "[Ljava.lang.String;") this |
| 16:19 | clojurebot | [Ljava.lang.String; |
| 16:22 | slyphon | technomancy|away: leiningen appears to be ignoring my :exclusions on a dependency |
| 16:25 | StartsWithK | how can i alter var's root binding from java? |
| 16:26 | Chousuke | .alterRoot or something |
| 16:26 | Chousuke | on var objects |
| 16:26 | StartsWithK | it takse a IFn |
| 16:26 | StartsWithK | takes* |
| 16:26 | Chousuke | yes. so make one :) |
| 16:26 | StartsWithK | pff :) |
| 16:27 | hiredman | or use constantly from clojure.core |
| 16:27 | StartsWithK | ok, and how can i alter a var's root binding from java using reflection api :)) |
| 16:27 | hiredman | making an IFn in java is easy |
| 16:27 | hiredman | LispReader.java has examples |
| 16:28 | chouser | StartsWithK: theVar.doReset(value) |
| 16:28 | defn | Is the WTFPL too cheeky of a license? |
| 16:29 | slyphon | this log4j maven insanity is making me a little cranky |
| 16:31 | bozhidar | slyphon: what log4j version are you trying to use? I have no problems with 1.2.12, but I remember that newer versions had some crazy deps |
| 16:31 | bozhidar | at least on central |
| 16:31 | slyphon | i was trying to use 1.2.15 |
| 16:32 | slyphon | i guess i'll just use 1.2.12 |
| 16:32 | slyphon | i don't need any 1.2.15 functionality or anything |
| 16:32 | slyphon | bozhidar: ah, works like a charm, thanks |
| 16:32 | bozhidar | you're welcome |
| 16:33 | StartsWithK | chouser, doReset, swapRoot and bindRoot only work if i have (def foo) but if foo is already bound, it just keeps its old value |
| 16:33 | bozhidar | in case of such problems it's generally a good solution to check the deps on http://mvnrepository.com/ |
| 16:33 | StartsWithK | maybe i should unbind first |
| 16:34 | hiredman | StartsWithK: the binding shadows the root binding |
| 16:34 | bozhidar | that's how I found out that the log4j deps had changed between versions |
| 16:35 | StartsWithK | hiredman, but i need to do this from java, and i realy need to reset the value to new one |
| 16:35 | StartsWithK | and i need to use reflection.. |
| 16:36 | chouser | StartsWithK: doReset seems to work for me on a var that already has a value |
| 16:37 | StartsWithK | chouser, tried it from a repl? |
| 16:37 | StartsWithK | it works from me too that way |
| 16:37 | chouser | StartsWithK: yes |
| 16:37 | raek | hrm, clojure fns implement Runnable, but Runnables cannot be used as functions? |
| 16:38 | StartsWithK | but in java, using reflection, and when invoked from different classloader it dosn't |
| 16:39 | hiredman | raek: you have to implement IFn to be called as a function |
| 16:39 | chouser | StartsWithK: why are you using reflection? |
| 16:40 | hiredman | possibly when invokedynamic becomes widespread, or if IFn becomes a protocol you might be able to extend that to Runnable |
| 16:41 | hiredman | raek: have you looked at the asm clojure generates for a function call? |
| 16:41 | raek | not yet... :) |
| 16:41 | StartsWithK | chouser, i'm calling a clojure from a class that is used as interface in two classloader namespaces and one of them dosn't have a clojure loaded |
| 16:42 | raek | I'm just playing around with JVM assembly |
| 16:42 | hiredman | raek: it's just a call to one of the invoke methods on IFn |
| 16:42 | raek | ah, I suspected so |
| 16:42 | LauJensen | Tom Crayford in here ? |
| 16:42 | remleduff | Are the clojure-1.2.0-main-SNAPSHOT.jar's on build.clojure.org broken? I can't get them to open in Winzip |
| 16:42 | StartsWithK | maybe i should split that to a interface+class, so i don't have to use a reflection.. |
| 16:42 | hiredman | if you wanted to allow runnables you would have to insert a branch and each call site, or do some reflection |
| 16:43 | hiredman | s/and/at |
| 16:43 | raek | I see... |
| 16:44 | remleduff | Heh, google translate thinks that http://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/ is in Irish, and helpfully offers to translate it to english for me |
| 16:44 | hiredman | for a language that depends on function application, you want application to be as fast as possible |
| 16:46 | hiredman | which, when all is said and done, means having as little code to execute as possible |
| 16:47 | abrenk | technomancy: I just finished a leiningen plugin to create .project and .classpath for Eclipse / Counterclockwise |
| 16:48 | technomancy | abrenk: cool. does it not work to generate a project from the pom though? |
| 16:48 | abrenk | technomancy: What's the best way to get this integrated? fork on github? patch by email? |
| 16:48 | technomancy | abrenk: plugins don't need to get integrated |
| 16:48 | technomancy | just push it to clojars and everyone will be able to use it |
| 16:48 | hiredman | anyway, that is why runnables cannot be called as functions :) |
| 16:49 | abrenk | right, and then just add it as a dev-dependency... |
| 16:50 | StartsWithK | is it posible that my var's are already resolved at call sites, so i can't see the change? |
| 16:51 | chouser | StartsWithK: does the var have the word "clojure" in its namespace anywhere? |
| 16:51 | StartsWithK | chouser, no |
| 16:52 | dnolen | technomancy: have you looked at the unicode issues around jline? It looks like this has plagued jRuby as well. |
| 16:52 | chouser | StartsWithK: then no, I don't think that's possible |
| 16:52 | StartsWithK | chouser, ist something like (def *properties* (into {} (Stytem/getProperties)) and only function that will use it is (defn get-property [key] (get *properties* key)) |
| 16:53 | StartsWithK | what i have is a config file that defines several components to be loaded, each in its own classloader with fresh clojure |
| 16:54 | StartsWithK | and one of the thing config has is 'system properties' for one such component |
| 16:54 | StartsWithK | but if the clojure code is not loaded this way, i want it to default to system properties |
| 16:54 | StartsWithK | so it can work with or without this component system |
| 16:58 | chouser | sorry, I don't yet understand how multiple classloaders interact with clojure globals like namespaces and vars. |
| 17:00 | StartsWithK | ok.. this one is weird, my *properties* is global to jvm instance |
| 17:00 | raek | hrm, which JVM instruction does downcasting? |
| 17:00 | raek | IFns always return Objects... |
| 17:00 | chouser | don't you just invoke the thing? |
| 17:01 | chouser | I thought you had to specify the specific method to call (including the class or interface) rather than "casting" as such. |
| 17:01 | chouser | I could be way off though. |
| 17:01 | hiredman | raek: the ASM library has a user guide on their website that has a nice list of instructions |
| 17:02 | remleduff | I can't seem to download any jar from build.clojure.org except for 1.2.0 and get a valid file |
| 17:03 | hiredman | raek: if you are trying to unbox a primitive you checkcast to the corresponding reference type and then call the method on that type |
| 17:04 | raek | hrm, figured it out... |
| 17:04 | raek | was another error |
| 17:04 | raek | I thought I needed a Object -> String cast |
| 17:04 | raek | but I was going to send it to printLn anyway... :) |
| 17:06 | StartsWithK | in 20080916 Release notes, there is "added *use-context-classloader*, which can be bound to true to cause the thread's context classloader to be the parent of the dynamic classloader used during load" |
| 17:07 | StartsWithK | will that stop clojure from using system classloader? |
| 17:08 | raek | hiredman: do you have a link to that ASM library's website? |
| 17:09 | raek | would be interesting reading |
| 17:09 | hiredman | ~google java asm |
| 17:09 | clojurebot | First, out of 269000 results is: |
| 17:09 | clojurebot | ASM - Home Page |
| 17:09 | clojurebot | http://asm.ow2.org/ |
| 17:09 | hiredman | asm is what clojure uses to generate bytecode |
| 17:11 | raek | ah, ok. it's name is simply "ASM"... |
| 17:12 | slyphon | gah, clojure.contrib.logging is not finding commons-logging |
| 17:12 | slyphon | dammit |
| 17:15 | hiredman | has anyone used Couverjure? does it work? |
| 17:21 | slyphon | hiredman: what's that do? |
| 17:22 | hiredman | objective-c bridge |
| 17:22 | slyphon | ooh |
| 17:22 | slyphon | ka-wwaaaaaa-zee |
| 17:23 | slyphon | what clojure-contrib am i supposed to be using if i'm using the 1.1.0 release of clojure? |
| 17:23 | slyphon | "1.0-SNAPSHOT"? |
| 17:23 | slyphon | there's no "1.1.0-SNAPSHOT" |
| 17:28 | patrkris | slyphon: just walked in - are you using leiningen? |
| 17:29 | slyphon | yeah |
| 17:29 | slyphon | isn't eveybody? ;) |
| 17:30 | patrkris | you could add the clojure release repository at http://build.clojure.org/releases and then specify 1.1.0 for both clojure and clojure-contrib |
| 17:30 | slyphon | hm |
| 17:30 | patrkris | slyphon: see how clojars.org does it here: DmbSnI0V |
| 17:30 | patrkris | ooops |
| 17:30 | slyphon | :) |
| 17:30 | patrkris | netbank password!!!! |
| 17:30 | patrkris | no |
| 17:30 | patrkris | :) |
| 17:31 | slyphon | hahahaha |
| 17:31 | patrkris | http://github.com/ato/clojars-web/blob/master/project.clj |
| 17:31 | slyphon | ah, right on |
| 17:32 | hiredman | you should use a map |
| 17:32 | hiredman | {"repo-name" "url"} |
| 17:35 | slyphon | gah |
| 17:35 | slyphon | lein compile doesn't seem to be working for me |
| 17:37 | slyphon | hrm |
| 17:39 | slyphon | shit |
| 17:39 | slyphon | lein compile is now lying and saying "all :namespaces already compiled" |
| 17:40 | zaphar_ps | hello all |
| 17:40 | slyphon | zaphar_ps: IN OR OUT! jeez! pick one! |
| 17:40 | zaphar_ps | slyphon: having issues with irc today |
| 17:40 | slyphon | heh, apparently! :) |
| 17:40 | zaphar_ps | think I got it fixed now though |
| 17:40 | zaphar_ps | so I can ask my leiningen related question now |
| 17:40 | zaphar_ps | :-) |
| 17:41 | zaphar_ps | does it have issues with non-standard compile and library paths? |
| 17:41 | zaphar_ps | cause it seems to be having issues for me right now |
| 17:41 | zaphar_ps | lein deps works |
| 17:41 | zaphar_ps | but lein compile, lein repl, and lein swank do not |
| 17:43 | technomancy | slyphon: that's just a case of bad output |
| 17:44 | technomancy | slyphon: you haven't told it which namespaces to compile |
| 17:44 | slyphon | hrm |
| 17:44 | technomancy | and compiling all by default is bad |
| 17:44 | slyphon | ah |
| 17:44 | technomancy | "not recommended" rather =) |
| 17:44 | slyphon | how do i handle a case where one of my .clj files is dependent on another? |
| 17:44 | slyphon | i.e. i have com.foo.MyException which com.foo.main depends on |
| 17:45 | zaphar_ps | hrmmm lein clean also doesn't seem to work |
| 17:45 | slyphon | or, should i be using a proxy for that or something |
| 17:45 | tela | Is it possible to force an STM retry? It's not in the API, but I'm curious to see how you can get a hold of RetryEx. |
| 17:46 | zaphar_ps | technomancy: any insights on my question :-) |
| 17:46 | hiredman | tela: any particular reason you want to force a retry? |
| 17:47 | zaphar_ps | hrmmm lein clean also does not work |
| 17:48 | zaphar_ps | this is rather annoying |
| 17:48 | tela | at the moment, I'm just trying to abuse the transaction machinery a bit. I want it to retry not just on transaction violations, but also when the values I'm seeking aren't right. |
| 17:48 | hiredman | tela: that does sound like abuse |
| 17:49 | hiredman | why not loop around your transaction? |
| 17:50 | tela | it could be done that way, but I figured as long as I have a mechanism which follows the same structure as a transaction, I might as well use the transaction machinery I'm already invoking. |
| 17:50 | Chousuke | don't refs support validators? |
| 17:51 | tela | Hm. That could be a point to sneak a force in. |
| 17:51 | tela | I'm trying to write a bayesian graphical model sampler. It's not that values aren't appropriate, it's that sometimes a Metropolis sampling step rejects and I want that rejection to backpropagate |
| 17:51 | Chousuke | (doc set-validator!) |
| 17:51 | clojurebot | "([iref validator-fn]); Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validator-fn should return false or throw an exception. If the current state (root value if var) is not acceptable to the new validator, an exception will be thrown and the validator w |
| 17:52 | hiredman | tela: I do not recommend hijacking the mechanisms of the stm |
| 17:52 | Chousuke | I wonder what happens to a transaction if the validator fails |
| 17:53 | tela | hiredman: it's a stable thing in Haskell, that's the only reason I'm suggesting it |
| 17:53 | hiredman | for example, transactions will not be retried indefinitely |
| 17:54 | Chousuke | ,(let [a (ref 1)] (set-validator! a pos?) (dosync (alter a dec)) @a) |
| 17:54 | clojurebot | java.lang.IllegalStateException: Invalid reference state |
| 17:54 | Chousuke | aha |
| 17:54 | tela | I know. That's fine. The loop I'd optionally write would want to bail eventually, too. |
| 17:54 | hiredman | clojure's stm is still sort of a closed box, but at some point you should be able to tie stm transactions into otehr things |
| 17:55 | ska2342 | tela: I can't help thinking "Exception" if I read "backpropagate" .. |
| 17:56 | hiredman | :( |
| 17:57 | tela | ska2342: yeah, it'd be similar. I'd have to reimplement machinery to reset my refs manually though, I believe. Unless you can pass the ResetEx exception to run it through the STM machinery. |
| 17:59 | ska2342 | tela: I may be totally mistaken, but backpropagation has a lot of stack-unwind semantics, I think. So, recursion (the real one) and exceptions come up in my mind. However, I just skimmed the messages here and did no deeper thinking... |
| 18:00 | ska2342 | tela: unless I confuse backprop with backtracking right now, that is. ? |
| 18:02 | tela | ska2342: by backpropagation in this sense, I'm doing a calculation at a certain node in a tree. To perform it, you recurse to its children and do similar calculations, then use their new values to make that calculation. In some circumstances, it might reject and that rejection needs to happen in the children as well, reseting them all back to their initial values. |
| 18:02 | ska2342 | hiredman: did I step into a lesson of yours uninvited? if so: sorry. |
| 18:03 | Drakeson | How can I define metadata (e.g., for sake of documentation) for each argument in the definition of a function? |
| 18:04 | hiredman | ska2342: oh, no, please, I'm sure you know more about the specifics than I, I just don't like exceptions as flow control |
| 18:04 | hiredman | Drakeson: you put that stuff in the functions docstring |
| 18:04 | hiredman | locals don't get metadata |
| 18:04 | Drakeson | that's not good enough, I want to process that |
| 18:06 | Drakeson | e.g. (:arglists (meta (resolve 'some-function))) gives me the argument list |
| 18:06 | Drakeson | now I want to get more than just their names. |
| 18:06 | kotarak | ,(:arglists (meta (resolve 'defn))) |
| 18:06 | clojurebot | ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]) |
| 18:07 | kotarak | hmmm |
| 18:07 | ska2342 | hiredman: I can't say I know any specifics, so I think I'd better be quiet now. My use of Exceptions as flow control is probably influenced by CLs signals and restarts and not very Java'ish. |
| 18:08 | zaphar_ps | exactly what does one have to do to get the j2ee libs on a mac? |
| 18:09 | zaphar_ps | javax.* namespaces seem to be missing |
| 18:09 | hiredman | javax.* is not the samething as j2ee |
| 18:09 | Drakeson | zaphar_ps: give us an example |
| 18:09 | Drakeson | that is, what is missing? |
| 18:10 | powr-toc | technically speaking, what is an s-expression? Is it just a list datastructure? Or is a literal vector or hashmap classed as an s-expression too? |
| 18:10 | Drakeson | the whole javax.* ? |
| 18:10 | zaphar_ps | hiredman: using compojure basic hello world won't compile says NoClassDefFoundError: javax/servlet/ServletOutputStream |
| 18:10 | zaphar_ps | so where do I get j2ee from? |
| 18:10 | hiredman | zaphar_ps: you don't need j2ee |
| 18:10 | zaphar_ps | what do I need then? |
| 18:10 | hiredman | you just need to have the servlet stuff on your classpath |
| 18:11 | hiredman | it should come with compojure |
| 18:11 | zaphar_ps | the compojure jar is on the class path I thought |
| 18:11 | hiredman | zaphar_ps: yes, but there are a bunch of other jars compojure depends on |
| 18:12 | hiredman | if you built compojure from source they should be in the libs/ directory of the source tree |
| 18:12 | Drakeson | zaphar_ps: you probably need jetty, servlet-api, some commons-* stuff ..., you can get them from clojars |
| 18:12 | zaphar_ps | I did not I used lein with the clojars dependency that hiredman uploaded |
| 18:13 | hiredman | :| |
| 18:13 | hiredman | that was a mistake |
| 18:13 | zaphar_ps | ahhh |
| 18:13 | zaphar_ps | ok |
| 18:13 | zaphar_ps | is there a clojars upload that I can use or do I need to build from source |
| 18:14 | Drakeson | there is one. |
| 18:14 | hiredman | zaphar_ps: if you search clojars for compojure I would pick anyone that I didn't upload and try again |
| 18:14 | zaphar_ps | :-) |
| 18:14 | zaphar_ps | ahh ok then |
| 18:14 | Drakeson | zaphar_ps: [compojure "0.3.2"] |
| 18:14 | hiredman | ato is most likely a good bet |
| 18:15 | Drakeson | assuming you are using lein |
| 18:15 | zaphar_ps | Drakeson: I am |
| 18:16 | zaphar_ps | ahhh that looks better :-) |
| 18:16 | zaphar_ps | downloading much more stuff |
| 18:17 | zaphar_ps | and we have compiled it :-) |
| 18:25 | dcnstrct | do you guys bend to Java's will and use camelCase for all the variables in your programs ? Someone who had never seen clojure before looked at my code and asked me why half of my variables were-like-this but most of the method calls wereLikeThis |
| 18:25 | powr-toc | Does anyone here know what an sexpression is, specfically? |
| 18:25 | powr-toc | in Clojure as opposed to Lisp |
| 18:26 | dcnstrct | he said "why not just use camel case for all your variables if that's what java is using... after all this language is supposed to mix nicely with java.. |
| 18:26 | powr-toc | dcnstrct: No, absolutely not. Use foo-bar style for clojure code, and camelCaseForJavaMethods... It helps visually highlight when you're hitting java, and probably dealing with state |
| 18:27 | dcnstrct | I scoffed at him, but now I'm starting to wonder. |
| 18:28 | dcnstrct | ouuhhh good point.. state is supposed to stick out... it's a feature! |
| 18:29 | dcnstrct | clojure doesn't force you to wrap it in an ugly monad to make it stick out instead you just seeTheCamel |
| 18:29 | powr-toc | dcnstrct: Also, it helps for knowing where to look for docs... |
| 18:30 | powr-toc | Like wise for ClassNames etc... |
| 18:30 | powr-toc | leave java syntax for java |
| 18:31 | powr-toc | I mean java-style (not syntax) |
| 18:31 | dcnstrct | yeah I suppose one day we'll have so many nice clojure libs that a clojure programmer won't even need to see that many camels. |
| 18:57 | hiredman | remleduff: it's based on arity |
| 18:58 | hiredman | the compiler looks at the (foo 1 2) and compiles to, in java, foo.invoke(1,2); |
| 18:58 | remleduff | How can that work in the case of apply though? |
| 18:59 | hiredman | apply doesn't use invoke |
| 18:59 | alexyk | technomancy|away: are you away? |
| 18:59 | hiredman | ~def apply |
| 19:00 | alexyk | may be others would know: when doing lein deps in a directory with user.clj, where that has (use 'x) and x is to be downloaded by lein deps, lein chokes! |
| 19:00 | alexyk | is there a simple way to make lein ignore user.clj? |
| 19:01 | hiredman | no, because clojure loads user.clj, not lein |
| 19:02 | alexyk | hiredman: yeah, but I was still wondering for some hack. |
| 19:03 | hiredman | there is no way, unless you want to try and avoid loading user.clj all together |
| 19:03 | KirinDave | So, if I use deftype to replace a defstruct, will it still play nice in refs and such? |
| 19:03 | KirinDave | Is there an increased cost to using those things in refs and whatnot? |
| 19:04 | alexyk | man, an |away person leaves! ghosts! |
| 19:07 | alexyk | how do you abbreviate: (use 'long-x) (alias 'x 'long-x) |
| 19:08 | Chousuke | (use '[foo :as bar]) |
| 19:08 | KirinDave | What's the point of :as in (use ...)? |
| 19:08 | alexyk | kk |
| 19:08 | Chousuke | though you should use require :P |
| 19:08 | KirinDave | yeah seems pointless. |
| 19:09 | KirinDave | (use '[foo :as bar]) ; In which we lie in a way we are sure to regret later, for no other purpose than to prove we can. |
| 19:09 | alexyk | so what's the current clojure version? :) |
| 19:09 | alexyk | which folks are using? |
| 19:10 | Chousuke | I suppose you should target 1.1 if you don't need features from master |
| 19:10 | alexyk | Chousuke: and the master is 1.2.0-master-SNAPSHOT? |
| 19:12 | Chousuke | yeah |
| 19:14 | alexyk | so the world moves slowly |
| 19:14 | alexyk | good |
| 19:18 | polypus | i've got a defmulti, and i'd like one of my methods to convert any list or sequence into a vector. vectors should go through unchanged, and maps should not be handled. how should i proceed? |
| 19:33 | hiredman | http://gist.github.com/337053 |
| 19:33 | hiredman | it's really the little things that make me love clojure |
| 19:36 | TalkingHead | Hi all, noob question |
| 19:37 | TalkingHead | I'm running through a sequence like so: (doseq [cell row] |
| 19:37 | TalkingHead | and then getting the contents of each cell: (let [c (.getContents cell)] |
| 19:37 | TalkingHead | how do I put all these values back into a Vector or list? |
| 19:38 | hamza | use map instead? (map #(.getContents %) row) |
| 19:39 | hamza | will return a sequence |
| 19:43 | arohner | TalkingHead: or you can use 'for' as well |
| 19:50 | dcnstrct | is there a way to get an append version of clojure.contrib.duck-streams/write-lines ? |
| 19:50 | dcnstrct | if not then what is the most idiomatic way to append a line to a file ? |
| 19:50 | dcnstrct | if I use append-spit how do I add the newline ? |
| 19:51 | TalkingHead | arohner: How would you use the 'for' macro? I was looking at the documentation, but not comprehending yet. |
| 19:52 | arohner | TalkingHead: it looks exactly like your doseq call, except the body must have only one expression. It returns a seq of the return value of each call in the body |
| 19:52 | arohner | (for [cell row] (.getContents c)) |
| 19:55 | zaphar_ps | argh |
| 19:55 | zaphar_ps | http://pastie.org/876452 |
| 19:55 | zaphar_ps | why oh why would this error keep happening |
| 19:56 | zaphar_ps | it obviously compiles the class |
| 19:56 | zaphar_ps | but then says it's not there |
| 19:57 | hiredman | why are you referencing the class? |
| 19:57 | hiredman | can you pastebin start_this.clj? |
| 19:57 | zaphar_ps | http://pastie.org/876455 |
| 19:57 | zaphar_ps | there ya go |
| 19:58 | dcnstrct | so there is no nice way to append a line to a file is there ? Does this mean if I write an append-write-lines function I can possibly get my code into contrib ? |
| 19:58 | hiredman | - are not valid in java class names to being with |
| 19:59 | zaphar_ps | hrmmm |
| 19:59 | zaphar_ps | ok |
| 19:59 | hiredman | I don't know what your file names are |
| 19:59 | TalkingHead | arohner: thx, think I got it |
| 19:59 | zaphar_ps | they use underscores |
| 19:59 | hiredman | but clojure translates from - to _ when going from namespaces to files |
| 19:59 | zaphar_ps | that I new |
| 20:00 | zaphar_ps | but can I still use the dashes in the clojure code? |
| 20:00 | zaphar_ps | I can rename the stuff just fine |
| 20:01 | hiredman | zaphar_ps: yes |
| 20:01 | hiredman | what is this "servlet" on line 10? |
| 20:02 | zaphar_ps | I thought it was part of compojure? |
| 20:02 | zaphar_ps | I'm following some tutorials or trying to anyway |
| 20:02 | hiredman | have you looked at any compojure examples? |
| 20:03 | zaphar_ps | hrmmm renaming the classes without dashes worked |
| 20:03 | hiredman | I have not written a lot of compojure but I don't think that is right |
| 20:03 | zaphar_ps | hiredman: I'm following a compojure example right now |
| 20:03 | zaphar_ps | with slight modifications |
| 20:04 | hiredman | ok |
| 20:07 | zaphar_ps | well I get the servlet to launch now. |
| 20:07 | zaphar_ps | but I've got a whole host of other stuff to work through now :-) |
| 20:10 | Drakeson | I don't know if this has been reported ... lein deps copies stuff and then sits there apparently forever. |
| 20:11 | Drakeson | reverting the last two commits gets back to a usable state |
| 21:16 | Bira | Hello! I'm trying to install swank-clojure on my emacs 23, using ELPA as described in the documentation. But after it downloads the jars, I get an exception saying it couldn't find clojure/main. |
| 21:16 | Bira | (when I try to run M-x slime) |
| 21:16 | Bira | Is there something I'm doing wrong? |
| 21:22 | danlarkin | Hi there Bira :) |
| 21:24 | danlarkin | Bira: nothing comes to mind, I recommend waiting for technomancy |
| 21:25 | scgilardi | Hi Bira, I don't know why it's not working, but that symptom means it can't find the clojure jar in the classpath. |
| 21:25 | Bira | Hey there :). |
| 21:27 | Bira | Well, I had installed clojure through ClojureX a while ago, but I'm not sure it's influencing the process here. |
| 21:27 | Bira | swank-clojure downloaded clojure.jar, clojure-contrib, and its own jar into ~/.swank-clojure |
| 21:27 | scgilardi | does the contents of the *inferior-lisp* buffer show the classpath or any more detail? |
| 21:28 | Bira | One moment. |
| 21:29 | Bira | http://pastie.org/876544 |
| 21:29 | Bira | That's the content of *inferior-lisp*, and the names of the jars downloaded by swank-clojure |
| 21:29 | Bira | They look a little strange, I think/ |
| 21:35 | scgilardi | I just did M-X slime for the first time on my laptop, it downloaded those exact files, and then worked. Are you running emacs 23? You might also try moving your .emacs and .emacs.d out of the way (if you have them) and pointing .emacs.d (using a symlink) to a git clone of phil's emacs-starter-kit. |
| 21:39 | Bira | scgilardi: My .emacs.d is a clone of phil's emacs-starter-kit :). |
| 21:40 | clowbar | is it possible to get clojure 1.2 to work with slime? |
| 21:40 | Bira | I did make a few customizations, though, so I'll try to move those aside. |
| 21:40 | zaphar_ps | clowbar: is there some reason you think it wouldn't? |
| 21:40 | scgilardi | Bira: ok. are you on linux? ubuntu? |
| 21:42 | bmason | isn't there a macro that takes a sequence and unwraps it into an existing sequence? |
| 21:42 | bmason | e.g. [:div (unwrap [[:foo] [:bar]])] -> [:div :foo :bar] |
| 21:42 | Bira | gentoo. Emacs 23. |
| 21:43 | clowbar | zaphar_ps: I'm new to slime |
| 21:44 | slyphon | what? for has a :let modifier |
| 21:45 | Bira | Hm... same thing on a clean emacs-starter-kit. I guess I'm going to have to dig a little further. |
| 21:56 | brandonw | i can't seem to find the docs for it (if it exists), but is there a way to use a namespace foo.bar.baz so that you can do 'baz/a' and 'baz/b' but not 'a' or 'b'? |
| 22:01 | bmason | brandonw: like :rename? http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/refer |
| 22:03 | bmason | brandonw: this page is great for general namespace/use documentation: http://clojure.org/namespaces |
| 22:03 | scgilardi | (require '[foo.bar.baz :as baz]) or, from within an ns form, (:require [foo.bar.baz :as baz]) |
| 22:03 | brandonw | okay, thanks |
| 22:04 | brandonw | that works perfectly |
| 22:04 | scgilardi | you're welcome |
| 22:17 | brandonw | okay that was good |
| 22:17 | brandonw | that finally forced me to read the documentation for refer/require/use carefully, instead of just using use :) |
| 22:47 | dakrone | anyone done any work on redefing REPL stuff to print in color before? |
| 22:56 | remleduff | What causes clojure.main to get loaded? I see clojure.core getting loaded in RT#doInit, but haven't found clojure.main anywhere |
| 22:56 | arohner | remleduff: my guess would be the command line |
| 22:57 | sattvik | dakrone: I don't know of any such thing, but that would be really neat. |
| 22:57 | arohner | java -cp clojure.jar clojure.main |
| 22:57 | arohner | dakrone: I imagine it's fairly straight-forward. Just make the repl output the right characters |
| 22:57 | dakrone | sattvik: would be really awesome if you could colorize output based on return class and such |
| 22:57 | dakrone | like people do with IRB |
| 22:58 | hiredman | remleduff: I would make sure you are looking at a recent checkout of the source |
| 22:58 | hiredman | I seem to recall doIt just having a comment saying "you don't need to call this" in it |
| 22:59 | remleduff | That's true hiredman, but I'm trying to reflectively call RT in a separate classLoader |
| 22:59 | hiredman | you don't call RT |
| 22:59 | hiredman | you just load the class |
| 22:59 | slyphon | in soviet russia, RT calls *YOU* |
| 22:59 | hiredman | it has a static initializer block |
| 22:59 | slyphon | sorry |
| 23:00 | remleduff | I need to call RT.var("clojure.main", "repl") |
| 23:00 | remleduff | And then invoke that |
| 23:00 | hiredman | just do it |
| 23:00 | remleduff | It'll get loaded in the wrong classloader |
| 23:01 | hiredman | ((IFn)RT.var(...)).invoke(...) |
| 23:01 | remleduff | I have say, a clojure 1.1 classloader that is started by lein, and I've created a new one with trunk clojure in the classpath |
| 23:01 | remleduff | So I have to (Class.forName "clojure.lang.RT" true newClassLoader) to get the right RT |
| 23:02 | hiredman | are you sure you are loading a new RT? |
| 23:02 | remleduff | Yeah, I have it working if I call the method clojure.main.main |
| 23:03 | remleduff | But I want to call a clojure function instead |
| 23:08 | slyphon | hrmf |
| 23:09 | slyphon | if i have [{:a 1 :b 2} {:a 2 :b 3}] and i want to transform that to be {1 {:a 1 :b 2} 2 {:a 2 :b 3}}, er, how do i do that in a non-stupid way? |
| 23:11 | hiredman | ,(apply hash-map (interleave (iterate inc 1) [{:a 1 :b 2} {:a 2 :b 3}])) |
| 23:11 | clojurebot | {1 {:a 1, :b 2}, 2 {:a 2, :b 3}} |
| 23:12 | slyphon | well |
| 23:12 | remleduff | Woohoo! |
| 23:12 | slyphon | it's more that i want to create an index of the values of :a |
| 23:18 | hiredman | ,(reduce (fn [b {:keys [a] :as m}] (assoc b a m)) {} [{:a 1 :b 2} {:a 2 :b 3}]) |
| 23:18 | clojurebot | {2 {:a 2, :b 3}, 1 {:a 1, :b 2}} |
| 23:19 | hiredman | ,(reduce #(assoc % (:a %2) %2) {} [{:a 1 :b 2} {:a 2 :b 3}]) |
| 23:19 | clojurebot | {2 {:a 2, :b 3}, 1 {:a 1, :b 2}} |
| 23:20 | slyphon | brilliant |
| 23:21 | slyphon | hiredman: winnar! |
| 23:21 | slyphon | thanks |