2009-05-17
| 02:22 | Serkan | hi |
| 02:25 | stuhood | heya |
| 02:27 | Serkan | what's the version of asm bundled with clojure 1.0, and is it a modified copy? |
| 02:29 | hiredman | ~def clojure.asm.ClassWriter |
| 02:30 | stuhood | according to SVN, it hasn't been modified since Dec 2007 |
| 02:31 | hiredman | which is maybe around the time the switch to google code happened? |
| 02:32 | danlarkin_ | 2007? |
| 02:32 | Serkan | any maintainers arounmd? |
| 02:33 | hiredman | oh |
| 02:33 | hiredman | right 2007 |
| 02:35 | hiredman | Serkan: I am kind of curious, why are you asking about asm? |
| 02:35 | stuhood | Serkan: this thread is right before the check-in of ASM, and it implies that 3.0 is in use: http://groups.google.com/group/clojure/browse_thread/thread/ccfb84854d79809f/758ba8979f43578d?lnk=gst&q=asm&pli=1 |
| 02:53 | Serkan | hiredman: I'm a Gentoo trying to package clojure |
| 02:53 | hiredman | and you want to split out clojure.asm.*? |
| 02:53 | Serkan | I'll use the system asm library if the bundled one isn't a modified version |
| 02:54 | Serkan | ah the package structure is different as well :( |
| 02:54 | hiredman | Serkan: as rhickey mentions in that google group posting, a lot of projects use asm, so to avoid conflicts |
| 02:55 | hiredman | I would just grab the zip file, extract clojure.jar and forget about it |
| 02:56 | Serkan | hiredman, stuhood thanks for the pointers |
| 02:56 | stuhood | no problem... glad to see Clojure making it into Gentoo |
| 03:00 | Serkan | though I need to ask the others if they're OK with bundled asm. |
| 03:05 | cads_ | are you going to bundle bash startup scripts and such? |
| 03:07 | Serkan | cads_: ? |
| 03:07 | Serkan | was that for me |
| 03:07 | cads_ | yeah, I was just wondering about how clojure will be packaged in gentoo |
| 03:08 | cads_ | I've been thinking about making a deb |
| 03:08 | Serkan | I'm making a luancher that runs clojure.lang.Repl |
| 03:09 | danlarkin_ | Serkan: clojure.lang.Repl is old and busted, use clojure.main |
| 03:09 | danlarkin_ | Serkan: check out http://code.google.com/p/clojure-contrib/source/browse/trunk/launchers/bash/clj-env-dir for a good example |
| 03:14 | Serkan | danlarkin_: I see. I guess I found this in homepage |
| 03:19 | Serkan | danlarkin_: fixed http://overlays.gentoo.org/proj/java/changeset/7762 |
| 03:20 | danlarkin_ | Serkan: cool :) |
| 04:37 | unlink | Bah. No UNIX sockets in Java? |
| 04:37 | stuhood | the api isn't identical, but you can use raw sockets |
| 04:38 | unlink | What do you mean "raw"? |
| 04:38 | unlink | As in TCP/IP? |
| 04:38 | stuhood | no, sorry, not sure what i meant |
| 04:38 | stuhood | http://java.sun.com/javase/6/docs/api/java/net/Socket.html |
| 04:38 | p_l | raw sockets usually mean directly writing to device... |
| 04:39 | unlink | Yeah, those look like TCP/IP sockets. |
| 04:40 | markusgustavsson | I don't think java supports raw sockets |
| 04:40 | stuhood | sorry... i didn't mean raw sockets. |
| 04:45 | unlink | I'm looking for something along the lines of http://u.nu/5g46 ...surely some library exists |
| 04:45 | Serkan | unlink: libmatthew-java has |
| 04:48 | unlink | Thanks...hmm, it's missing from my repo |
| 04:49 | Serkan | unlink: http://www.matthew.ath.cx/projects/java/ |
| 04:50 | hiredman | you could use chouser's jna lib |
| 04:51 | unlink | No wonder I couldn't find it. ath.cx |
| 04:51 | hiredman | "Dynamically load and use native C libs from Clojure using JNA" |
| 04:51 | hiredman | http://github.com/Chouser/clojure-jna/tree/master |
| 04:52 | unlink | What C library did you have in mind? libc? |
| 04:53 | hiredman | yeah |
| 04:53 | hiredman | open() |
| 04:55 | hiredman | wow |
| 04:55 | hiredman | it has been a long time since I have written any C |
| 04:56 | unlink | import cx.ath.matthew.unix.UnixSocket; is mad sketchy |
| 04:57 | hiredman | how so? |
| 04:57 | unlink | import cx.ath. ... |
| 04:57 | unlink | dyndns |
| 04:58 | unlink | though I actually intended that message for another tab |
| 04:58 | hiredman | I had a .cx back in the day |
| 04:59 | hiredman | ah |
| 08:31 | guinea | I'm just wondering, is a zipper how the emacs buffer works? |
| 08:32 | kotarak | The Yi buffers seem to work like a zipper. Dunno about emacs. |
| 11:32 | Qvintvs | does the clojure have some sort of (exit) function to get out of the interpreter, or do you just need to ctrl+c out of it? |
| 11:32 | Qvintvs | does clojure* |
| 11:33 | dreish | You could do (System/exit 0) |
| 11:35 | Qvintvs | yay, ty |
| 12:06 | Chouser | unlink: I'd actually recommed using jna on libc curerntly, over that libmatthew thing. |
| 12:08 | p_l | Chouser: it might even work on Windows, I think :) |
| 12:08 | Chouser | I'm pretty sure Windows doesn't have unix domain sockets. |
| 12:11 | p_l | it's just non-standard optional package |
| 12:11 | Chouser | huh |
| 12:11 | p_l | just like there's a setting that changes the whole system into case-sensitive, including devfs (which can break various code) |
| 12:13 | p_l | oh, and the MS installer of SUA (Services for Unix Applications) includes GCC |
| 12:56 | markusgustavsson | So what's the jna performance like? Same as regular jni? |
| 13:19 | grosours | plop |
| 13:42 | Chouser | markusgustavsson: https://jna.dev.java.net/#performance |
| 13:48 | Chouser | so, no, not as fast as jni. :-) |
| 13:58 | guinea | Is it possible to do something like a proxy of a proxy? i.e. use proxy to overload some methods, and then do another proxy on that to overload more functions - a sort of inheritance |
| 14:00 | Chouser | proxy takes a class and returns an instance. |
| 14:00 | guinea | hmm |
| 14:01 | Chouser | I guess I'm not sure what you're trying to do. A proxy can't add methods... |
| 14:01 | guinea | i'll have to write a macro to combine overloadings into a proxy statement... |
| 14:02 | guinea | I've written different proxies, to overload a java class in various ways |
| 14:02 | guinea | and I want to be able to create proxies that have combinations of those |
| 14:02 | Chouser | if you look at the proxy macro source, you'll see it does a lot of its work at runtime with a couple public functions |
| 14:02 | guinea | cool |
| 14:02 | Chouser | each proxy instance has a map of the functions it will call for the various methods. you may be able to work with those directly. |
| 14:02 | guinea | where do I find the macro source? |
| 14:03 | Chouser | maybe not even need to write a macro |
| 14:03 | Chouser | ~def proxy |
| 14:03 | Chouser | or (source proxy) if you have clojure.contrib.repl-utils |
| 14:03 | guinea | sweet |
| 14:04 | Chouser | gotta go mow. ciao. |
| 14:04 | guinea | thx |
| 15:25 | quidnunc | Anyone at all familiar with enlive? |
| 15:26 | dnolen | yes |
| 15:35 | quidnunc | dnolen: If I want to select a table node with class "bar" shouldn't [:table (attr= :class "bar")] work? |
| 15:36 | quidnunc | [:table (attr? :class)] seems to return more results than just [:table} |
| 15:37 | dnolen | isn't there a has-class? |
| 15:38 | dnolen | quidnunc really it should be |
| 15:38 | dnolen | [:table.bar] |
| 15:39 | dnolen | [:table (attr? :class)] will return any table that has a class attribute not just bar. |
| 15:39 | quidnunc | dnolen: It does a union? |
| 15:39 | dnolen | no it's how CSS3 works |
| 15:39 | dnolen | table.bar matches a table with class bar |
| 15:40 | dnolen | [:table.bar] is the enlive translation. |
| 15:40 | quidnunc | dnolen: I meant [:table (attr? :class)] |
| 15:40 | quidnunc | That does a union? |
| 15:40 | dnolen | I suppose so, but it simply means "return all tables that have a class attribute" |
| 15:42 | quidnunc | By union I meant table OR class attribute. Shouldn't this work: [:table (attr= :class "bar")] |
| 15:42 | dnolen | ? |
| 15:42 | dnolen | you want all tables or anything with a class attribute? |
| 15:42 | quidnunc | I want table with class attribute "bar baz" |
| 15:42 | quidnunc | tables* |
| 15:43 | dnolen | [:table (has-class "bar baz")] should work I think. |
| 15:46 | lisppaste8 | quidnunc pasted "enlive class selector" at http://paste.lisp.org/display/80388 |
| 15:46 | quidnunc | dnolen: ^ It doesn't seem to |
| 15:47 | dnolen | oops |
| 15:47 | dnolen | the docs say |
| 15:48 | dnolen | [:table.bar.baz] |
| 15:49 | quidnunc | dnolen: Ah, good. Works now. |
| 15:49 | quidnunc | dnolen: Thanks. That was driving me a bit up the wall. |
| 15:49 | dnolen | np |
| 15:50 | quidnunc | That seems a bit nasty though. How do you deal with dynamic class names? |
| 15:51 | quidnunc | (has-class "bar" "baz") doesn't seem to work. |
| 15:52 | quidnunc | (and splitting the args into separate strings every time is unpleasant) |
| 15:53 | quidnunc | Actually, I'm surprised that what I initially tried didn't work. Shouldn't class be treated like any other attribute? |
| 15:59 | danlarkin_ | quidnunc: I think the main thing is that an element can have many classes, and usually you just want to check for one, not one and only one |
| 15:59 | mcspiff | anyone feel up to helping a newbie get slime setup?:D |
| 16:01 | quidnunc | danlarkin_: So their is no distinction in enlive between class="foo bar" and class="foo" class="bar"? |
| 16:01 | quidnunc | there* |
| 16:04 | danlarkin_ | quidnunc: in enlive? I don't know, there probably is. I'm just saying why it's the way it is |
| 16:05 | quidnunc | danlarkin_: Okay, thanks. |
| 16:11 | mattikus | Is there a decent way to catch ctrl-c from the repl and have it not exit? |
| 16:27 | liebke | mattikus: clojure.contrib.repl-utils/add-break-thread! used to do that, but it doesn't seem to work anymore. Something must of have changed |
| 16:28 | mattikus | Shucks. I'm so used to ctrl-c being either clear line or break current execution that I keep kicking myself out of the interpreter. |
| 16:32 | fyuryu | StartsWithK: Hi |
| 16:33 | liebke | yeah, I call add-break-thread! in my user.clj, so ctrl-c used to automatically work "correctly". I need to figure out what the problem is. |
| 16:35 | fyuryu | StartsWithK: I added an ant file for cloak, turned out I needed it anyway - the setup that I was using was not completely safe - sometimes I had problems with compilation. |
| 16:58 | StartsWithK | fyuryu: oh, hi, i wasn't here |
| 16:59 | StartsWithK | fyuryu: i forked it on github (i guess that is what i did), added ivy build so it downloads clojure from .zip on download page (packager resolver) and it can compile itself in one go |
| 16:59 | StartsWithK | fyuryu: also imported some of your code from your libs project, i think is down to graph and utils now |
| 17:00 | StartsWithK | fyuryu: also removed test-is and replaced it with my fork of clj-unit so test can be peformed with build |
| 17:00 | StartsWithK | fyuryu: and replaced some of your code with stuff from commons-io, like mkdir and such |
| 17:00 | StartsWithK | now i have a problem, i did it i know, tests fail |
| 17:00 | StartsWithK | but i think i can fix that tomorow |
| 17:01 | fyuryu | StartsWithK: ah, I somehow missed that github clone |
| 17:02 | StartsWithK | so next step would be ant task for compiling clojure sources in a way javac does it |
| 17:03 | StartsWithK | i have such a task for ant but it is in javascript, and i was planing to port it to pure clojure |
| 17:03 | StartsWithK | so i can use read with eval = false to realy check for namespace names |
| 17:03 | StartsWithK | i would like to place that code in cloak instead of my project |
| 17:04 | StartsWithK | and if someone realy (realy realy) needs it, i would also try a joint java-clojure compiler, but for now i don't have any interest in it myself |
| 17:05 | StartsWithK | will you accept that patches too? |
| 17:06 | fyuryu | StartsWithK: <StartsWithK> so i can use read with eval = false to realy check for namespace |
| 17:06 | fyuryu | names --- not sure I understand that part |
| 17:08 | StartsWithK | fyuryu: http://paste.pocoo.org/show/117753/ |
| 17:08 | StartsWithK | fyuryu: in my clojurec task i just check for "(ns" to decide is .clj file with namespace declaration or maybe it uses (in-ns), but that is weak |
| 17:09 | StartsWithK | it dosn't work if you type ;(ns blah..) |
| 17:09 | StartsWithK | anyway that task works like <clojurec srcdir='' destdir=''/> so you don't need to write namespaces you would like to compile |
| 17:10 | fyuryu | StartsWithK: Ah, I get it now |
| 17:11 | StartsWithK | fyuryu: i would like this new task to be inside cloak (with clojure-repl task) and after that i would add ant wrapper to cloak |
| 17:12 | fyuryu | StartsWithK: sounds cool. I was also thinking about about those topics and found that there's no way around ant. It has to be part of the toolbox. |
| 17:14 | StartsWithK | fyuryu: yes, and by providing a ant taks we would get support (in a way) for buildr, gradle and such as they all can use ant task in there builds. |
| 17:14 | StartsWithK | i looked at what lanced did, but that will not work, ant task are much more complex and can be registered at any time to project instance |
| 17:14 | djkthx | whats the equivalent to member in clojure? |
| 17:14 | djkthx | from common lisp? |
| 17:15 | fyuryu | StartsWithK: I found your repo on github, I'll try to find time during the week/weekend to look at it |
| 17:16 | StartsWithK | fyuryu: thanks, just don't merge, its not functional for now.. well i guess i could go now and try to fix it :) |
| 17:19 | fyuryu | StartsWithK: ok |
| 17:22 | danlarkin_ | Chouser: did you see my post in the error-kit + test-is thread? Any thoughts? |
| 17:47 | dfdeshom | hi, is there a way to build objects in clojure? something like the clos comes to mind |
| 17:48 | opqdonut | proxy |
| 17:49 | opqdonut | http://clojure.org/java_interop#toc25 |
| 17:49 | dreish | There's nothing like CLOS. The usual thing is to use hashes and multimethods. |
| 17:50 | opqdonut | yeh |
| 17:53 | dfdeshom | can I define custom operators for my types? Eg for ^,&, etc |
| 17:58 | danlarkin_ | dfdeshom: that's a loaded question... short answer is yes, but not for certain symbols... ^ is reserved by the reader already, and +,-, etc are already defined in clojure.core |
| 18:00 | StartsWithK | dfdeshom: you could also take a look at clojure.contrib.generic library |
| 18:01 | dfdeshom | thanks guys. |
| 18:02 | dfdeshom | I'm asking this because I saw a scala program doing operator overloading and I wanted to know how clojure does this, if at all |
| 18:03 | dreish | Scala and Clojure are extremely different languages. |
| 18:08 | dfdeshom | that's what i'm finding out :) . i like scala because i can use objects and clojure because it's dynamic in nature. they both have things that annoy me but i'm trying to find out which one gets in my way of thinking less |
| 18:36 | StartsWithK | dfdeshom: there are some libraries for clojure that let you program in oo style, i think spinoza (http://github.com/swannodette/spinoza/tree/master) is one of the more complete ones |
| 19:05 | dfdeshom | StartsWithK: thanks for the link. this is not a deal-breaker for me, i just want to know what's "easy" and "hard" to do w/ clojure |
| 19:58 | bpattison | can anyone tell me what the last statement is false? |
| 19:58 | bpattison | user=> (= () '()) |
| 19:58 | bpattison | true |
| 19:58 | bpattison | user=> (= {:x ()} {:x '()}) |
| 19:58 | bpattison | true |
| 19:58 | bpattison | user=> (= {:x '({:y ()})} {:x '({:y '()})} ) |
| 19:58 | bpattison | false |
| 19:58 | bpattison | it seems like it should be true as well |
| 20:00 | rhickey | (:y '{:y '()}) |
| 20:00 | rhickey | ,(:y '{:y '()}) |
| 20:00 | clojurebot | (quote ()) |
| 20:00 | rhickey | (:y '{:y ()}) |
| 20:00 | rhickey | ,(:y '{:y '()}) |
| 20:00 | clojurebot | (quote ()) |
| 20:01 | rhickey | ,(:y '{:y ()}) |
| 20:01 | clojurebot | () |
| 20:01 | rhickey | the outer quote prevent the inner one from being evaluated |
| 20:01 | rhickey | prevents |
| 20:02 | bpattison | oh -- so the outer quote is applying to the rest of the statement -- okay thanks |
| 20:02 | bpattison | and I don't need to quote the inner one |
| 20:03 | rhickey | bpattison: right |
| 20:04 | rhickey | '() is always unnecessary, just use () |
| 20:04 | bpattison | okay, that really helps me understand what's going on --thanks |
| 22:49 | chessguy | are merge and merge-with about the only way to combine 2 maps? |
| 22:53 | abrooks | chessguy: You can also conj two maps with the latter taking precedence: (conj {:a 1 :c 3 :b 42} {:b 2 :d 4}) |
| 22:53 | abrooks | ,(conj {:a 1 :c 3 :b 42} {:b 2 :d 4}) |
| 22:53 | clojurebot | {:d 4, :a 1, :c 3, :b 2} |
| 22:55 | chessguy | hmm |
| 22:57 | abrooks | In fact, I'm having trouble thinking how merge is any different than conj without going and looking at core.clj. |
| 22:57 | chessguy | so there's no good way to conj the two together, applying some uniquifying function to any key that's a duplicate |
| 22:58 | abrooks | chessguy: That's what merge-with is for. |
| 22:58 | chessguy | no, i want both the original key and a uniqified version to be in the result |
| 22:58 | abrooks | chessguy: The function you specify allows you to handle the duplicats. |
| 22:59 | abrooks | chessguy: Under the same key? You can't, the key must be unique in the map. |
| 22:59 | abrooks | chessguy: You can merge the values and that's what it does. |
| 22:59 | chessguy | sorry, i'm clearly not making myself clear |
| 23:00 | chessguy | i want something like (my-merge uniquifier {:a 1} {:a 1}) => {:a 1 :a_ 1} |
| 23:00 | hiredman | chessguy: sounds like you want to wrap assoc |
| 23:00 | unlink | Man, I'm so glad I found repl-utils/javadoc ... I was about to write that |
| 23:00 | hiredman | or wrap merge |
| 23:00 | chessguy | where uniquifier figures out how to generate the new symbol |
| 23:01 | chessguy | hiredman, hm. maybe wrap merge to be able to add a sequence of symbols to the resulting map? |
| 23:02 | hiredman | ,(assoc {:a 1} :a 1 :b 2) |
| 23:02 | clojurebot | {:b 2, :a 1} |
| 23:03 | hiredman | so you just wrap assoc to generate uniquefied keys for keys already in the keyset |
| 23:03 | hiredman | ,(.keySet #{:a}) |
| 23:03 | clojurebot | java.lang.IllegalArgumentException: No matching field found: keySet for class clojure.lang.PersistentHashSet |
| 23:03 | hiredman | ,(.keySet {:a 1}) |
| 23:03 | clojurebot | #< [:a]> |
| 23:03 | chessguy | hiredman, i see. i assume merge uses assoc |
| 23:04 | hiredman | ~def merge |
| 23:04 | durka42 | it does not |
| 23:04 | chessguy | bummer |
| 23:05 | chessguy | then wrapping assoc won't be enough |
| 23:07 | abrooks | chessguy: I have to ask... Is this really what you want to do? |
| 23:07 | chessguy | abrooks, good question |
| 23:07 | abrooks | :) |
| 23:07 | chessguy | the answer is, i'm not sure yet |
| 23:07 | chessguy | i'm brainstorming for a problem i'll be facing down the road |
| 23:07 | chessguy | good way to lwarn the language too :) |
| 23:08 | abrooks | A question I often wind up asking myself and more often with Clojure it seems. My first approaches are often orthogonal to the Clojure way at times. |
| 23:08 | abrooks | chessguy: I also highly recommend ProjectEuler.net for learning languages, functional ones in particular. (It was a big help to me, at least.) |
| 23:08 | chessguy | bah |
| 23:09 | chessguy | too much math knowledge needed |
| 23:09 | abrooks | chessguy: Heh. Okay. |
| 23:09 | chessguy | i don't really care to have to go look up fast prime-generation algorithms and such |
| 23:09 | chessguy | at least, not while learning a language :) |
| 23:12 | chessguy | anyway, learning the language isn't my primary goal at the moment, it's a side effect |
| 23:13 | chessguy | ,(dissoc) |
| 23:13 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$dissoc |
| 23:14 | chessguy | ,(dissoc {:a 1}) |
| 23:14 | clojurebot | {:a 1} |