2008-11-01
| 00:14 | sunwukong | hi |
| 00:16 | sunwukong | browsing the closure-contrib files I've noticed that cond-let evaluates the first true test twice |
| 00:17 | sunwukong | I've created a patch for it - what's the stadard way to get this into svn? |
| 00:33 | danlarkin | sunwukong: http://clojure.org/contributing |
| 00:35 | sunwukong | that's nice, but seems an awful lot of work for a 3-line change :) |
| 00:38 | lisppaste8 | sunwukong pasted "cond-let fix" at http://paste.lisp.org/display/69541 |
| 01:35 | asbjxrn | Anyone using java debuggers together with slime? |
| 01:36 | asbjxrn | Seems to me that slime captures exceptions and prevents the debugger from getting to it? |
| 05:53 | AWizzArd | Moin |
| 05:53 | kotarak | salut |
| 07:43 | Lau_of_DK | Good day, folks |
| 07:43 | kotarak | Salut Lau |
| 08:52 | Lau_of_DK | rhickey, last I was head you said that AOT would subsume gen-class functions. Firstly, you cant use words like "subsume" with danish people, and second, would you please explain the practical implications of AOT ? |
| 08:52 | Lau_of_DK | head = here |
| 08:54 | rhickey | http://dictionary.reference.com/browse/subsume |
| 08:55 | Lau_of_DK | Yes sir, Im aware of dictionaries. I fail to see how I can prepare my code for the removal of gen-class when Im currently depending on it. So I was hoping for some insight into how AOT will be used in Clojure. |
| 08:58 | ReplRat_ | AOT? |
| 08:58 | rhickey | Lau_of_DK: Don't worry about genclass being removed yet, there's no alternative anyway. I can't say how it will work until I've finished designing it. That won't happen until next week. Fundamentally it will be the same - generated classes will map methods to Clojure vars. All that might change is the syntax and organization, and for the better. |
| 08:58 | Lau_of_DK | Alright thanks - That puts me at ease :) |
| 08:58 | kotarak | ReplRat_: ahead of time compilation |
| 08:59 | kotarak | ReplRat_: compiling clojure to .class files |
| 09:02 | pjb3 | Go Vote! http://thediscoblog.com/2008/10/19/poll-which-language-is-better-suited-for-jvm-concurrency/ |
| 09:03 | pjb3 | and not for Obama or McCain :) |
| 09:18 | vy | rhickey: Do you consider moving documentation pages on clojure.org to a documentation scheme -- e.g. DocBook, LaTeX, etc.? |
| 09:36 | Chousuke | maybe restructuredtext, if you don't want to learn a complex markup language. :) |
| 11:34 | Drakeson | (def a [1 2 3]) (a 0) -> 1, wouldn't it be nicer if (a 0 3) -> [1 2 3], or maybe (a 0 2) -> [1 3], or maybe (a [0 2 0]) -> [1 3 1] ? |
| 11:36 | Drakeson | or maybe (def a [[1 2][3 4]]) (a 0 1) -> 3 |
| 11:37 | Drakeson | err, 2, that is |
| 11:42 | Chouser | (get-in a [0 1]) for the latter case |
| 11:42 | Drakeson | but (a 0 1) is not used for anything else. |
| 11:42 | Chouser | (map a [0 2]) for the former |
| 11:43 | Drakeson | Chouser: well, I am arguing about the builtins, (again). |
| 11:45 | Chouser | get-in has neighbors assoc-in and update-in |
| 11:45 | Chouser | (assoc-in a [0 1] 99) -> [[1 99] [3 4]] |
| 11:45 | Chouser | (update-in a [0 1] #(* 10 %)) -> [[1 20] [3 4]] |
| 11:47 | Chouser | Drakeson: I'm not arguing with you, I'm just not sure which of these behaviors is so much mor common than the others that it should become the default when you use a vector as a function. |
| 11:49 | Drakeson | for (a 0 1) to mean (get-in a [0 1]) sounds natural when (a 0) gives you (get-in a [0]) |
| 11:50 | Drakeson | don't you agree? |
| 11:51 | Drakeson | well, at least, do you agree that (a 0 1) should have a meaning? |
| 11:52 | Chouser | I think it's better to have no meaning than the "wrong" one. Once it has a meaning, it'll be *very* difficult to change it later. |
| 11:53 | Chouser | having said that, get-in would seem reasonable. ...except I don't think I've ever actually used get-in in a program |
| 11:53 | Chouser | I've used update-in, but not get-in |
| 11:54 | Drakeson | I used to do a lot of matrix processing (using MATLAB). It was hard to replicate in CL, (no "good" support for vectors, no compact syntax for vectors, etc.) |
| 11:55 | Drakeson | so I would appreciate having many array-related facilities |
| 11:57 | Drakeson | in matlab 1:10 means (range 1 10), and a[1:10] is produces a sub-array of "a" with elements 1,2,...,10. |
| 11:57 | Drakeson | (a <vector>) could mean the same (i.e. (map a <vector>)) |
| 12:22 | duck1123 | what does "Can't let qualified name: view/session" mean? |
| 12:23 | Chouser | it means you're writing a macro |
| 12:23 | duck1123 | session is one of my variable, but not on the line it says |
| 12:23 | duck1123 | yes |
| 12:23 | kotarak | use '~ in the macro |
| 12:23 | Chouser | if you're trying to capture a name, right, use '~ |
| 12:23 | Chouser | if you're not trying to, use gensym or foo# |
| 13:06 | lisppaste8 | duck1123 pasted "Compojure putting 'POST' in namespace" at http://paste.lisp.org/display/69557 |
| 13:07 | duck1123 | could someone help me figure out why this isn't working? |
| 13:07 | duck1123 | I can do forms just fine, except for when they're in a macro |
| 15:15 | Lau_of_DK | When experimenting with Gen-class, Im not allowed to create multiple objects with the same name (my wish was of course to overwrite) - how do I get around this limitation ? |
| 15:20 | Lau_of_DK | Come on gents, can somebody please help me a little with these classes? |
| 15:20 | gnuvince_ | Good day |
| 15:21 | Lau_of_DK | Good evening Vincent |
| 15:36 | Lau_of_DK | Anybody here who can share a few words on java classes, and then perhaps gen-class? |
| 15:49 | sohail | Lau_of_DK, that's probably a Java thing |
| 15:50 | Lau_of_DK | ok - how do I go around it? |
| 15:50 | Lau_of_DK | I cant come up with a new name everytime I test-run the class |
| 15:50 | sohail | Lau_of_DK, you might have to |
| 15:52 | Lau_of_DK | hehe |
| 15:52 | Lau_of_DK | sohail are you proficient in Java? |
| 15:53 | sohail | Lau_of_DK, not at all :-) |
| 15:54 | Lau_of_DK | alrighty |
| 17:11 | Lau_of_DK | user=> (gen-and-load-class "HLayout" :method [["getLayout" [] QWidget]]) |
| 17:11 | Lau_of_DK | #=HLayout |
| 17:11 | Lau_of_DK | user=> java.lang.IllegalArgumentException: Unable to resolve classname: HLayout (NO_SOURCE_FILE:35) |
| 17:11 | Lau_of_DK | So first it generates the class, and the it denies any knowledge of having done so ? |
| 17:12 | kotarak | Lau_of_DK: use 'some.namespace.HLayout and then import. |
| 17:14 | Lau_of_DK | right... :) |
| 17:14 | Lau_of_DK | Now I caused Java to throw a Segfault |
| 17:25 | danlarkin | is it possible to have the slime REPL print the return value of a form when I eval it from another buffer with C-x C-e? |
| 17:26 | Chousuke | it prints it in the minibuffer doesn't it? |
| 17:27 | danlarkin | if I have (first [1 2]) in my buffer and I eval it slime just prints: ;;;; (first [1 2]) ... |
| 17:28 | danlarkin | does it print 1 for you? |
| 17:49 | Chousuke | danlarkin: in the minibuffer it does. |
| 17:49 | danlarkin | Chousuke: ahh look at that. fantastic! Thanks :) |
| 18:57 | Lau_of_DK | Is Java supposed to automatically use .class file on the classpath, or is it only .jar ? And if its the case, are they supposed to maintain their original libraries hierachy, like /foo/bar/Baz.class ? |
| 19:09 | StartsWithK_ | Lau_of_DK: sure, you can have directories with .class files and then you could just add them to class path with something like -cp rootdir |
| 19:11 | Lau_of_DK | so if I have /home/lau/code/com/lau/net/*.class and I need the namespace .com.lau.net * |
| 19:11 | Lau_of_DK | How do I add that to CP ? |
| 19:19 | AWizzArd | Oh, Bill Clementson now also tries out Clojure |
| 19:38 | danlarkin | is there a predicate that will be true for vectors and lists but not maps? |
| 19:38 | danlarkin | aside from (or (vector? foo) (list? foo)) |
| 19:47 | Chousuke | (compose not map?) |
| 19:47 | Chousuke | ;P |
| 19:47 | Chousuke | comp* too |
| 19:48 | danlarkin | heh, mostly I wanted a name for my function... I'm going with decode-list-vector |
| 19:48 | danlarkin | even though it's kindof a lame name |
| 19:49 | Chousuke | if it's going to be a predicate to test whether it's a list or a vector, why not just list-or-vector? |
| 19:50 | Chousuke | with the ? in the name |
| 19:52 | danlarkin | lisppaste8: url |
| 19:52 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 19:52 | lisppaste8 | danlarkin pasted "example" at http://paste.lisp.org/display/69570 |
| 19:53 | danlarkin | oh... formatting got messed up, but you see what I'm going for? |
| 19:53 | danlarkin | I decided to just exploit the procedural nature of cond and put map? before coll? |
| 19:55 | StartsWithK_ | is there a zipper that can work with all clojure data strucutures (maps and sets too)? |
| 19:56 | StartsWithK_ | or, what would be a best way to scan macro body for specific code fragments? |
| 19:56 | Chousuke | danlarkin: don't forget that sets are collections too |
| 19:58 | danlarkin | Chousuke: whoops! Luckily it turns out I want sets to be processed the same way as lists & vectors. Too bad decode-list-or-vector-or-set is a horrible name |
| 19:58 | danlarkin | I guess I'll go with decode-coll |
| 19:59 | Chousuke | or decode-nonmap |
| 20:40 | danlarkin | anyone familiar with cond-let from clojure-contrib? I'm getting java.lang.Exception: Unsupported binding form: clojure.lang.PersistentList@e2c88ceb |
| 20:42 | lisppaste8 | danlarkin pasted "cond-let" at http://paste.lisp.org/display/69573 |
| 21:41 | danlarkin | So how's everyone getting around having two functions that call eachother |
| 21:41 | danlarkin | since one has to be defined first |
| 21:53 | Chouser | (def foo) first, then you can write a function that calls foo. |
| 21:53 | Chouser | re-def foo later. |
| 21:57 | danlarkin | Mmm :-/ |
| 22:19 | danlarkin | Anyone have a need for a custom Throwable yet? I guess you've gotta use gen-class to get that eh |
| 22:22 | Chouser | if you want to know what name to use when you catch it, yeah. |
| 22:26 | danlarkin | Chouser: I guess I'll stick with Exception for the time being |
| 23:00 | danlarkin | So I wrote a simple little JSON encoder, what kind of directory structure and files should I make to upload to github? |
| 23:03 | Chouser | at least directories that match the namespace: org.danlarkin.json should be defined in org/danlarkin/json/json.clj |
| 23:03 | Chouser | it seems common to put another src dir above that (src/org/dan...) |
| 23:04 | danlarkin | is it acceptable to have a namespace with no dots? (ns clojure-json) |
| 23:05 | danlarkin | I know it's possible, but is it frowned upon or something... |
| 23:06 | Chouser | well, I think clojure sort of adopts Java's conventions there, where they recommend using a domain name you control in order to avoid conflicts. |
| 23:06 | Chouser | http://java.sun.com/docs/books/jls/third_edition/html/packages.html |
| 23:07 | danlarkin | Ah |
| 23:07 | Chouser | especially section 7.7, I guess. |
| 23:09 | danlarkin | just seems egomaniacal for me to make everyone type org.danlarkin.json |
| 23:09 | danlarkin | :) |
| 23:09 | Chouser | heh. |
| 23:09 | Chouser | actually, it's the other way around -- might be egomaniacal to assume clojure-json means your package. |
| 23:11 | Chouser | it's why we have use and alias for packages. I can say (ns mything (:require [org.danlarkin.json :as json])) at the top of my file, and then just json/print or whatever when I want to use it. |
| 23:11 | danlarkin | so I'll have a README, LICENSE and src/org/danlarkin/json/json.clj -- should I be providing an ant build file too or something? |
| 23:12 | Chouser | I don't know. I've never written an ant build file. |
| 23:13 | Chouser | I guess if you want to let people download a .jar instead of making them use git, then you'll have to package it up -- you should provide the script or whatever you use to do that packaging, I suppose. |
| 23:14 | danlarkin | well to use this json encoder one would presumably have to make a jar and add it to the classpath, is that correct? |
| 23:15 | Chouser | no, you can add the src directory to your classpath |
| 23:15 | Chouser | that's how I use clojure-contrib. git svn rebase to keep it current, and clojure-contrib/src in my classpath. No rebuilding anything. |
| 23:16 | danlarkin | ah ha, that is better than building it indeed |
| 23:59 | danlarkin | tada http://github.com/danlarkin/clojure-json/tree/master |