2010-04-17
| 00:00 | technomancy | an excellent policy |
| 00:00 | slyphon | :D |
| 00:00 | technomancy | though unsustainable in the long term |
| 00:00 | slyphon | zeppo is our encoder client, groucho is our storage management system |
| 00:00 | slyphon | true |
| 00:00 | technomancy | my policy is characters from literature |
| 00:00 | slyphon | then i have to switch to stooges, i guess... |
| 00:00 | technomancy | I just haven't thought of a project awesome enough to merit the name Orestes. |
| 00:00 | slyphon | haha |
| 00:01 | technomancy | nor Gabriel Syme, for that matter. |
| 00:01 | slyphon | the funny thing is harpo is going to be our encoding job dispatch service, and his main role is going to be talking to zeppo |
| 00:01 | slyphon | you know, if you can't entertain yourself |
| 00:02 | slyphon | ahh |
| 00:02 | slyphon | how about "Harold Bloom"? |
| 00:02 | ajazz | hello! as i understand compojure is more about C controller. what do people usually use for M model and V view? |
| 00:03 | slyphon | dammit |
| 00:03 | slyphon | i was just about to send him a link to something |
| 00:04 | slyphon | bastard |
| 00:04 | technomancy | oh man, if you haven't read the Man who was Thursday... what a trip. |
| 00:04 | slyphon | technomancy: omg! "Yossarian"! |
| 00:05 | slyphon | technomancy: yeah, i'll check it out |
| 00:06 | technomancy | characters from literature still under copyright is iffy |
| 00:06 | slyphon | ajazz: here's some stuff i collected: http://delicious.com/slyphon/compojure |
| 00:06 | sexpbot | "slyphon's compojure Bookmarks on Delicious" |
| 00:07 | slyphon | i think sexpbot is just trying to defend against goatse.cx |
| 00:07 | slyphon | technomancy: yeah, true |
| 00:07 | slyphon | technomancy: i still remember when the twisted python guys got a cease-and-desist for using "twisted.sister" |
| 00:07 | technomancy | hah |
| 00:07 | slyphon | i was like "really? shouldn't they be glad someone remembers who the fuck they are?" |
| 00:08 | ajazz | hi, I've had problem with internet connection and I think I missed ansver on my question |
| 00:08 | slyphon | ajazz: see above |
| 00:08 | slyphon | ajazz: http://delicious.com/slyphon/compojure |
| 00:08 | sexpbot | "slyphon's compojure Bookmarks on Delicious" |
| 00:08 | slyphon | sexpbot: yes! thank you! |
| 00:09 | ajazz | thanks |
| 00:11 | slyphon | sure |
| 00:12 | slyphon | did 1.2 get released? |
| 00:12 | slyphon | or did someone just reformat stuff on clojure.org? |
| 00:12 | slyphon | oh, nvm, i'm retarded |
| 00:12 | technomancy | mmm... just ordered the Orson Welles production of the Man who was Thursday |
| 00:13 | confounds | heh |
| 00:13 | technomancy | should have done that years ago |
| 00:13 | slyphon | technomancy: is that the one that's set in germany |
| 00:13 | technomancy | the book is set in England and France |
| 00:13 | slyphon | ahh, right right |
| 00:13 | technomancy | I'd be surprised if the radio production changed that |
| 00:13 | slyphon | they make a movie out of it? |
| 00:14 | technomancy | oh man... gives me a thrill to think of the idea. |
| 00:14 | slyphon | :) |
| 00:14 | slyphon | why is there no def- ? |
| 00:14 | technomancy | not yet, but I have a friend who says if his startup Makes it Big that he will fund one. =) |
| 00:14 | slyphon | hahaha! |
| 00:14 | slyphon | nice :D |
| 00:16 | slyphon | man, i forgot what a nice platform linux can be for hacking in |
| 00:18 | remleduff | slyphon: Any rhyme or reason to when you use () vs [] in your ns macro? |
| 00:19 | slyphon | i started changing things over to using [] for the top level stuff, then () for the sub-names |
| 00:19 | slyphon | just found it easier to read |
| 00:19 | slyphon | but it's much less consistent than i'd like it to be |
| 00:20 | remleduff | I've been using () around :use/:require and [] everywhere else |
| 00:20 | slyphon | yeah, that's probably what i'll go back to doing |
| 00:25 | slyphon | what's an efficient way of creating a string with 25 "-"s in it? |
| 00:26 | slyphon | in ruby you just do "-" * 25 |
| 00:26 | hiredman | ,(apply str (take 25 (repeat \-))) |
| 00:26 | clojurebot | "-------------------------" |
| 00:26 | slyphon | ah |
| 00:26 | hiredman | ,(apply str (repeat 25 \-)) |
| 00:26 | clojurebot | "-------------------------" |
| 00:26 | slyphon | i had ,(apply str (take 25 (repeatedly (fn [] "-")))) |
| 00:26 | hiredman | (nth (iterate str -) 25) |
| 00:27 | slyphon | ,(apply str (take 25 (repeatedly (fn [] "-")))) |
| 00:27 | clojurebot | "-------------------------" |
| 00:27 | technomancy | heh |
| 00:27 | hiredman | hmmm |
| 00:27 | hiredman | that iterate won't work |
| 00:27 | hiredman | nuts |
| 00:27 | slyphon | :) |
| 00:27 | hiredman | ,reductions |
| 00:27 | clojurebot | #<seq_utils$reductions__730 clojure.contrib.seq_utils$reductions__730@193b8f> |
| 00:27 | hiredman | that won't work either |
| 00:27 | hiredman | hmmm |
| 00:28 | hiredman | ,(nth (reductions str (repeat \-)) 25) |
| 00:28 | clojurebot | "--------------------------" |
| 00:33 | hiredman | ,(int \-) |
| 00:33 | clojurebot | 45 |
| 00:33 | lrenn | ,(apply str (replicate 25 "-")) |
| 00:33 | clojurebot | "-------------------------" |
| 00:33 | hiredman | repeat is shorter than replicate |
| 00:35 | arbscht | ,(clojure.contrib.str-utils2/repeat \- 25) |
| 00:35 | clojurebot | "-------------------------" |
| 00:47 | technomancy | remleduff: http://www.assembla.com/spaces/clojure/tickets/299-clojure-main--e-disables-stdin |
| 00:47 | sexpbot | "#299 - clojure.main -e disables stdin (Test) | Clojure | Assembla" |
| 00:47 | technomancy | cross your fingers |
| 00:48 | remleduff | Sweet~ |
| 00:48 | technomancy | course sometimes it takes a while for simple patches like this to get applied. =( |
| 00:49 | technomancy | but I'm optimistic now that Stuart H got commit access things might improve |
| 00:50 | hiredman | embrace the power of community |
| 00:52 | technomancy | so I'm realizing always putting the dev-deps in lib is a bad idea for leiningen |
| 00:52 | technomancy | they sneak into the uberjar for one |
| 00:52 | technomancy | but also: the system classpath needs to include the dev-deps but not the main deps |
| 00:52 | technomancy | and the project classpath needs both |
| 00:53 | technomancy | so I'm thinking of keeping dev-dep jars in lib/dev/ |
| 00:53 | technomancy | thoughts? |
| 00:56 | slyphon | not a bad idea |
| 00:57 | slyphon | i used to do that with my scala code |
| 00:57 | lancepantz | i haven't really investigated, but how are they treated differently currently? |
| 00:57 | technomancy | lancepantz: they don't get pulled in by other projects that depend on your project |
| 00:57 | technomancy | and they should get left out of the uberjar |
| 00:58 | lancepantz | ah |
| 00:59 | remleduff | What about .lib for dev libs? |
| 01:00 | slyphon | ick |
| 01:00 | slyphon | hidden dirs ftl |
| 01:00 | technomancy | inclined against it |
| 01:00 | technomancy | slyphon: so it works OK in scala-land? |
| 01:00 | slyphon | yeah, sure |
| 01:01 | slyphon | well |
| 01:01 | slyphon | i mean, as long as you recurse |
| 01:01 | slyphon | i used to do all my startup stuff in rake |
| 01:01 | slyphon | so building the classpaths was pretty easy |
| 01:01 | slyphon | hell $(find lib -name '*.jar') would do the trick :) |
| 01:02 | technomancy | we recurse already when building the project classpath, when you want both |
| 01:02 | technomancy | and the root classpath only wants the ones inside lib/dev |
| 01:02 | technomancy | the downside (and this has been true all along) is that you can't override it in project.clj |
| 01:02 | technomancy | since it must be known at JVM boot-time |
| 01:02 | slyphon | oh |
| 01:02 | slyphon | lein repl should include ./test |
| 01:03 | slyphon | imho |
| 01:03 | technomancy | slyphon: it will now |
| 01:03 | technomancy | thanks to remleduff! |
| 01:03 | slyphon | nice! |
| 01:04 | technomancy | well, once this clojure patch gets applied |
| 01:05 | remleduff | Are you going to keep lein repl in the shell file or switch it to eval-in-project? |
| 01:06 | technomancy | eval-in-project, definitely |
| 01:06 | technomancy | it's already coded in the repl-fix branch |
| 01:06 | technomancy | just needs a little more work |
| 01:06 | technomancy | been waiting for this bug to be fixed for quite some time now |
| 01:07 | remleduff | Excellent :) |
| 01:07 | technomancy | lots of people get confused by lein repl being a shell task |
| 01:07 | technomancy | since it doesn't use the project classpath |
| 01:10 | slyphon | hah |
| 01:10 | slyphon | pimpmyemacs.com is available |
| 01:31 | defn | If only I could get xzibit to be the face of the site... |
| 01:34 | lancepantz | heh, if only there was an emac plugin for emacs |
| 01:34 | lancepantz | *s |
| 01:35 | defn | i want to do a television called "Pimp My Ride (with Emacs)" |
| 01:35 | defn | Emacs in the headrests, customizable elisp steering wheel, etc. |
| 01:35 | lancepantz | haha |
| 01:38 | technomancy | mmm... feels good to get back to hacking lein again |
| 02:06 | defn | yay |
| 04:15 | lancepantz | considering anyone is here |
| 04:15 | lancepantz | anyone know how to get around this: Can't refer to qualified var that doesn't exist |
| 04:20 | defn | lancepantz: context would be helpful, although i dont know for sure if i can help, it might help someone else |
| 04:21 | lancepantz | good point |
| 04:21 | remleduff | ,(foo/bar) |
| 04:21 | clojurebot | java.lang.Exception: No such namespace: foo |
| 04:23 | lancepantz | i have a macro in ns foo that that has a defn inside of it, when i call it from another ns, where i want the function to be defined, i get that error |
| 04:25 | defn | and you're (use)'ing the foo namespace in your other ns? |
| 04:26 | defn | either in the ns macro or via a (use 'foo)? |
| 04:26 | defn | make sure you don't have circular dependencies: foo uses bar, and bar uses foo, for example |
| 04:27 | lancepantz | i don't think so, let me put it on a gist |
| 04:27 | defn | also know that (foo/bar), means you need to be requiring foo in bar, not using it |
| 04:27 | defn | lancepantz: again, no guarantees -- im just thinking out loud here |
| 04:27 | lancepantz | yeah, appreciate it |
| 04:29 | remleduff | Can you gist a small example? |
| 04:30 | lancepantz | http://gist.github.com/369404 |
| 04:32 | lancepantz | the macro in utils works if i put it in the profile ns |
| 04:35 | remleduff | Does it work if you unquote "update" (~update) |
| 04:36 | lancepantz | actual: clojure.lang.Compiler$CompilerException: java.lang.Exception: Unable to resolve symbol: update in this context |
| 04:36 | lancepantz | crap, i have to run |
| 04:55 | remleduff | lancepantz: My last guess, is that you need: ~'update |
| 06:48 | zmila | ,(doc amap) |
| 06:48 | clojurebot | "([a idx ret expr]); Maps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting each element of ret to the evaluation of expr, returning the new array ret." |
| 07:36 | defn | morning all |
| 07:37 | djpowell | hi |
| 07:39 | lancepantz_ | hi |
| 07:40 | lancepantz_ | well i think i got that ns stuff figured out |
| 07:40 | lancepantz_ | took me about 10 hours :) |
| 07:44 | defn | :) |
| 07:44 | defn | lancepantz: what was the problem? |
| 07:49 | lancepantz_ | the macro was expanding into the namespace of the project it was dined in |
| 07:49 | clojurebot | Barking spiders! |
| 07:50 | lancepantz_ | instead of the one calling |
| 07:50 | lancepantz_ | so for now i'm going to have it use eval, which should work |
| 07:50 | lancepantz_ | but i might need to give further fault to what i'm trying to do |
| 07:50 | lancepantz_ | make sure its the right way |
| 07:51 | lancepantz_ | give further thought that is |
| 07:51 | lancepantz_ | that's 18 hours straight of clojure |
| 07:51 | lancepantz_ | i think i can call it a night with that |
| 08:00 | defn | lancepantz: oh right! |
| 08:01 | defn | lancepantz: perhaps you don't want to use defn? |
| 08:03 | defn | lancepantz: err maybe gensym (defn update#...) ? does am i crazy? |
| 08:03 | defn | s/does// |
| 08:06 | defn | lancepantz: actually, i think i may have an idea... would leveraging metadata (:namespace, for isntance) be useful? |
| 08:06 | defn | lancepantz: er :ns |
| 08:20 | lancepantz_ | that's good idea defn |
| 08:20 | lancepantz_ | i'll give it a shot in the morning |
| 08:22 | lancepantz_ | spent all night reading graph theory papers.... again |
| 08:26 | defn | lancepantz: fun :) |
| 08:33 | defn | lancepantz: we'll have time to relax when we're dead |
| 08:47 | kzar | I'm trying to get my new project working. When I do (use 'controls.server) it tries to open controls/server.clj which isn't found because I've structured things like controls/src/server.clj . Should I put everything inside controls/ or is there a setting I should change? |
| 08:52 | djpowell | your folder structure needs to match everything up to the last component of the package name, and the filename has to match the last component of the package name. |
| 08:52 | djpowell | and then you need to make sure that the root folder is on your classpath |
| 08:54 | cemerick | rhickey: ping |
| 08:54 | rhickey | cemerick: pong |
| 08:56 | cemerick | rhickey: morning :-) A simple case of compilation failure FYI: http://paste.lisp.org/display/97911 |
| 08:57 | cemerick | funny, I thought the duplicate key check was only on literals |
| 08:58 | cemerick | hrm, nope, createWithCheck right there in hash-map |
| 09:02 | rhickey | cemerick: thanks, will fix |
| 09:03 | cemerick | rhickey: thanks :-) |
| 09:05 | cemerick | so the alternative if you might have duplicate keys is (into {} (map vec (partition 2 [:a 5 :a 6])))) |
| 09:05 | cemerick | ? |
| 09:06 | rhickey | cemerick: yup |
| 09:34 | defn | kzar: for your folder structure your project.clj should show the name of the project as "controls" |
| 09:34 | defn | kzar: are you using leiningen? |
| 09:36 | kzar | defn: Yea I'm using Leiningen, arbscht in #compojure helped me a bit. I had structured things wrong. I had done controls/src/server.clj but I needed to do src/controls/server.clj . Although to me it seems counterintuitive way to lay things out |
| 09:37 | tcrayford | is there an easy way to find all parts of a tree that match a certain predicate? |
| 09:37 | kzar | defn: (I say that because then I've got something like controls/project.clj and controls/src/controls/server.clj, seems a bit redundant) |
| 09:37 | rhickey | how does one build contrib without running the tests? |
| 09:38 | rhickey | when test fail no jar is produced |
| 09:39 | tcrayford | I'm currently using http://paste.lisp.org/display/97914 for finding all map lookups inside a tree, but it feels pretty inelegant |
| 09:41 | rhickey | is there a way to get maven to show you possible targets/tasks? |
| 09:55 | Norrit | rhickey, you could use -Dmaven.test.skip=true to ignore the tests |
| 09:55 | rhickey | Norrit: thanks |
| 09:56 | Norrit | you're welcome |
| 10:21 | rfg | Does the latest version of slime work with clojure 1.2 yet? |
| 10:21 | YamNad | Yes. |
| 10:24 | cYmen | Bonjour. |
| 10:24 | cYmen | I'm trying to get started on clojure but the installation instructions for vimclojure talk about clojars, leining, build environments or whatever and I can't figure out where to start. |
| 10:26 | cYmen | What I have done: Download and unzip clojure and clojure-contrib and tried out the repl. |
| 10:26 | cYmen | I also copied the usual vim plugin parts of vimclojure where they belong and that seems to work. |
| 10:29 | tcrayford | for lein, go to its github site and download/install it according to the instructions there |
| 10:33 | cYmen | tcrayford: well it doesn't really say lein it says leining/gradle/maven/ivy |
| 10:33 | cYmen | so I don't know which to get.. |
| 10:36 | tcrayford | go for lein |
| 10:36 | tcrayford | its the standard these days |
| 10:36 | cemerick | rhickey: maven doesn't have targets or tasks -- there's a default lifecycle, which has a fixed set of phases (clean, compile, package, install, deploy, verify, test, etc) |
| 10:37 | tcrayford | http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Vim might help you |
| 10:37 | sexpbot | "Getting Started with Vim | Clojure | Assembla" |
| 10:37 | cemerick | rhickey: 5 minute read on the above: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html |
| 10:37 | sexpbot | "Maven - Introduction to the Build Lifecycle" |
| 10:38 | tcrayford | though it doesn't really cover using the advanced features of vimclojure |
| 10:38 | tcrayford | http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Leiningen covers lein |
| 10:38 | sexpbot | "Getting Started with Leiningen | Clojure | Assembla" |
| 10:38 | cYmen | sexpbot: Are you talking to me? |
| 10:39 | cemerick | cYmen: no, it parrots the titles of all pasted urls :-/ |
| 10:40 | cYmen | ah, how pleasant :) |
| 10:42 | cYmen | well..now I have leiningen |
| 10:42 | cYmen | How do I add something to my "development dependencies" as the vimclojure readme wants it... |
| 10:43 | tcrayford | you have to create a project and put things in project.clj in the root of said project |
| 10:44 | cYmen | I don't know. Getting to the repl is dead simple... |
| 10:44 | cYmen | And setting up vim for any kind of lispy development has never been pretty.. |
| 10:45 | cYmen | But a standard build process would be nice |
| 10:45 | tcrayford | lein is that standard build process |
| 10:45 | tcrayford | just about |
| 10:45 | cYmen | ok |
| 10:46 | tcrayford | labrepl is pretty awesome if you're learning clojure |
| 10:48 | cemerick | There's a lot of tooling denominations in clojure-land. Each group has its own way. |
| 10:49 | cYmen | Yeah, but somebody needs to write an "Idiots guide to clojure development in vim." |
| 10:49 | cYmen | Is there something like that somewhere? |
| 10:50 | cemerick | cYmen: this is the best there is, AFAIK: http://www.assembla.com/wiki/show/clojure/Getting_Started |
| 10:50 | sexpbot | "Getting Started | Clojure | Assembla" |
| 10:50 | tcrayford | the easy way is probably just to use a repl and plain old vim |
| 10:51 | tcrayford | lein only really comes into play when you're doing projects/want more functionality than repl/vim gets you |
| 10:51 | cemerick | I'm always astonished that anyone uses vim for lisp-related development. |
| 10:51 | tcrayford | I can understand it |
| 10:51 | tcrayford | when you're entrenched in vim, going to emacs feels very difficult |
| 10:52 | cemerick | yeah, inertia is a big factor in any case |
| 10:53 | cemerick | probably the biggest, actually |
| 10:53 | tcrayford | yeah |
| 10:53 | cemerick | the actual productivity differences for straight editing of code is probably effectively nil |
| 10:53 | tcrayford | I think I'm slightly faster in vim for straight text editing |
| 10:54 | tcrayford | but when you put paredit into play... |
| 10:55 | cemerick | well, I don't use emacs either :-) |
| 10:55 | tcrayford | what do you use? |
| 10:55 | cemerick | netbeans and enclojure |
| 10:55 | tcrayford | fair nuff |
| 10:56 | cemerick | though I've been eyeing the progress of other IDE plugins as well |
| 10:56 | tcrayford | I'd miss refactoring support :/ |
| 10:56 | cemerick | refactoring support? |
| 10:56 | tcrayford | I wrote a refactoring tool for clojure/emacs/slime |
| 10:57 | cemerick | anything more than orchestrated grep? :-) |
| 10:57 | tcrayford | yeah |
| 10:57 | tcrayford | I can thread/unthread expressions (using both ->> and ->), add map destructuring to functions automatically |
| 10:57 | mefesto | hey everyone. noob here. just wondering what is meant behind putting an asterik at the end of a function's name? |
| 10:58 | cemerick | mefesto: that generally indicates a subordinate fn to the primary non-asterisk'ed fn |
| 10:58 | tcrayford | and extract method works well enough |
| 10:58 | cemerick | tcrayford: linky? |
| 10:58 | cemerick | it all sounds great, and just a little scary |
| 10:59 | tcrayford | its not that sound yet |
| 10:59 | tcrayford | as in, you want to have tests on code you're running through it |
| 10:59 | mefesto | cemerick: so typically only used by the non-asterik'ed fn? |
| 10:59 | tcrayford | http://github.com/tcrayford/clojure-refactoring |
| 10:59 | cemerick | mefesto: generally, yeah. You also often see asterisk'ed fns backing up a non-asterisk'ed macro of the same name that adds some sugar, etc. |
| 11:00 | tcrayford | the backend is all in clojure, so you could probably write a frontend to it for anything else (assuming you have a running clojure connection) pretty easily |
| 11:00 | mefesto | cemerick: ok i understand, thanks :) |
| 11:01 | tcrayford | I've been meaning to play around with clojure's namespacing functions so I can do proper function renaming and inlining (neither of those are implemented at all yet) |
| 11:02 | cemerick | were there ever any successful refactoring systems for CL or scheme? |
| 11:02 | tcrayford | I don't know |
| 11:02 | tcrayford | not sure anybody ever tried it |
| 11:02 | tcrayford | its super easy with the whole code=data thing |
| 11:03 | cemerick | It'd take quite a bit of convincing for me to use a refactoring tool in a dynamically-typed lang. |
| 11:03 | tcrayford | aye |
| 11:04 | cemerick | *if* we could get everyone to use require and properly namespace their fn usage, then I might trust renames. :-) |
| 11:04 | tcrayford | smalltalk's one for example |
| 11:04 | tcrayford | yeah I'm still iffy about actually implementing renames |
| 11:05 | tcrayford | the current stuff is all local to one function |
| 11:07 | technomancy | refactoring in clojure is a *lot* easier than stuff like Ruby |
| 11:07 | tcrayford | c |
| 11:07 | tcrayford | *confirm |
| 11:07 | technomancy | since just loading a file can tell you all about what vars mean what |
| 11:08 | technomancy | for top-level vars at least |
| 11:08 | tcrayford | yep |
| 11:08 | tcrayford | I need to get onto doing renames using the ns functions soon |
| 11:08 | technomancy | tcrayford: actually what we need to do is get slime xref working |
| 11:08 | technomancy | that would make renames super-easy |
| 11:08 | tcrayford | technomancy: xref? |
| 11:09 | technomancy | cross references. "given this function, tell me everyone who calls it" |
| 11:09 | tcrayford | aye |
| 11:09 | tcrayford | I was about to write something similar for refactoring-mode |
| 11:10 | tcrayford | can I use slime with slime? |
| 11:10 | technomancy | well all the elisp for it already exists |
| 11:10 | technomancy | you'd just have to port the CL implementation to Clojure |
| 11:10 | tcrayford | right |
| 11:10 | technomancy | "just" |
| 11:11 | tcrayford | is there a common lisp implementation I should be looking at for that? |
| 11:14 | technomancy | http://github.com/nablaone/slime/blob/master/swank-backend.lisp#L907 |
| 11:15 | tcrayford | cheers |
| 11:17 | technomancy | that would be super-slick to have |
| 11:18 | tcrayford | aye |
| 11:21 | cemerick | rhickey: defrecord/type names should be CamelCase, yes? |
| 11:21 | rhickey | cemerick: yes |
| 11:22 | tcrayford | technomancy:If I'm right, this should go under src/swank/commands/basic? |
| 11:22 | cemerick | just checking |
| 11:22 | tcrayford | technomancy: seeing as there's already some basic xref (who specializes) stuff in there |
| 11:22 | cemerick | there'll be pitchforks raised for that ;-) |
| 11:22 | rhickey | cemerick: and not Camel-Case |
| 11:22 | cemerick | heh |
| 11:23 | cemerick | I'd hope not! |
| 11:23 | cemerick | heh, Read-JSON-From |
| 11:23 | cemerick | well, it's changeable. Surely no one's extended it elsewhere at this point. :-) |
| 11:24 | cemerick | big improvement there since 1.1 contrib |
| 11:26 | djpowell | oops - I posted a patch to contrib' assemba space, rather than clojure - I guess I just have to close the issue, and raise a new one |
| 11:26 | technomancy | tcrayford: sure |
| 11:31 | tcrayford | technomancy: this might be a while, got to get to grips with how swank-clojure is organised first |
| 11:38 | tcrayford | technomancy: the real problem (as I see it), is that who-calls (etc) all take function names, where for clojure you want namespace qualified function names |
| 11:39 | tcrayford | otherwise you might be find all the calls to 'join' (for example), which might refer to somebody's string utils, somebody's sql lib etc etc etc |
| 11:44 | mefesto | i noticed that add-classpath is deprecated. is it meant to force users to call (clojure.lang.RT/addURL) instead? |
| 11:48 | rhickey | mefesto: dynamically modifying the classpath is not something that can be made to work portably in all execution environments, i.e. it shouldn't be in your code. |
| 11:50 | tcrayford | what does #'sym expand out into? |
| 11:52 | tcrayford | nvm, it's var |
| 11:55 | mefesto | rhickey: ok. i just wanted something that would support a quick write/reload cycle while in development mode but wouldn't be used when deployed. |
| 11:58 | tcrayford | anybody know why this won't evaluate? |
| 11:58 | tcrayford | (defn does-namespace-refer-to-var? [variable namespace] |
| 11:58 | tcrayford | (some #(= (second %) (var variable)) (ns-map namespace))) |
| 11:58 | tcrayford | error is: "Unable to resolve var: variable in this context" |
| 12:02 | Borkdude | When syntax-quoting something with locals, how do keep them from resolving to fully qualifying names |
| 12:02 | tcrayford | ~' |
| 12:02 | clojurebot | I don't understand. |
| 12:03 | tcrayford | ,`(~'defn [a] 1) |
| 12:03 | clojurebot | (defn [sandbox/a] 1) |
| 12:03 | Borkdude | ah tnx |
| 12:03 | tcrayford | ,`(~'defn [~'a] 1) |
| 12:03 | clojurebot | (defn [a] 1) |
| 12:16 | tcrayford | technomancy: also swank might have to add contrib as a dependancy (it doesn't have it atm) |
| 12:19 | technomancy | tcrayford: what for? |
| 12:20 | tcrayford | source |
| 12:20 | tcrayford | in repl-utils |
| 12:20 | technomancy | it's already able to find where a var is defined using M-. |
| 12:20 | technomancy | could probably piggy-back off that mechanism |
| 12:20 | tcrayford | would be easier with source though |
| 12:21 | technomancy | well do whatever's easiest for a first run |
| 12:21 | technomancy | then we can iterate on a more self-contained approach once it works |
| 12:22 | tcrayford | yep |
| 12:44 | bpsm | I'm seeing intermittent crashes when mvn runs test-complex-numbers. |
| 12:45 | bpsm | Race condition in protocols? |
| 12:45 | bpsm | http://groups.google.com/group/clojure/msg/7b667f653513b769 |
| 13:05 | rfg | Yay, finally got 1.2 to work with slime. |
| 13:23 | rfg | And now it has stopped working again... |
| 13:28 | rfg | Symbol's function definition is void: swank-clojure-reset-implementation? |
| 13:53 | Raynes | (clojure.contrib.io/slurp* "http://groups.google.com/group/clojure/browse_thread/thread/5007718945a3046f") <- Any idea why this throws a "Server returned HTTP response code: 403 for URL:"? |
| 13:53 | Raynes | The link works. |
| 13:56 | vegai | Raynes: also wget does the same |
| 13:56 | Raynes | That's odd. |
| 13:56 | Raynes | Firefox says it's okay. |
| 13:56 | Raynes | :( |
| 13:56 | vegai | perhaps it's some authentication scheme that the dumb clients can't do |
| 13:56 | Raynes | Maybe so. |
| 13:57 | Raynes | It certainly takes away most of the point of having a title-scraping bot in here though. :| |
| 13:57 | Raynes | It would be most useful against groups links. |
| 13:59 | vegai | have you tried setting your user-agent to look like a browser? |
| 14:02 | Raynes | I'm not sure how I would do that. |
| 14:02 | vegai | me neither ;) but that might work |
| 14:02 | Raynes | Hehe. |
| 14:18 | @chouser | did direct binding show up in 1.1, or since then? |
| 14:18 | @chouser | sorry, "direct linking" |
| 14:20 | @chouser | looks like it was in 1.1 |
| 15:11 | caljunior | I'm doing the Vladimir Konrad's tutorial on creating a GUI with Netbeans and using it with Clojure. But when I try to import the Java class (MainFrame.class in this case) I get a class not found exception. CLojure is looking for MainFrame__init.class. |
| 15:11 | caljunior | The tutorial is here: http://www.dearm.co.uk/cgan/ |
| 15:11 | sexpbot | "Clojure, GUI and NetBeans" |
| 15:11 | caljunior | Is excellent. |
| 15:12 | texodus | Has the api for deftype/defprotocol changed recently? |
| 15:13 | texodus | just updated clojure-1.2.0-master-SNAPSHOT from clojars and factory function for deftype doesnt seem to exist anymore ... |
| 15:13 | hoeck | texodus: yes, use the constructor instead |
| 15:13 | texodus | what constructor? |
| 15:13 | hoeck | texodus: (deftype Foo [a b] ...) -> (Foo. a b) |
| 15:13 | texodus | (deftype Foo [x y]) -> (Foo. 1 2) ? |
| 15:14 | texodus | ah |
| 15:14 | hoeck | Foo. is the constructor |
| 15:14 | caljunior | sexpbot: that's how I found the tutorial. I followed it to a tee. |
| 15:14 | hoeck | should be documented in deftypes docstring |
| 15:16 | texodus | 'tis |
| 15:16 | texodus | thanks |
| 15:16 | hoeck | caljunior: sexpbot is a bot and only prints the title of posted links :) |
| 15:17 | joshua-choi | So you use (Foo. 1 2) instead of (Foo now)? |
| 15:17 | hoeck | yes |
| 15:17 | caljunior | hoeck: doh! |
| 15:17 | hoeck | and there is now deftype and defrecord |
| 15:18 | joshua-choi | defrecord is just deftype with IPersistentMap, right? |
| 15:18 | hoeck | right |
| 15:18 | hoeck | caljunior: and you did (import 'gui.MainFrame) ?? |
| 15:18 | texodus | ah |
| 15:18 | texodus | clever |
| 15:18 | texodus | thats helpful |
| 15:19 | caljunior | hoeck: I did. |
| 15:19 | caljunior | more familiar with clojure than java |
| 15:19 | tcrayford | is there any decent way to find out if a namespace actually USES another function it refers to? |
| 15:20 | caljunior | hoeck: correction. I didn't. Misread your suggestion. |
| 15:21 | hoeck | caljunior: you did use or require? |
| 15:21 | caljunior | hoeck: seems to make a difference. Now I get a different NoClassDefFoundError. This is progress. |
| 15:21 | tcrayford | Currently I've been looking up the source code of each var in the namespace to find if it calls said function, but that requires disk access, and is slow |
| 15:23 | caljunior | hoeck: with (use 'gui.MainFrame) and (require 'gui.MainFrame) I get java.io.FileNotFoundException: Could not locate gui/MainFrame__init.class |
| 15:23 | hoeck | caljunior: use and require are for clojure namespaces |
| 15:23 | caljunior | which is correct because i/MainFrame__init.class doesn't exist. just MainFrame.class |
| 15:23 | hoeck | caljunior: import is for java classes |
| 15:24 | hoeck | so it should be (import 'gui.MainFrame) |
| 15:25 | hoeck | when you do (use 'gui.MainFrame), clojure actually looks for a gui/MainFrame.clj or a gui/MainFrame__init.class (which resembles a compiled clojure namespace) |
| 15:26 | hoeck | tcrayford: mhh, you could read the bytecode of each function and try to find calls to other functions, but that sounds not like "decent" to me :/ |
| 15:27 | caljunior | in principle, can I use swank-clojure-project, set the project root to the directory of the Netbeans project add a lib directory with clojure.jar and swank-clojure.jar and (import 'gui.MainFrame) ? |
| 15:27 | caljunior | I tried and failed. |
| 15:27 | tcrayford | yeah it sounds indecent |
| 15:27 | tcrayford | problem with the current method is "Elapsed time: 129922.729 msecs" |
| 15:28 | tcrayford | for a resolving of one var across all namespaces |
| 15:29 | tcrayford | and that's with an ssd |
| 15:32 | hoeck | caljunior: where does netbeans keep the compiled classes? |
| 15:32 | hoeck | caljunior: in classes/ ? |
| 15:34 | hoeck | tcrayford: thats really long |
| 15:34 | tcrayford | hoeck: especially if its meant to be used in an ide/refactoring tool |
| 15:35 | hoeck | tcrayford: how do find out wether some code calls a function? |
| 15:35 | hiredman | you look for calls to IFn.invoke |
| 15:35 | tcrayford | that's roughly the question I'm trying to answer, yes |
| 15:36 | tcrayford | hiredman: how? |
| 15:36 | hiredman | whatever your prefered method of bytecode inspection |
| 15:36 | hiredman | assuming compiled code |
| 15:37 | tcrayford | I don't think all of this is (not AOT compiled anyway) |
| 15:37 | hiredman | although, that will also find stuff like (:foo {:foo 1}) |
| 15:38 | tcrayford | hiredman: not just any function, one particular function |
| 15:38 | hiredman | then you just look for the head of lists |
| 15:38 | Chousuke | so what, you need to find all references to a var? |
| 15:38 | tcrayford | that's the aim |
| 15:38 | caljunior | hoeck: I did ln -s build/classes/gui/ . as per the tutorial. This created MainFrame.class MainFrame$1.class and MainFrame$2.class. |
| 15:38 | hoeck | but what about (let [head first] (head [1 2])) ? |
| 15:39 | hiredman | there is a namspace walker in contrib |
| 15:39 | hiredman | you might also like at my clojure-dependeny-grapher on github |
| 15:39 | hiredman | look |
| 15:40 | hiredman | there is a branch that uses the namespace walker stuff |
| 15:40 | Chousuke | tcrayford: It seems to me that to do this the right way you need a code analysis tool that is more advanced than the clojure compiler :P |
| 15:40 | hoeck | caljunior: but that tutorial says you should "." add the the classpath |
| 15:40 | hoeck | caljunior: and it looks like swank-clojure-project puts only lib, src, test and classes onto the classpath |
| 15:41 | hoeck | caljunior: so try to link or copy build/ to classes/ |
| 15:41 | tcrayford | Chouske: its looking that way at the moment |
| 15:42 | caljunior | that's true. it was a separate track I was pursuing though. |
| 15:42 | caljunior | "link or copy build/ to classes/" trying now |
| 15:43 | hiredman | I think it certainly is not trivial, but an 80% solution would not be that difficult |
| 15:43 | tcrayford | aye |
| 15:43 | hiredman | once it's usable you have all the time in the world for people to submit little bug fixes here and there as they use it |
| 15:43 | tcrayford | doing it from source code on disk is horribly slow though |
| 15:44 | caljunior | gui-project |
| 15:44 | caljunior | doh! |
| 15:44 | Chousuke | or you could start working on the compiler for clojure-in-clojure with the explicit aim of making it useful for refactoring tools as well ;-) |
| 15:44 | hiredman | tcrayford: you are going to have to load the code from disk no matter what |
| 15:45 | tcrayford | aye |
| 15:45 | hiredman | Chousuke: ! |
| 15:45 | tcrayford | what is the ns-walker in contrib called? |
| 15:45 | hiredman | I don't recall |
| 15:46 | hiredman | http://github.com/hiredman/clojure-dependency-grapher/blob/find-namespaces/dep.clj |
| 15:47 | tcrayford | find-namespaces it is |
| 15:49 | hiredman | ♥ -> |
| 15:50 | tcrayford | I guess a point could be restricting it to namespaces outside of clojure core and contrib (for the moment) |
| 15:52 | hiredman | I think it would be restricted to namespaces in the directory tree you set it loose on |
| 15:52 | tcrayford | yep |
| 15:52 | tcrayford | which, given this is running from swank (and hopefully, lein), should be doable |
| 15:54 | caljunior | hoeck: no joy. but (import 'gui.MainFrame) in clojure instance booted from Netbeans project directory seems to be working now. Now I get another exception: java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group but that's my problem. Thanks. |
| 15:55 | companion_cube | hi there, i would like to write an irc bot in clojure (so original), and wondered if an irc lib was available... |
| 15:56 | hiredman | the are several java irc libs and maybe two clojure libs |
| 15:56 | hiredman | the java libs tend to be well tested and mature, the clojure libs maybe less so |
| 15:57 | hiredman | the only lib I've used is the java pircbot |
| 15:57 | hiredman | very simple |
| 15:57 | companion_cube | other question : is it easy in clojure to load/reload/unload code ? for example, if i want to have "plugins" to be loaded or unload dynamically ? |
| 15:58 | hiredman | but most (java) people seem to prefer jerklib |
| 16:01 | hoeck | caljunior: you can also use this to examine the current classpath: (->> (System/getProperty "java.class.path") (.split (re-pattern (System/getProperty "path.separator"))) (map println) dorun) |
| 16:02 | caljunior | hoeck: I usually do: (System/getProperty "java.class.path") but yours prints more nicely. |
| 16:03 | hoeck | caljunior: ah, okay, then nevermind :) |
| 16:03 | companion_cube | in fact, i should better read some existing code before :/ |
| 16:03 | caljunior | the classpath contains the default swank-clojure stuff. |
| 16:03 | companion_cube | is sexpbot/clojurebot code available ? |
| 16:05 | tcrayford | oops |
| 16:05 | tcrayford | was using ns-map instead of ns-interns |
| 16:05 | tcrayford | now takes ~1s |
| 16:05 | tcrayford | 7s if you include all namespaces |
| 16:22 | ordnungswidrig | hi |
| 16:22 | ordnungswidrig | does anyone know of a comparision of clojure couchdb client libraries? |
| 16:24 | AWizzArd | ~seen rhickey |
| 16:25 | clojurebot | rhickey was last seen in #clojure, 276 minutes ago saying: mefesto: dynamically modifying the classpath is not something that can be made to work portably in all execution environments, i.e. it shouldn't be in your code. |
| 16:26 | tcrayford | ~seen technomancy |
| 16:26 | clojurebot | technomancy was last seen in #clojure, 245 minutes ago saying: then we can iterate on a more self-contained approach once it works |
| 16:28 | AWizzArd | hiredman: does clojurebot ignore his own comments? Or could it go into an endless loop if I ask if it has seen me, and it then says that the last thing I said was this seen command, which would then trigger it to do it over and over again? |
| 16:30 | hiredman | AWizzArd: how would that put it in an endless loop? |
| 16:30 | arohner | ~seen tcrayford |
| 16:30 | clojurebot | tcrayford was last seen in #clojure, 3 minutes ago saying: ~seen technomancy |
| 16:30 | hiredman | clojurebot's responses are not prefixed with a ~ or clojurebot, so they are obviously not addressed to clojurebot |
| 16:30 | arohner | empirical proof :-) |
| 16:30 | AWizzArd | k ;) |
| 16:31 | cp2 | not to mention outgoing PRIVMSG commands arent sent back to your client |
| 16:31 | cp2 | the client in this case being clojurebot |
| 16:31 | cp2 | er, that is, clojurebot doesnt receive its own messages |
| 16:32 | hiredman | pircbot may actually loop it's own privmsgs back through the onMessage handler, I don't recall |
| 16:32 | cp2 | last i knew it didnt, could be wrong though |
| 16:33 | cp2 | ,(println "~seen foo") |
| 16:33 | clojurebot | ~seen foo |
| 16:33 | hiredman | I didn't actually answer AWizzArd's question |
| 16:33 | AWizzArd | it’s answered enough, thanks |
| 16:34 | hiredman | clojurebot may ignore things it says, I don't recall |
| 16:41 | _schulte_ | seems like it'd be dangerous if it didn't ignore itself, e.g. ((fn [a] `(~a '~a)) '(fn [a] `(~a '~a))) |
| 16:54 | ordnungswidrig | if ns foo.bar has (ns (:use foo.bar.baz)) wont (ns (:require foo.bar :as x)) expose the var from foo.bar.baz in ns x ? |
| 16:54 | ordnungswidrig | such that x/qux is foo.bar.baz/qux |
| 17:00 | cYmen | hm...I think running lein deps in the labrepl directory is installing a new version of clojure |
| 17:00 | tcrayford | it will be, yes |
| 17:01 | tcrayford | into that directory |
| 17:01 | cYmen | inside it? |
| 17:01 | tcrayford | yep |
| 17:01 | cYmen | not somewhere global? |
| 17:01 | tcrayford | inside the lib folder |
| 17:01 | cYmen | hmhm |
| 17:01 | tcrayford | in labrepl |
| 17:03 | tcrayford | that way your dependancies are separated for each project |
| 17:28 | cYmen | "Clojure is impure, in that it doesn't force your program to be referentially transparent, " what does this mean? |
| 17:28 | opqdonut | the value of a variable (or reference, rather) can change |
| 17:29 | opqdonut | mostly because of java |
| 17:29 | opqdonut | (let [a (HashMap.)] (.put a 1 2)) |
| 17:30 | opqdonut | that actually mutates the structure that a points to |
| 17:30 | cYmen | ok |
| 17:30 | cYmen | thanks |
| 17:51 | erikcw1 | can anyone point me to an example somewhere that uses fixtures from the test-is lib? I'm having trouble figuring out setup/tear down... |
| 17:51 | hiredman | fixtures get passed the test as a function |
| 17:52 | hiredman | so something like (defn my-fix [f] (binding [somevar false] (f))) |
| 17:53 | erikcw1 | so where do I put use-fixtures? |
| 17:53 | hiredman | at the top of the file with all the tests |
| 17:54 | hiredman | (use-fixtures :each my-fix) |
| 17:54 | hiredman | ,(doc clojure.test/use-fixtures) |
| 17:54 | clojurebot | "; Wrap test runs in a fixture function to perform setup and teardown. Using a fixture-type of :each wraps every test individually, while:once wraps the whole run in a single function." |
| 18:03 | Raynes | Sorry about the abundance of joins and quits there. One of those bugs that you think you've fixed 5 times before you actually fix it, and by then you've already annoyed everyone. |
| 18:16 | unlink | Would anyone be interested in collaborating on an interface to Interactive Brokers' TWS API? |
| 18:20 | hiredman | whatever happened to reify's volatile fields? |
| 18:36 | cemerick | hiredman: that's all moved to deftype I think |
| 18:37 | hiredman | ,(macroexpand-1 '(fn [a] a)) |
| 18:37 | clojurebot | (fn* ([a] a)) |
| 18:38 | hiredman | that list in there is annoying |
| 18:39 | hiredman | makes a naive approach of examining macroexpands for function calls difficult |
| 18:39 | tcrayford | I hadn't thought of checking macroexpands for function calls |
| 18:39 | tcrayford | :/ |
| 18:40 | tcrayford | though my current way will just show up the original macro |
| 18:40 | cemerick | hiredman: that's just the way it is to support multiple arities, no? |
| 18:40 | hiredman | user> (desugar '(defn plus [a b] (+ a b))) |
| 18:40 | hiredman | (def plus (fn* (. [a b] invoke (. + invoke a b)))) |
| 18:40 | hiredman | user> |
| 18:40 | hiredman | right |
| 18:40 | hiredman | I know why it is there, but that does not make it less annoying |
| 18:41 | licoresse | . |
| 18:42 | tcrayford | ~seen technomancy |
| 18:42 | clojurebot | technomancy was last seen in #clojure, 380 minutes ago saying: then we can iterate on a more self-contained approach once it works |
| 19:00 | cemerick | rhickey: thanks for that patch for 302; that's a good initial step |
| 19:01 | cemerick | actually, might be enough for 95% of cases |
| 19:10 | hiredman | user> (deconstruct '(defn plus [a b] (+ a b))) |
| 19:10 | hiredman | (. clojure.lang.Var intern (. clojure.lang.Namespace findOrCreate (. clojure.lang.Symbol create "user")) (. clojure.lang.Symbol create "plus") (fn* ([a b] (. + invoke a b)))) |
| 19:10 | hiredman | user> |
| 19:12 | tcrayford | user> (who-calls 'potential-ns) |
| 19:12 | tcrayford | (#'swank.commands.completion/potential-ns #'swank.commands.completion/potential-completions) |
| 19:13 | tcrayford | (alias man doc) |
| 19:13 | hiredman | doc is a macro, so that won't work |
| 19:13 | tcrayford | :( |
| 19:13 | hiredman | you need to be more subtle about it |
| 19:13 | hiredman | you can still do it |
| 19:14 | tcrayford | (defmacro man [& args] `(doc ~@args)) |
| 19:14 | tcrayford | user> (defmacro man [& args] `(doc ~@args)) |
| 19:14 | tcrayford | #'user/man |
| 19:14 | tcrayford | user> (man defn) |
| 19:14 | tcrayford | ------------------------- |
| 19:14 | tcrayford | clojure.core/defn |
| 19:14 | tcrayford | ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]) |
| 19:14 | tcrayford | Macro |
| 19:15 | tcrayford | Same as (def name (fn [params* ] exprs*)) or (def |
| 19:15 | tcrayford | name (fn ([params* ] exprs*)+)) with any doc-string or attrs added |
| 19:15 | tcrayford | to the var metadata |
| 19:15 | tcrayford | nil |
| 19:23 | tcrayford | http://gist.github.com/369890 |
| 19:24 | tcrayford | there's actually some bugs in there that I've just thought of :/ |
| 19:26 | tcrayford | aside from the one I already noted |
| 19:26 | tcrayford | :/ |
| 20:10 | defn | hello all |
| 20:25 | Raynes | ohai |
| 20:26 | YamNad | Haha hi :) |
| 20:46 | gerryxiao | hello |
| 20:46 | gerryxiao | what's definterface |
| 20:47 | gerryxiao | ,(doc definterface) |
| 20:47 | clojurebot | Excuse me? |
| 20:47 | gerryxiao | ,(doc defprotocol) |
| 20:47 | clojurebot | Gabh mo leithscéal? |
| 20:48 | gerryxiao | ,*clojure-version* |
| 20:48 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"} |
| 22:11 | cemerick | anyone have a clue about this exception coming out of clojure.core.protocols?: http://gist.github.com/369953 |
| 22:13 | hiredman | cemerick: there was a commit about InternalReduce yesterdayish, do you have the latest? |
| 22:15 | cemerick | hiredman: yeah, I just saw that. Digging now :-) |
| 22:20 | cemerick | hiredman: yup, that was it -- was running clojure-1.2.0-master-20100416.220115-33.jar which broke, mvn -U got today's build (reverting the change, whatever it was), and all's green now :-) |
| 23:09 | cheezey | umm... when i do something like (take 2 "asdf"), it requires a lazyseq rather than a string..? how do i change it to a string :\ |
| 23:25 | jomofo | ,(take 2 "asdf") |
| 23:25 | clojurebot | (\a \s) |
| 23:26 | jomofo | cheezey: what do you mean by "requires"? |
| 23:28 | cheezey | jomofo: i meant "it gives" sorry |
| 23:30 | wooby | hi everyone |
| 23:34 | nteon | evening wooby |