#clojure logs

2008-11-01

00:14sunwukonghi
00:16sunwukongbrowsing the closure-contrib files I've noticed that cond-let evaluates the first true test twice
00:17sunwukongI've created a patch for it - what's the stadard way to get this into svn?
00:33danlarkinsunwukong: http://clojure.org/contributing
00:35sunwukongthat's nice, but seems an awful lot of work for a 3-line change :)
00:38lisppaste8sunwukong pasted "cond-let fix" at http://paste.lisp.org/display/69541
01:35asbjxrnAnyone using java debuggers together with slime?
01:36asbjxrnSeems to me that slime captures exceptions and prevents the debugger from getting to it?
05:53AWizzArdMoin
05:53kotaraksalut
07:43Lau_of_DKGood day, folks
07:43kotarakSalut Lau
08:52Lau_of_DKrhickey, 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:52Lau_of_DKhead = here
08:54rhickeyhttp://dictionary.reference.com/browse/subsume
08:55Lau_of_DKYes 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:58ReplRat_AOT?
08:58rhickeyLau_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:58Lau_of_DKAlright thanks - That puts me at ease :)
08:58kotarakReplRat_: ahead of time compilation
08:59kotarakReplRat_: compiling clojure to .class files
09:02pjb3Go Vote! http://thediscoblog.com/2008/10/19/poll-which-language-is-better-suited-for-jvm-concurrency/
09:03pjb3and not for Obama or McCain :)
09:18vyrhickey: Do you consider moving documentation pages on clojure.org to a documentation scheme -- e.g. DocBook, LaTeX, etc.?
09:36Chousukemaybe restructuredtext, if you don't want to learn a complex markup language. :)
11:34Drakeson(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:36Drakesonor maybe (def a [[1 2][3 4]]) (a 0 1) -> 3
11:37Drakesonerr, 2, that is
11:42Chouser(get-in a [0 1]) for the latter case
11:42Drakesonbut (a 0 1) is not used for anything else.
11:42Chouser(map a [0 2]) for the former
11:43DrakesonChouser: well, I am arguing about the builtins, (again).
11:45Chouserget-in has neighbors assoc-in and update-in
11:45Chouser(assoc-in a [0 1] 99) -> [[1 99] [3 4]]
11:45Chouser(update-in a [0 1] #(* 10 %)) -> [[1 20] [3 4]]
11:47ChouserDrakeson: 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:49Drakesonfor (a 0 1) to mean (get-in a [0 1]) sounds natural when (a 0) gives you (get-in a [0])
11:50Drakesondon't you agree?
11:51Drakesonwell, at least, do you agree that (a 0 1) should have a meaning?
11:52ChouserI 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:53Chouserhaving said that, get-in would seem reasonable. ...except I don't think I've ever actually used get-in in a program
11:53ChouserI've used update-in, but not get-in
11:54DrakesonI 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:55Drakesonso I would appreciate having many array-related facilities
11:57Drakesonin matlab 1:10 means (range 1 10), and a[1:10] is produces a sub-array of "a" with elements 1,2,...,10.
11:57Drakeson(a <vector>) could mean the same (i.e. (map a <vector>))
12:22duck1123what does "Can't let qualified name: view/session" mean?
12:23Chouserit means you're writing a macro
12:23duck1123session is one of my variable, but not on the line it says
12:23duck1123yes
12:23kotarakuse '~ in the macro
12:23Chouserif you're trying to capture a name, right, use '~
12:23Chouserif you're not trying to, use gensym or foo#
13:06lisppaste8duck1123 pasted "Compojure putting 'POST' in namespace" at http://paste.lisp.org/display/69557
13:07duck1123could someone help me figure out why this isn't working?
13:07duck1123I can do forms just fine, except for when they're in a macro
15:15Lau_of_DKWhen 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:20Lau_of_DKCome on gents, can somebody please help me a little with these classes?
15:20gnuvince_Good day
15:21Lau_of_DKGood evening Vincent
15:36Lau_of_DKAnybody here who can share a few words on java classes, and then perhaps gen-class?
15:49sohailLau_of_DK, that's probably a Java thing
15:50Lau_of_DKok - how do I go around it?
15:50Lau_of_DKI cant come up with a new name everytime I test-run the class
15:50sohailLau_of_DK, you might have to
15:52Lau_of_DKhehe
15:52Lau_of_DKsohail are you proficient in Java?
15:53sohailLau_of_DK, not at all :-)
15:54Lau_of_DKalrighty
17:11Lau_of_DKuser=> (gen-and-load-class "HLayout" :method [["getLayout" [] QWidget]])
17:11Lau_of_DK#=HLayout
17:11Lau_of_DKuser=> java.lang.IllegalArgumentException: Unable to resolve classname: HLayout (NO_SOURCE_FILE:35)
17:11Lau_of_DKSo first it generates the class, and the it denies any knowledge of having done so ?
17:12kotarakLau_of_DK: use 'some.namespace.HLayout and then import.
17:14Lau_of_DKright... :)
17:14Lau_of_DKNow I caused Java to throw a Segfault
17:25danlarkinis 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:26Chousukeit prints it in the minibuffer doesn't it?
17:27danlarkinif I have (first [1 2]) in my buffer and I eval it slime just prints: ;;;; (first [1 2]) ...
17:28danlarkindoes it print 1 for you?
17:49Chousukedanlarkin: in the minibuffer it does.
17:49danlarkinChousuke: ahh look at that. fantastic! Thanks :)
18:57Lau_of_DKIs 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:09StartsWithK_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:11Lau_of_DKso if I have /home/lau/code/com/lau/net/*.class and I need the namespace .com.lau.net *
19:11Lau_of_DKHow do I add that to CP ?
19:19AWizzArdOh, Bill Clementson now also tries out Clojure
19:38danlarkinis there a predicate that will be true for vectors and lists but not maps?
19:38danlarkinaside from (or (vector? foo) (list? foo))
19:47Chousuke(compose not map?)
19:47Chousuke;P
19:47Chousukecomp* too
19:48danlarkinheh, mostly I wanted a name for my function... I'm going with decode-list-vector
19:48danlarkineven though it's kindof a lame name
19:49Chousukeif it's going to be a predicate to test whether it's a list or a vector, why not just list-or-vector?
19:50Chousukewith the ? in the name
19:52danlarkinlisppaste8: url
19:52lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
19:52lisppaste8danlarkin pasted "example" at http://paste.lisp.org/display/69570
19:53danlarkinoh... formatting got messed up, but you see what I'm going for?
19:53danlarkinI decided to just exploit the procedural nature of cond and put map? before coll?
19:55StartsWithK_is there a zipper that can work with all clojure data strucutures (maps and sets too)?
19:56StartsWithK_or, what would be a best way to scan macro body for specific code fragments?
19:56Chousukedanlarkin: don't forget that sets are collections too
19:58danlarkinChousuke: 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:58danlarkinI guess I'll go with decode-coll
19:59Chousukeor decode-nonmap
20:40danlarkinanyone familiar with cond-let from clojure-contrib? I'm getting java.lang.Exception: Unsupported binding form: clojure.lang.PersistentList@e2c88ceb
20:42lisppaste8danlarkin pasted "cond-let" at http://paste.lisp.org/display/69573
21:41danlarkinSo how's everyone getting around having two functions that call eachother
21:41danlarkinsince one has to be defined first
21:53Chouser(def foo) first, then you can write a function that calls foo.
21:53Chouserre-def foo later.
21:57danlarkinMmm :-/
22:19danlarkinAnyone have a need for a custom Throwable yet? I guess you've gotta use gen-class to get that eh
22:22Chouserif you want to know what name to use when you catch it, yeah.
22:26danlarkinChouser: I guess I'll stick with Exception for the time being
23:00danlarkinSo I wrote a simple little JSON encoder, what kind of directory structure and files should I make to upload to github?
23:03Chouserat least directories that match the namespace: org.danlarkin.json should be defined in org/danlarkin/json/json.clj
23:03Chouserit seems common to put another src dir above that (src/org/dan...)
23:04danlarkinis it acceptable to have a namespace with no dots? (ns clojure-json)
23:05danlarkinI know it's possible, but is it frowned upon or something...
23:06Chouserwell, 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:06Chouserhttp://java.sun.com/docs/books/jls/third_edition/html/packages.html
23:07danlarkinAh
23:07Chouserespecially section 7.7, I guess.
23:09danlarkinjust seems egomaniacal for me to make everyone type org.danlarkin.json
23:09danlarkin:)
23:09Chouserheh.
23:09Chouseractually, it's the other way around -- might be egomaniacal to assume clojure-json means your package.
23:11Chouserit'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:11danlarkinso 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:12ChouserI don't know. I've never written an ant build file.
23:13ChouserI 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:14danlarkinwell to use this json encoder one would presumably have to make a jar and add it to the classpath, is that correct?
23:15Chouserno, you can add the src directory to your classpath
23:15Chouserthat's how I use clojure-contrib. git svn rebase to keep it current, and clojure-contrib/src in my classpath. No rebuilding anything.
23:16danlarkinah ha, that is better than building it indeed
23:59danlarkintada http://github.com/danlarkin/clojure-json/tree/master