2009-03-05
| 00:07 | zakwilson | ~translate to it: I don't speak Italian. |
| 00:07 | clojurebot | Non parlo italiano. |
| 00:22 | cooldude127 | clojurebot is a liar |
| 00:22 | cooldude127 | it obviously speaks italian |
| 00:28 | durka42 | clojurebot: do you speak italian? |
| 00:28 | clojurebot | Huh? |
| 01:23 | djkthx | any idea why im getting this error from sql in clojure-contrib? |
| 01:23 | djkthx | user=> (use '[clojure.contrib.sql :as sql]) |
| 01:23 | djkthx | java.lang.Exception: No such var: clojure.contrib.def/alter-meta! (sql.clj:22) |
| 01:26 | durka42 | djkthx: i don't get that. are your builds out of sync? |
| 01:26 | djkthx | i dont think so |
| 01:26 | djkthx | everything is the latest |
| 01:27 | durka42 | alter-meta! is in core |
| 01:27 | durka42 | ~latest |
| 01:27 | clojurebot | latest is 1323 |
| 01:27 | durka42 | ~latest contrib |
| 01:27 | clojurebot | latest contrib is 334 |
| 01:27 | durka42 | whoa that's incorrect |
| 01:27 | durka42 | latest contrib is 565 |
| 01:28 | djkthx | hmm |
| 01:28 | djkthx | im using the git repo for clojure-contrib |
| 01:28 | djkthx | i wonder if thats the problem... |
| 01:28 | durka42 | kevinoneill's? |
| 01:28 | djkthx | yeah |
| 01:29 | durka42 | i thought that was supposed to mirror googlecode |
| 01:29 | durka42 | so it shouldn't be a problem |
| 01:29 | durka42 | but i don't know |
| 01:29 | djkthx | hmm |
| 01:29 | djkthx | weird |
| 01:29 | durka42 | the last commit was today |
| 01:29 | durka42 | er, yesterday |
| 01:29 | durka42 | in error-kit |
| 01:30 | djkthx | hmmm |
| 01:33 | djkthx | alter-meta doesn't show up anywhere in clojure's src/ for me... |
| 01:34 | durka42 | ~source alter-meta! |
| 01:34 | djkthx | hmm |
| 01:34 | djkthx | guess my source is messed up |
| 01:34 | hiredman | djkthx: what svn rev are you at? |
| 01:35 | durka42 | hiredman: how can one check, without svn up'ing? |
| 01:35 | hiredman | svn info |
| 01:35 | durka42 | hiredman: i think he is using the git mirror |
| 01:35 | djkthx | im using svn for clojure |
| 01:35 | djkthx | didnt switch to the git mirror |
| 01:36 | djkthx | whoa |
| 01:36 | djkthx | r1162 |
| 01:36 | djkthx | thats quite old |
| 01:36 | durka42 | hiredman: this is incorrect: |
| 01:36 | durka42 | ~latest contrib |
| 01:36 | clojurebot | latest contrib is 334 |
| 01:36 | hiredman | that may be pre-google code |
| 01:36 | hiredman | durka42: then fix it |
| 01:36 | durka42 | that is pre-google code |
| 01:36 | djkthx | i believe it is |
| 01:36 | djkthx | yeah |
| 01:36 | durka42 | does clojurebot not watch contrib as it does core? |
| 01:36 | hiredman | someone set that, clojurebot doesn't track contrib svn |
| 01:36 | durka42 | it may have been me |
| 01:36 | djkthx | im assuming kevin oneill's follows google-code? |
| 01:36 | hiredman | at least note yet |
| 01:37 | hiredman | I really need to make svn.clj better |
| 01:38 | djkthx | cool |
| 01:38 | djkthx | works now |
| 01:38 | djkthx | thanks guys |
| 02:20 | Lau_of_DK | Hey guys |
| 02:23 | hiredman | yo |
| 02:30 | brennanc_ | I'm trying to understand the difference between alter and commute. Can someone explain? |
| 02:33 | hiredman | clojurebot: alter? |
| 02:33 | clojurebot | alter is always correct |
| 02:34 | brennanc_ | if thread A starts a transaction that modifies a ref and the B comes along after and completes the entire transaction before A is done, does that mean that A overwrites B? or does A start over when it sees there has been another commit |
| 02:37 | cgrand | brennanc_: A starts over |
| 02:37 | brennanc_ | thanks |
| 02:37 | cgrand | unless you used commute |
| 02:37 | hiredman | ... |
| 02:37 | brennanc_ | that's what I was referring to |
| 02:37 | brennanc_ | so what happens in the case of commute? |
| 02:39 | cgrand | at the end of the transaction A, the commute is recomputed with the latest value of the ref (since B modified it) |
| 02:40 | brennanc_ | isn't that the same as what alter does? |
| 02:43 | cgrand | if in thread A you use alter the whole transaction restarts, with commute the transaction would never restart. |
| 02:44 | cgrand | the return value of alter is guaranteed to be the value to which the ref will be set, there's no such guarantee with commute |
| 02:45 | brennanc_ | is there a better example/scenario? I'm not getting it. |
| 02:46 | brennanc_ | can you go throw 2 different examples, one with alter and one with commit? |
| 02:46 | hiredman | ,(doc io!) |
| 02:46 | clojurebot | "([& body]); If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message." |
| 02:47 | hiredman | ~def io! |
| 02:50 | cgrand | brennanc_: 2 min |
| 03:00 | lisppaste8 | cgrand pasted "alter vs commute" at http://paste.lisp.org/display/76500 |
| 03:11 | brennanc_ | cgrand: so it's set to 4 either way? |
| 03:13 | cgrand | yup |
| 03:13 | brennanc_ | I think I'm kind of getting it. What about the classic cash register example? Let's say 1) get balance, 2) add to balance, 3) set balance ... |
| 03:14 | brennanc_ | with commute, if B comes along after A does step 1, will A base it's result off of what it read, or will it know what it read is now invalid? |
| 03:15 | cgrand | if you use commute steps 1 2 and 3 are blended together |
| 03:15 | cgrand | (commute balance add some-cash) |
| 03:17 | brennanc_ | blended? |
| 03:17 | brennanc_ | I see there's a concurrency video, I'm going to look through that. Hopefully it explains it in there. |
| 03:19 | cgrand | commute gets the actual value, adds to it and sets it in one atomic step, B can't come along after setp 1 and before step 2 |
| 03:20 | cgrand | alter is the safe choice |
| 03:20 | brennanc_ | it sounds like B is safe as well from what you just said |
| 03:20 | brennanc_ | I'm confused :( |
| 03:22 | cgrand | "alter is the safe choice" is a general rule of thumb, in your last example I think commute would do fine |
| 03:24 | hiredman | clojurebot: alter? |
| 03:24 | clojurebot | alter is always correct |
| 03:26 | cgrand | if, in your transaction, you rely on the new value of the ref you need to use alter, else you can use commute. |
| 03:26 | brennanc_ | you're referring to the return value of the function vs the value of the ref? |
| 03:27 | brennanc_ | in alter they are the same, in commute they can be different? |
| 03:29 | cgrand | yes (the return value vs the value of the ref after the txn succeeded) |
| 03:29 | brennanc_ | ok, starting to get it |
| 03:30 | brennanc_ | :) |
| 03:31 | cgrand | (I hope I'm not going to confuse you further: but the return value is always consistent with the in-txn value) |
| 03:33 | brennanc_ | I'm going to finish watching the video, go to sleep, and then come back to it tomorrow. Hopefully it will make a lot more sense then. |
| 05:31 | eevar2 | ,(use 'clojure.contrib.lazy-seqs) |
| 05:31 | clojurebot | java.io.FileNotFoundException: Could not locate clojure/contrib/lazy_seqs__init.class or clojure/contrib/lazy_seqs.clj on classpath: |
| 05:33 | eevar2 | ,(use 'clojure.contrib.seq-utils) |
| 05:33 | clojurebot | java.io.FileNotFoundException: Could not locate clojure/contrib/seq_utils__init.class or clojure/contrib/seq_utils.clj on classpath: |
| 05:35 | eevar2 | ,(doc use) |
| 05:35 | clojurebot | "([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer." |
| 05:35 | kotarak | eevar2: do you have a problem with use? |
| 05:39 | eevar2 | not any more, thanks .) |
| 06:50 | timothypratley1 | user=> (import '(javax.sound.sampled AudioSystem)) |
| 06:50 | timothypratley1 | nil |
| 06:50 | timothypratley1 | user=> (import '(javax.sound.sampled DataLine.Info)) |
| 06:50 | timothypratley1 | java.lang.ClassNotFoundException: javax.sound.sampled.DataLine.Info |
| 06:51 | timothypratley1 | DataLine.Info <- was this invented to annoy Clojure users? |
| 06:52 | rhickey | ,javax.sound.sampled.DataLine$Info |
| 06:52 | clojurebot | javax.sound.sampled.DataLine$Info |
| 06:52 | timothypratley1 | :) thanks! |
| 09:48 | AWizzArd | BTW, yesterday was the birthday of AIM-8, Lisp: http://www.informatimago.com/develop/lisp/small-cl-pgms/aim-8/ |
| 09:55 | alinp1 | ,(doc take) |
| 09:55 | clojurebot | "([n coll]); Returns a lazy sequence of the first n items in coll, or all items if there are fewer than n." |
| 09:55 | alinp1 | ,(doc from) |
| 09:56 | clojurebot | java.lang.Exception: Unable to resolve var: from in this context |
| 09:56 | alinp1 | is possible in clojure to generate an infinite list ? |
| 09:56 | alinp1 | like in haskell |
| 09:56 | alinp1 | haskell equivalent: [1..] |
| 09:57 | alinp1 | in fact, will be nice to be a lazy infinite list |
| 09:57 | Chouser | ,(take 10 (iterate inc 5)) |
| 09:57 | clojurebot | (5 6 7 8 9 10 11 12 13 14) |
| 09:57 | alinp1 | ,(doc iterate) |
| 09:57 | clojurebot | "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects" |
| 09:57 | alinp1 | oh, thanks |
| 09:58 | Chouser | np |
| 10:48 | tashafa | Chouser: should duck-streams include a case for gzip compressed streams or our apps should handle those? |
| 11:04 | clojurebot | svn rev 1324; sped up for |
| 11:09 | Chouser | tashafa: that's a nice thought. would it need a parameter, or would it examine the stream itself in order to do the right thing? |
| 11:11 | Chouser | rhickey_: so much re-indenting recently. Is there a particular reason you're choosing to do that now? |
| 11:13 | leafw | Chouser: the new doc for doseq has a dangling parenthesis, very weird. |
| 11:13 | leafw | ,(doc doseq) |
| 11:13 | clojurebot | "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil." |
| 11:13 | leafw | not here on clojure bot, bot yes on latest revision. |
| 11:14 | rhickey_ | Chouser: looking at the :use proposal, I'd been thinking about namespaces declaring a preferred alias, to avoid having to :as when :require, now if :use does what :require did, but only when :as is supplied, that's thwarted |
| 11:14 | cemerick | some of the new indenting is irregular, too (like condp in r1324) |
| 11:14 | Chouser | rhickey_: I like the idea of a preferred alias. |
| 11:15 | rhickey_ | Chouser: aargh, I hadn't noticed that - there's a reformat code checkbox on IntelliJ I don't remember it ever having been set, but it must have been. I double-check the diff before checkins, but this happens on upload - yikes |
| 11:16 | Chouser | :-( |
| 11:16 | cemerick | rhickey_: are you using the intellij clojure plugin, then? |
| 11:17 | Chouser | cgrand: I found the def, still trying to find the actual changes... |
| 11:17 | Cark | hello |
| 11:17 | Chouser | cemerick: I don't know -- the clojure code appears to be indented unlike clojure code. |
| 11:18 | Chouser | Cark: hi |
| 11:18 | Cark | it has been a while (damn delphi project) glad to be back ! |
| 11:18 | cgrand | Chouser: line 2756 when-let -> when-first |
| 11:19 | cemerick | Chouser: I was thinking that perhaps the newness of the plugin might be falling down. I presume IntelliJ doesn't try to apply code reformatting to clojure files in any default config. |
| 11:19 | Chouser | Cark: I really liked Delphi, last time I used it. |
| 11:20 | Chouser | probably just over a decade ago now. :-) |
| 11:20 | Cark | chouser : the lack of closures is pretty hard to live with |
| 11:21 | Chouser | yes, my tastes have changed in the meantime, I'm sure. |
| 11:22 | Cark | but it's not too bad, for an imperative language, no need to be smart at all =P just let the fingers do the coding |
| 11:22 | rhickey_ | cemerick: I'm not editing with the plugin yet, but I use IntelliJ for svn and have plugin installed - the reformat checkbox must have been set in my upgrade to IntelliJ V8 |
| 11:22 | Chouser | leafw: I'm not seeing the paren mismatch on doseq. |
| 11:23 | Chouser | rhickey_: first noticed it in svn 1318 |
| 11:23 | rhickey_ | Chouser: aargh |
| 11:24 | cemerick | enclojure's formatting is almost perfect, IMO. It falls down a little with parens found in strings, tho. |
| 11:24 | leafw | Chouser: never mind. Appeared only once -- my interpreter may have screwed up. |
| 11:24 | rhickey_ | tools modifying after you say commit is a truly bad idea |
| 11:24 | clojurebot | svn rev 1325; sped up for, w/fixed formatting |
| 11:25 | Chouser | rhickey_: I wholeheartedly agree. Sounds destined for pain. |
| 11:25 | rhickey_ | 1325 better? |
| 11:27 | cemerick | yeah, I think so |
| 11:28 | rhickey_ | Chouser: so how does preferred alias jive with new :use? |
| 11:29 | cemerick | rhickey_: it looks like line number information for else forms isn't being reported properly -- the compile error reports the line number where the if-let form starts, rather than the line number of the else form (where a recent error of mine was) |
| 11:30 | cemerick | don't know if that's easily fixable, but... |
| 11:30 | cemerick | actually, the same thing happens with plain if forms as well |
| 11:31 | tashafa | Chouser: Regarding duck-streams: preferably it would examine the stream, so duck streams stay true to the "just-give-me-a-stream" mantra |
| 11:34 | rhickey_ | cemerick: got a test case? |
| 11:39 | cemerick | ah, the behaviour is different for fn invocations vs. symbols, and it has nothing to do with if at all -- same behaviour with do... |
| 11:39 | lisppaste8 | cemerick pasted "rhickey_: loss of line-number info" at http://paste.lisp.org/display/76525 |
| 11:41 | rhickey_ | cemerick: there's no line number info kept on plain symbols during compilation, only on lists |
| 11:42 | cemerick | OK, good to know. A good reason to keep the shorter form first. ;-) |
| 11:43 | rhickey_ | cemerick: aren't those errors always going to be a variant of 'I don't understand foo, or foo unbound' etc? pretty easy to find foo |
| 11:49 | cemerick | rhickey_: probably true, but I had an if-let that set a bunch of bindings from destructuring a map and had a long body; the else form was just returning a value that is available in the if-let body via the map destructuring. A casual look at the entirety of the if-let had a bunch of valid usages of foo, so finding the solitary foo reference in the else form required a careful reading. |
| 11:53 | rhickey_ | cemerick: ok. I'm still on the fence on adorning read symbols with line metadata |
| 11:54 | cemerick | is it just a question of space or compile time, or? |
| 11:54 | rhickey_ | yes |
| 11:57 | cemerick | I imagine that eventually there should be different compilation "profiles" -- I could care less about space or compile time, but I'll bet the mobile folks care very deeply. |
| 11:58 | rhickey_ | cemerick: yeah, there are a bunch of interesting pulls on Clojure right now - mobile, OSGi and other module-based platforms, TerraCotta, potability to CLR/JavaScript, high-perf people ... |
| 11:59 | rhickey_ | portability |
| 12:00 | cemerick | actually, we have multiple use-cases ourselves -- space is a real concern once we start looking at distributing software that includes clojure, rather than running stuff in-house (just to contradict myself within 60 seconds) |
| 12:00 | Chouser | spin-offs. did you guys see L# ? |
| 12:01 | rhickey_ | heh - this: http://www.lsharp.org/ ? is actually a derivative of my original DotLisp |
| 12:02 | Chouser | yeah, I think that's the one I was reading about, implemented using LINQ |
| 12:02 | Chouser | http://groups.google.com/group/LSharp/browse_frm/thread/f966f9a809cc702b |
| 12:03 | rhickey_ | That's why I like the supported Clojure/CLR effort |
| 12:04 | rhickey_ | rather than see clones, maybe all interested parties can pool their effort |
| 12:08 | Chouser | as for :use/:require, I'd very much like to see them consolidated. I don't think what they do is sufficiently different to warrant them being separate. |
| 12:10 | Chouser | with that as a goal, perhaps (uses 'foo.bar.baz) could default to using the preferred alias |
| 12:10 | Chouser | then (uses 'foo.bar.baz :exclude ()) could act like 'use' does now, refer'ing in all the symbols |
| 12:11 | Chouser | (uses 'foo.bar.baz :as qux) would ignore the perferred alias and use qux instead. |
| 12:12 | Chouser | 'uses' could support all the other flags that 'use' and 'require' currently do, so they could be deprecated to allow everyone to transition to 'uses' |
| 12:15 | shoover | clojurebot: thirsty is yes, until Clojure is potable |
| 12:15 | clojurebot | You don't have to tell me twice. |
| 12:26 | kotarak | Hmmm... AOT compilation looses metadata on namespaces. |
| 12:28 | kotarak | Having a (ns foo.bar "docstring") in a corresponding file and loading the file via require shows the docstring in the (doc foo.bar) output. AOT compiling the file and loading from the class file only shows nil in the (doc foo.bar) output. |
| 12:32 | Cark | i'm having a bit of trouble making a jar execuable |
| 12:33 | Cark | if i do this : java -cp app.jar application |
| 12:33 | Cark | it works |
| 12:33 | leafw | jars cannot be executable |
| 12:33 | Cark | but it won't work by just java -jar app.jar |
| 12:33 | leafw | oh that. Just declare the manifest file. |
| 12:34 | Cark | right i made a manifest file |
| 12:34 | danlarkin | leafw: hm? jars can be executable |
| 12:34 | leafw | ant should do it for you if you set up its XML sourcery properly. |
| 12:34 | Cark | i'm doing it manually, i want to understand it all |
| 12:34 | Cark | my manifest file has this : ClassPath: . |
| 12:34 | Cark | and : Maiin-Class: application |
| 12:34 | Cark | with only one i =P |
| 12:35 | Cark | the application.class file is at the root of the jar file |
| 12:35 | hiredman | manifests aren't xml |
| 12:35 | hiredman | oh |
| 12:35 | hiredman | ant |
| 12:36 | Cark | so when trying to run the jar file i get "Exception in thread "main" java.lang.NoClassDefFoundError: application" |
| 12:36 | hiredman | Cark: there should be a directory structure inside the jar that mirrors the namespace declartion of your application |
| 12:36 | Cark | right |
| 12:36 | Cark | i tried all combinations |
| 12:37 | Cark | eventually i went for no directory structure at all as a simple case |
| 12:37 | hiredman | ~namespace |
| 12:37 | clojurebot | namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it |
| 12:37 | Cark | but i tried test/application.class with a namespace of test.application aswell |
| 12:38 | Cark | right now it's application.clj direct in root of jar, with clojure namespace of 'application' all alone |
| 12:38 | hiredman | so a single segment namespace? |
| 12:38 | Cark | right |
| 12:38 | hiredman | "Do not try to use single segment namespaces." |
| 12:39 | Cark | ah ok... i'll revert to directory and let you know ! |
| 12:41 | Cark | still no good : Exception in thread "main" java.lang.NoClassDefFoundError: test/application |
| 12:41 | Cark | but it is really there in the jar file ... i don't get it |
| 12:41 | keithb | Hi, all. I'm trying to subclass a Java file for the first time. What am I doing wrong here?: http://gist.github.com/74451 . Line 71 is the 'def clear-action...' line. |
| 12:41 | hiredman | lisppaste8: url? |
| 12:41 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 12:42 | hiredman | cat you pastebin your manifest? |
| 12:42 | hiredman | keithb: you are missing a few parens |
| 12:42 | lisppaste8 | cark pasted "a manifest file" at http://paste.lisp.org/display/76529 |
| 12:43 | robnik | Hi. Is there a way to use `for' to process 2+ sequences in parallel, like you can with `map'? So that you can do something like (for [a (range 2) b (range 2)] (list a b)) --> ((0 0) (1 1)) ? |
| 12:43 | keithb | hiredman: really? Even with the 2 parens at the bottom (where they probably shouldn't be)? |
| 12:44 | hiredman | keithb: really |
| 12:46 | keithb | hiredman: I appreciate your help. I count 4 open and 4 close parentheses. Do you see differently? |
| 12:46 | hiredman | keithb: I did not say your parens are unbalanced |
| 12:46 | keithb | hiredman: Oh, I see... |
| 12:47 | hiredman | Cark: how are you making your jar? |
| 12:47 | Cark | jar cmf mf-app.txt app.jar -C classes . |
| 12:47 | kotarak | Cark: did you actually compile the source file? |
| 12:48 | hiredman | kotarak: apperently java -cp foo.jar test.application works |
| 12:48 | Cark | yes it is in the jar |
| 12:48 | Cark | yes it does |
| 12:48 | kotarak | ah. Sorry. Didn't see this. |
| 12:49 | Cark | well i can use it this way, that's not such a big deal, still i hate it when i don't understand the problem =P |
| 12:49 | hiredman | try something like jar cevf test.application app.jar -C classes . |
| 12:50 | kotarak | Cark: did you include also the Clojure .class files in the jar? |
| 12:50 | hiredman | (get jar to auto-generate a manifest for you) |
| 12:50 | Cark | kotarak : they are there, in the right place |
| 12:50 | keithb | hiredman: Got it. Doh! Of course I needed to put parens around the overridden function. Thanks for your help. |
| 12:50 | Cark | hiredman : will try that now |
| 12:54 | Cark | hiredman : now it's working ... the only difference is the Class-Path declaration isn't there anymore |
| 12:54 | Cark | thanks ! |
| 12:55 | hiredman | are you sure that is the only difference? is there an extra line at the end? |
| 12:55 | Cark | i checked that |
| 12:55 | hiredman | huh |
| 12:56 | hiredman | anyway |
| 12:56 | hiredman | It Works! |
| 12:56 | Cark | now i tried doing it manually, and no good ... |
| 12:56 | Cark | that's soem crazy sh*t |
| 12:56 | gnuvince | Hello everyone |
| 12:56 | Cark | hello gnuvince |
| 12:57 | gnuvince | Has anyone read "Calculus Made Easy" by Silvio Thompson and re-worked by Something Gardner? |
| 12:58 | hiredman | the only books I read are ones with spaceships on the cover |
| 12:58 | gnuvince | hiredman: you read that Forth book, eh? |
| 12:58 | hiredman | gnuvince: FICTIONAL spaceships |
| 13:00 | Cark | for the record ... i had a space character after test.application in the manual case .... |
| 13:00 | Cark | that's nuts |
| 13:01 | hiredman | *shrug* |
| 13:02 | Cark | some guy at sun must have thought : "you never know there might be a class file with a space at the end" |
| 13:02 | Cark | anyways thanks again hiredman |
| 13:26 | AWizzArd | Has there been some success to let Clojure apps run on mobile phones? |
| 13:31 | scottj | The feature in slime that highlights in the echo area parameter list what parameter you're currently editing doesn't work with clojure right? I just want to make sure I'm not missing out on this awesome feature because I have something misconfigured. |
| 14:11 | Lau_of_DK | Hello everybody |
| 14:11 | kotarak | Hi Lau |
| 14:11 | cgrand | Hi! |
| 14:12 | danlarkin | Heya! |
| 14:15 | sverrej | Is it possible to create java classes at runtime in Clojure, or do they have to be compiled first? |
| 14:16 | sverrej | I tried to proxy Object, but it seems as with proxy one can only create methods that are defined in an interface. |
| 14:16 | leafw | sverrej: see doc gen-class |
| 14:17 | sverrej | leafw: Yes, I did, and there it seemed as if I have to do it compile time, with the extra hassle of setting the classpath. |
| 14:17 | leafw | IIRC, you can do it on the fly |
| 14:18 | kotarak | gen-class must be compiled |
| 14:19 | Chouser | leafw: that used to be the case, but gen-class does nothing now except when compiled. |
| 14:19 | Chouser | AOT |
| 14:19 | sverrej | ok, and gen-class is the only way of making classes? |
| 14:19 | kotarak | sverrej: classes with new methods, yes. |
| 14:20 | sverrej | exactly |
| 14:20 | sverrej | ok |
| 14:20 | Chouser | no, proxy makes classes, but there are constraints as you noted. |
| 14:20 | leafw | ok thanks Chouser |
| 14:20 | Lau_of_DK | sverrej: for adding methods and accessing protected fields, you need gen-class |
| 14:20 | Lau_of_DK | If none of those apply, you SHOULD be fine with proxy |
| 14:20 | Lau_of_DK | clojurebot: proxy? |
| 14:20 | clojurebot | proxy is <Chouser> proxy teases with its ease of use, then suddenly betrays. |
| 14:20 | Chouser | you can use gen-interface, AOT compile that, and then try out various implementations using proxy. |
| 14:21 | sverrej | Chouser: Yes, I will probably do something like that. |
| 14:21 | Lau_of_DK | Chouser: Example? |
| 14:21 | Chouser | Lau_of_DK: sverrej will cook one up for you. ;-) |
| 14:21 | sverrej | Is this because of limitations in the JVM, or is this a Clojure design choice? |
| 14:21 | Chouser | sverrej: a bit of both. |
| 14:23 | Lau_of_DK | Chouser: You've got a definate meanstreak |
| 14:23 | Chouser | My understanding is that the JVM puts various restrictions here and there about classloaders, classes can't be changed once their loaded, etc. that together made dealing with dynamically-defined classes error-prone. |
| 14:23 | Lau_of_DK | But I understand, if I was as cocky as you, I'd have the same :) |
| 14:23 | Chouser | So Clojure attempted to support that for a while, but no longer does. |
| 14:24 | mtz | Chouser: http://www.zeroturnaround.com/javarebel/ |
| 14:24 | Chouser | I think the reason proxy is still allowed at runtime is that it takes so few parameters that actually effect how it bahaves -- essentially just the superclass and list of interfaces. This allows a single unique name for the class to be created, and there's no question of trying to change it later. |
| 14:25 | Chouser | mtz: interesting. have you tried it with Clojure? |
| 14:26 | mtz | no. i just wanted to show that they somehow solved the class reloading problem. |
| 14:28 | pjstadig | ok so another terracotta issue |
| 14:28 | pjstadig | i got two repls connected to terracotta last night at 10:40pm |
| 14:29 | pjstadig | but it's really flakey and for some reason it was printing my repl prompt in one of the repls readably ("user=>" with the quotes) |
| 14:29 | pjstadig | now i can't get two connected again |
| 14:30 | pjstadig | i'm getting an NPE in PersistentHashMap |
| 14:30 | durka42 | ,(binding [*print-dup* true] (println "user=>")) |
| 14:30 | clojurebot | "user=>" |
| 14:30 | durka42 | ,(println "user=>") |
| 14:30 | clojurebot | user=> |
| 14:30 | pjstadig | i think it has to do with the fact that Classes are used occasionally as keys into PersistentHashMap |
| 14:30 | pjstadig | and Classes don't seem to have the same hashCode across VMs |
| 14:31 | pjstadig | at least while debugging i'm seeing clojure.lang.Var being compared to an existing node with the same key |
| 14:32 | pjstadig | and the hashes are different, so it attempts to split the leafnode and it dies with an NPE when trying to create a new node |
| 14:32 | Chouser | classes are used as hash keys for the print-method multimethod table |
| 14:32 | Chouser | I had to work through some issues with that for ClojureScript. |
| 14:32 | pjstadig | yeah that's exactly where the problem is |
| 14:33 | pjstadig | it's trying to print the REPL prompt |
| 14:33 | pjstadig | it is trying to cache a value in the multimethod table |
| 14:34 | pjstadig | Chouser: any words of wisdom? |
| 14:38 | Chouser | hm... I had to write a JS version of clojure.lang.Util.hash() anyway, so I handled classes directly there. |
| 14:38 | pjstadig | ok |
| 14:39 | pjstadig | so i could rewrite clojure.lang.Util.hash() |
| 14:39 | Chouser | right. it was a natural solution for me. not sure if it makes sense in your scenario. |
| 14:39 | pjstadig | actually i think it makes sense |
| 14:39 | pjstadig | i'm gonna give it a whirl |
| 14:40 | pjstadig | i've already had to make some changes to Util.equals and introduce a Util.equiv because of the "object identity crisis" for java.lang.Boolean with TC |
| 14:41 | Chouser | ah, ok. |
| 14:42 | pjstadig | sorry |
| 14:42 | pjstadig | i meant introduce Util.same |
| 14:42 | pjstadig | i'm going to have a PhD in the innerworkings of Clojure after this :0 |
| 14:45 | pjstadig | cool |
| 14:45 | pjstadig | i have REPLs |
| 14:46 | pjstadig | in one VM: |
| 14:46 | pjstadig | user=> (defn foo [] 42) |
| 14:46 | pjstadig | #'user/foo |
| 14:46 | pjstadig | user=> |
| 14:46 | pjstadig | In another: |
| 14:46 | pjstadig | "user=> "(foo) |
| 14:46 | pjstadig | 42 |
| 14:46 | pjstadig | "user=> " |
| 14:47 | Chouser | whoa. |
| 14:47 | pjstadig | it's weird that the one is printing the REPL prompt with quotes |
| 14:47 | pjstadig | because |
| 14:47 | pjstadig | "user=> "*print-dup* |
| 14:47 | pjstadig | false |
| 14:47 | pjstadig | "user=> " |
| 14:47 | pjstadig | there is obviously still a lot to do :) |
| 14:48 | pjstadig | i'm gonna try disconnecting/reconnecting and look for foo |
| 14:49 | pjstadig | cool |
| 14:49 | pjstadig | reconnected and foo still exists |
| 14:50 | kotarak | pjstadig: \o/ grats |
| 14:50 | pjstadig | thx |
| 14:51 | pjstadig | still very raw, but i should package this up and push it to github |
| 14:54 | jwinter | pjstadig: wow, that sounds v. cool. |
| 15:34 | Lau_of_DK | Compojure crew (Madison Square Clabango, chime in if relevant) - Is there anyway to persist an object in memory, which all clients to the website can access? |
| 15:35 | danlarkin | atom or a ref |
| 15:35 | Lau_of_DK | ref |
| 15:35 | Lau_of_DK | its a massive struct, that I dont want to go to I/O for every time |
| 15:42 | rhickey_ | pjstadig: congrats on TC progress! |
| 15:44 | danlarkin | Lau_of_DK: so what's the question, just have a ref like any other program |
| 15:45 | pjstadig | rhickey_: thx |
| 15:45 | Lau_of_DK | Yea - What Im thinking is, I can make a little Clojure app on the server, which acts as a local server, where you feed it your data and it returns the result of a look up it does on a hash-map it has in memory - But I'd be very happy to avoid this, if I could persist this structure in my webapp directly |
| 15:46 | pjstadig | once i sort out what can be part of the integration module and what probably needs to be patched in clojure |
| 15:46 | pjstadig | should i just open tickets? |
| 15:47 | rhickey_ | pjstadig: no, you should post on the group what your issues are/were and let me think about how best to accommodate TC, or start a Google Doc or something |
| 15:47 | danlarkin | Lau_of_DK: so why not just define a ref in some namespace and access it directly from your compojure functions |
| 15:48 | Lau_of_DK | That might be a way - Im just not sure what happends to compojure/jetty between clients |
| 15:49 | Lau_of_DK | danlarkin: Have you tested this in Madison Square Clabango ? |
| 15:50 | pjstadig | k |
| 15:50 | danlarkin | Lau_of_DK: haven't tested it, but my intuition says it will work just fine |
| 15:50 | pjstadig | yeah i wasn't even thinking about code, but just tickets to explain the issues, but a google doc will work too |
| 15:51 | danlarkin | Lau_of_DK: as long as you use defonce, since the builtin runserver does code reloading |
| 15:52 | Lau_of_DK | oh, defonce... that might do the trick |
| 16:01 | Lau_of_DK | danlarkin: Works well I think - Thanks for the tip |
| 16:05 | jwinter | Lau_of_DK: so defining a ref from one servlet makes it available to others? |
| 16:06 | Lau_of_DK | (defonce *data-set* (import-huge-data-set source)) |
| 16:06 | Lau_of_DK | Its read-only |
| 16:06 | Lau_of_DK | But yes, this is available to all clients, like a ref would be I imagine |
| 16:06 | jwinter | cool, that's handy |
| 16:07 | Lau_of_DK | Very |
| 16:07 | Lau_of_DK | Cutting out SQL and Disk I/O gains alot of speed |
| 16:07 | Lau_of_DK | Im doing lookups on 1M lines in 200 msecs |
| 16:08 | danlarkin | Lau_of_DK: cool, glad it worked out |
| 16:24 | redalastor | What's the idiom already to simulate default values to functions? |
| 16:25 | Chouser | you can use either destructuring or multi-arity functions |
| 16:25 | Chouser | (fn [a & [b c d]] ...) ; b c and d are optional, default to nil |
| 16:26 | Chouser | (fn foo ([a] (foo a 2 3)) ([a b] (foo a b 3)) ([a b c] ...)) ; b and c are optional, default to 2 and 3 respectively |
| 16:26 | redalastor | That wouldn't do, I can either pass a, b, both or neither. I need a default value for both of them. |
| 16:26 | redalastor | That would :) |
| 16:27 | Chouser | the second way is probably faster at runtime too |
| 16:27 | hiredman | ,((fn [{:keys a b :or {a 1 b 2}}] [a b]) {}) |
| 16:27 | clojurebot | java.lang.ArrayIndexOutOfBoundsException: 5 |
| 16:27 | kotarak | redalastor: you can use :keyword arguments and turn the arglist into a hash-map. |
| 16:28 | kotarak | redalastor: see hiredman :) |
| 16:28 | hiredman | ,((fn [{:keys a b :or {a 1 b 2}}] [a b]) {:a 1}) |
| 16:28 | clojurebot | java.lang.ArrayIndexOutOfBoundsException: 5 |
| 16:28 | hiredman | bah |
| 16:28 | hiredman | http://clojure.org/special_forms#let <-- estructuring |
| 16:29 | hiredman | destructuring |
| 16:29 | hiredman | ,((fn [{:keys [a b] :or {a 1 b 2}}] [a b]) {}) |
| 16:29 | clojurebot | [1 2] |
| 16:29 | hiredman | ,((fn [{:keys [a b] :or {a 1 b 2}}] [a b]) {:a 3 :b 4}) |
| 16:29 | clojurebot | [3 4] |
| 16:29 | kotarak | ,((fn [& args] (let [{:keys [a b] :or {a 1 b 2}} (apply hash-map args)] [a b]) :a 5) |
| 16:29 | clojurebot | EOF while reading |
| 16:29 | kotarak | ,((fn [& args] (let [{:keys [a b] :or {a 1 b 2}} (apply hash-map args)] [a b])) :a 5) |
| 16:29 | clojurebot | [5 2] |
| 16:30 | hiredman | ugh |
| 16:53 | AWizzArd | Does the JVM currently have a concurrent GC? |
| 16:53 | AWizzArd | It seems Java 6 Update 14, which should appear in a few months, will have one, the G1: http://research.sun.com/jtech/pubs/04-g1-paper-ismm.pdf |
| 17:01 | Lau_of_DK | When Im JavaC compiling isnt there a simple way to add all jars in a directory to classpath ? like javac -classpath ${/path/to/jars}/*.jar ? |
| 17:02 | AWizzArd | Lau_of_DK: I think most people wrote a script which will call javac with the right parameters |
| 17:02 | Lau_of_DK | can most people paste their scripts here? :) |
| 17:02 | StartsWithK | javac -classpath "basepath/*.jar" dosn't work? |
| 17:03 | Lau_of_DK | no |
| 17:03 | AWizzArd | Lau_of_DK: write a small Clojure program that runs in the shell |
| 17:03 | cp2 | iirc you can specify a directory for it to search in |
| 17:03 | AWizzArd | Or alternatively you could use Enclojure. There you just need to press a green Play button. |
| 17:04 | Lau_of_DK | javac -classpath /home/lau/coding/lisp/clojure/libs/*.jar -d classes/ com/jme/bounding/*.java |
| 17:04 | Lau_of_DK | javac: invalid flag: /home/lau/coding/lisp/clojure/libs/commons-io-1.4.jar |
| 17:04 | Lau_of_DK | Usage: javac <options> <source files> |
| 17:04 | Lau_of_DK | |
| 17:04 | cp2 | -sourcepath sourcepath Specify the source code path to search for class or interface definitions. As with the user class path, source path entries are separated by semicolons (;) and can be directories, JAR archives, or ZIP archives. |
| 17:04 | cp2 | well |
| 17:04 | cp2 | hm |
| 17:04 | cp2 | i dont know if that will included already compiled stuffs |
| 17:05 | cp2 | worth a try |
| 17:05 | Lau_of_DK | man I hate java compilation |
| 17:05 | Lau_of_DK | I think I'll surrender and just use netbeans |
| 17:05 | cp2 | yeah |
| 17:05 | cp2 | javac is kinda lacking |
| 17:05 | cp2 | on some useful features |
| 17:06 | cp2 | you could write a short (dare i say) perl (or maybe bash) script to concat all jar files in whatever dir with : |
| 17:06 | StartsWithK | Lau_of_DK: javac -cp "lib/*" Test.java |
| 17:06 | cp2 | so then you can java -cp `getstuff lib/` blah |
| 17:06 | StartsWithK | works for me |
| 17:06 | Lau_of_DK | I'd rather format my harddrive that you perl |
| 17:06 | cp2 | lool |
| 17:06 | Lau_of_DK | s/you/use |
| 17:07 | Lau_of_DK | StartsWithK: Windows? |
| 17:07 | StartsWithK | Lau_of_DK: linux |
| 17:08 | Lau_of_DK | k |
| 17:08 | Lau_of_DK | doesnt work here |
| 17:09 | Lau_of_DK | http://www.jmonkeyengine.com/wiki/doku.php?id=downloading_and_installing_jme_2 |
| 17:09 | Lau_of_DK | *sigh* |
| 17:10 | cp2 | [will@microwave ~]$ javac -cp ".clojure/*" test.java |
| 17:10 | cp2 | worked for me too |
| 17:10 | AWizzArd | with NetBeans it is really very easy. |
| 17:10 | cp2 | Lau_of_DK: java -version |
| 17:10 | Lau_of_DK | cp2 its always these addons to jmonkey I cant get to compile |
| 17:11 | Lau_of_DK | Theres something fundamental Im missing, and its not JMonkey |
| 17:11 | cp2 | heh |
| 17:11 | Lau_of_DK | AH |
| 17:11 | cp2 | what message(s) are you getting |
| 17:11 | cp2 | class not found etc |
| 17:11 | Lau_of_DK | It might be the library path |
| 17:11 | StartsWithK | Lau_of_DK: Just tried it again and i'm sure it works http://pastebin.com/d2ab2b791 |
| 17:11 | AWizzArd | In NetBeans you have a window in which you select all the .jar files which you want to use. When you press a button it will generate your own double clickable .jar file with everything you need. |
| 17:11 | cp2 | library path is used for shared libraries, it will compile without it |
| 17:11 | cp2 | infact im not sure if javac even has a -D flag |
| 17:11 | Lau_of_DK | Not according to the wiki |
| 17:12 | StartsWithK | you don't need library path for javac |
| 17:12 | StartsWithK | its a runtime thing |
| 17:12 | cp2 | yeah |
| 17:13 | StartsWithK | i just downloaded jme from zip on there google code site |
| 17:13 | StartsWithK | and included jogl libs in my lib/ dir |
| 17:14 | StartsWithK | it was easyest way to go |
| 17:14 | kefka | I've noticed a performance "bug" (perhaps not really) in clojure.set/intersection. |
| 17:15 | kefka | (clojure.set/intersection #{5} +large-set+) takes a long time, when it needn't, |
| 17:15 | kefka | but (filter +large-set+ #{5}) is essentially instantaneous (as it should be) |
| 17:15 | Lau_of_DK | I gotta get to bed - Thanks for looking into this with me guys |
| 17:16 | cp2 | np |
| 17:18 | kefka | Ok: the obvious work-around is to use clojure.set/select. |
| 17:19 | kefka | ,(let +s+ (range 1000000) (time (clojure.set/intersection #{5} *s*))) |
| 17:19 | clojurebot | java.lang.IllegalArgumentException: let requires a vector for its binding |
| 17:19 | kefka | ,(let [+s+ (range 1000000)] (time (clojure.set/intersection #{5} *s*))) |
| 17:19 | clojurebot | java.lang.Exception: Unable to resolve symbol: *s* in this context |
| 17:19 | kefka | ,(let [+s+ (range 1000000)] (time (clojure.set/intersection #{5} +s+))) |
| 17:19 | clojurebot | #{} |
| 17:19 | clojurebot | "Elapsed time: 1.069 msecs" |
| 17:20 | kefka | ,(let [+s+ (set (range 1000000))] (time (clojure.set/intersection #{5} +s+))) |
| 17:20 | clojurebot | Execution Timed Out |
| 17:20 | kefka | ,(let [+s+ (set (range 1000000))] (time (clojure.set/select +s+ #{5}))) |
| 17:20 | clojurebot | Execution Timed Out |
| 17:20 | kefka | ,(let [+s+ (set (range 100000))] (time (clojure.set/select +s+ #{5}))) |
| 17:20 | clojurebot | #{5} |
| 17:20 | clojurebot | "Elapsed time: 0.759 msecs" |
| 17:21 | kefka | ,(let [+s+ (set (range 100000))] (time (clojure.set/intersection +s+ #{5}))) |
| 17:21 | clojurebot | #{5} |
| 17:21 | clojurebot | "Elapsed time: 0.17 msecs" |
| 17:21 | kefka | ,(let [+s+ (set (range 100000))] (time (clojure.set/intersection #{5} +s+))) |
| 17:21 | clojurebot | #{5} |
| 17:21 | clojurebot | "Elapsed time: 0.161 msecs" |
| 17:21 | kefka | Odd. Select gets killed there. Has clojure.set/intersection recently been improved? I guess I need to update my checkout. |
| 17:22 | Chouser | kefka: http://groups.google.com/group/clojure/browse_thread/thread/29609929e94f279c |
| 17:23 | Chouser | http://code.google.com/p/clojure/issues/detail?id=52 fixed Feb 22 |
| 17:26 | kefka | Chouser: Cool. Thanks. |
| 17:29 | keithb | All: I've got a question. In the code at http://gist.github.com/74602, shouldn't I be able to define a fn in a let clause, and then use it subsequently? What am I doing wrong? |
| 17:31 | Chouser | do you say (label-panel) later? |
| 17:32 | Chouser | anyway, nothing is jumping out at me there. perhaps pasting a small runnable example would help. |
| 17:32 | keithb | Chouser: Yes, sorry, here's the whole function: http://gist.github.com/74604 |
| 17:34 | Chouser | I was hoping for the package name of GridLayout so I didn't have to go look it up. :-) |
| 17:34 | Chouser | java.awt.GridLayout |
| 17:34 | keithb | Chouser: Sorry, it's java.awt, and JPanel is javax.swing. Forgot to include them... |
| 17:36 | keithb | Chouser: Ok, what the heck, I'm not going to win the Nobel Prize for it, so here's the whole file posted: http://gist.github.com/74606 |
| 17:36 | Chouser | and it's still not runnable, because call functions not shown there. |
| 17:36 | Chouser | :-) ok |
| 17:36 | Chouser | other than pasting the whole thing, you could trim it down to the few lines actually causing the error. |
| 17:37 | Chouser | you might find you can spot it on your own then as well. |
| 17:37 | keithb | Chouser: I've been doing that for quite a while now ... ;) |
| 17:37 | Chouser | ok |
| 17:38 | keithb | First I used #( notation, and thought that was the problem, so changed to fn. |
| 17:38 | Chouser | keithb: you know how to examine the stack trace? |
| 17:39 | hiredman | are you sure it is that function that is cause the exception |
| 17:39 | keithb | Chouser: Yes, I've worked with Java for many years, but this one goes into the Clojure compiler code, and not my code, so I don't understand it very well. |
| 17:39 | keithb | wait... |
| 17:40 | hiredman | are you working at the repl with this? my guess is you def'ed that function without the . after JPanel |
| 17:40 | Chouser | stray paren |
| 17:40 | Chouser | line 134 |
| 17:41 | hiredman | oh |
| 17:41 | jave | hello |
| 17:41 | keithb | Chouser: hiredman Holy #@$#$! Thank you, and sorry to waste your time... |
| 17:41 | jave | why doesnt the following snippet work? (.getPackages (proxy [ClassLoader] [] (getPackages [] (.. this getParent getPackages )))) |
| 17:42 | Chouser | keithb: also worth noting that the real error wasn't in any of the earlier pastes. :-) |
| 17:42 | hiredman | jave: that crashed my jvm |
| 17:42 | jave | oh :| |
| 17:43 | hiredman | ~jdoc ClassLoader |
| 17:43 | Chouser | jave: you can't add methods using proxy |
| 17:43 | Chouser | hm. |
| 17:43 | jave | ive read that, but dont quite understand |
| 17:43 | keithb | Chouser: Sorry about that. it turns out that I wasn't aware that it was a nested exception and the real cause was further down the stack trace. Now I understand why you asked about the stack trace. So I was indeed looking in the wrong place. Lesson learned. Hopefully will remember next time. ;) |
| 17:43 | Chouser | I though you could override protected methods, though. |
| 17:44 | Chouser | keithb: not a problem. happy to help. |
| 17:44 | jave | Chouser: yes the docs do say you can overide protected methods |
| 17:45 | Chouser | oh, it wants a string arg |
| 17:46 | Chouser | nope, sorry, misread. |
| 17:46 | Chouser | oh, but you can't call the protected method of the Parent classloader. |
| 17:46 | jave | ah hmm |
| 17:47 | jave | that kind of killed my plan then :) |
| 17:48 | Chouser | hm, yes, I see you plan. a pity. |
| 17:49 | jave | (my plan involves making a backend for Emacs/CEDET using Clojure) |
| 17:50 | Chouser | oh |
| 17:50 | jave | a java backend, that is |
| 17:54 | scottj | The feature in slime with common lisp that highlights in the echo area parameter list what parameter you're currently editing doesn't work with clojure right? I just want to make sure I'm not missing out on this awesome feature because I have something misconfigured. |
| 17:57 | ayrnieu | scottj - if you see the echo'd parameters but don't see one highlighted, then the feature isn't supported. |
| 18:23 | keithb | All, is there a way to have a function's documentation string extend to more than 1 line? |
| 18:24 | ayrnieu | just extend it to more than one line. |
| 18:24 | Chouser | literal newlines are allowed in strings |
| 18:25 | keithb | Thanks. |
| 18:29 | keithb | Am I correct in understanding that use of proxy creates a new (sub)class? Is a new class added to the system each time it's called? |
| 18:39 | hiredman | keithb: nope |
| 18:39 | keithb | hiredman: No to both? |
| 18:39 | hiredman | ~jdoc java.lang.reflect.Proxy |
| 18:42 | keithb | thanks. |
| 18:43 | keithb | where can i find documentation for the clojurebot commands? They're really cool... |
| 18:43 | hiredman | uh, well, you see, they are not really documented |
| 18:43 | hiredman | clojurebot: where are you? |
| 18:43 | clojurebot | http://github.com/hiredman/clojurebot/tree/master |
| 18:44 | hiredman | I sort of started down that direction in the README |
| 18:44 | hiredman | but have not made it very far |
| 18:45 | Chouser | Clojure's proxy does not create a java.lang.reflect.Proxy |
| 18:45 | hiredman | oh |
| 18:45 | hiredman | my mistake |
| 18:45 | hiredman | ~def proxy |
| 18:45 | Chouser | easy one to make. :-/ |
| 18:45 | hiredman | so it does do teh subclass thing? |
| 18:46 | hiredman | how embarressing |
| 18:46 | Chouser | keithb: the first time a set of superclasses is given the proxy macro, it creates a new class at macro-expand time. |
| 18:47 | Chouser | then at runtime, every time proxy is called a new instance of that class is created. |
| 18:47 | Cark | . |
| 18:47 | Cark | hum that was my cat speaking |
| 18:47 | keithb | Chouser: Very cool. I imagine then that performance for that "real" class is faster than it would be for a Java proxy class? |
| 18:48 | Cark | so why the limitations about protected members ? |
| 18:48 | Chouser | Cark: I don't know. |
| 18:49 | Cark | i'll have a look tomorrow |
| 18:49 | Chouser | hm, perhaps because the body of the given methods aren't really inside the class at all |
| 18:50 | rhickey_ | Cark: the methods defined in proxy classes are stubs that call out to real fns, which have no relationship to the superclass and thus no protected access |
| 18:50 | Chouser | the methods in the class generated by 'proxy' all simply look up the approriate clojure fn in a map. |
| 18:50 | Cark | that makes sense |
| 18:50 | Chouser | such a pity |
| 18:51 | Chouser | perhaps proxy could generate stubs for all the protected members |
| 18:53 | Chouser | that'd be another set of use cases that could be handled by proxy that currently require gen-class |
| 18:53 | Cark | ah that might be usefull |
| 18:54 | Cark | though i didn't have such a need yet |
| 18:55 | keithb | ~def gen-class |
| 19:11 | Chouser | In Java, if you have class B that extends class A, can an instance of class B use a protected member of class A? |
| 19:12 | Raynes | I want to say yes. |
| 19:13 | Chouser | yeah, that's what I thought. I should experiment, but if so then simply creating a proxy subclass of B that exposes B's protected members will only solve part of the problem. |
| 19:14 | rhickey_ | what's wrong with proxy-super? |
| 19:15 | Chouser | nothing at all |
| 19:15 | Chouser | other than that it probably should be mentioned in the proxy docstring near "they have no other access...to super" |
| 19:16 | Raynes | People seem to not be able to prevent themselves from writing text editors in Clojure. |
| 19:18 | lisppaste8 | rhickey pasted "new streams" at http://paste.lisp.org/display/76549 |
| 19:20 | keithb | Chouser: Here's a table of Java access levels: http://is.gd/eJYt |
| 19:22 | rhickey_ | streamlined streams ^^, much happier with client code, still safe |
| 19:23 | rhickey_ | still on the fence as far as unification, but will probably add as standalone, good interop with seqs. Just need a naming convention for the 'stream' version of a function |
| 19:24 | rhickey_ | input welcome |
| 19:26 | gnuvince_ | map~, filter~, reduce~: the ~ looks like a little ripple in the water of a stream |
| 19:26 | gnuvince_ | ;) |
| 19:28 | hiredman | ,(let [a~ 1] a~) |
| 19:28 | clojurebot | Unmatched delimiter: ) |
| 19:28 | hiredman | not so much |
| 19:29 | gnuvince_ | oh yeah |
| 19:29 | gnuvince_ | Anyway, it wasn't a very serious suggestion. |
| 19:46 | Chouser | rhickey_: that's a lot prettier. |
| 19:47 | rhickey_ | Chouser: yeah, I moved all the boilerplate into Stream itself, also simpler model |
| 19:48 | lisppaste8 | rhickey annotated #76549 "new streams, some stateful ones" at http://paste.lisp.org/display/76549#1 |
| 19:48 | rhickey_ | model is now just supply fn of item, can process, skip or eos, also considering expand |
| 19:49 | rhickey_ | same single pipeline model, got rid of detach |
| 19:53 | Chouser | ok. I can't say I understand the use cases sufficiently to know when it would have been useful. |
| 19:53 | Chouser | by standalone you mean in a non-core namespace, or something else? |
| 19:58 | rhickey_ | Chouser: I mean separately-named functions vs. changing map et al to streams |
| 19:59 | clojurebot | svn rev 1326; interim checkin, incorporating new stream model |
| 20:00 | rhickey_ | 1326 doesn't have any clj code yet, but the examples in the paste work for those that want to experiment |
| 20:10 | redalastor | Is there a better way to remove a value from a vector than using two subvec? |
| 20:18 | cmvkk_ | hmm, is there a document somewhere about what these streams do and what sort of functionality they provide? |
| 20:19 | Chouser | would you then pour those two subvecs into a another vector? |
| 20:24 | ayrnieu | ,([:a :b :c] 1) |
| 20:24 | clojurebot | :b |
| 20:25 | ayrnieu | oh, you mean the other 'remove'. |
| 20:29 | redalastor | Yeah as Python would do if I pop()ed an item out of a list. |
| 20:30 | ayrnieu | (let [v [:a :b :c]] (vec (map v (filter #(not (= % 1)) (range (count v)))))) ;; best possible solution. |
| 20:30 | redalastor | Is there a reason why dissoc doesn't work on vectors since assoc does? |
| 20:32 | rhickey | redalastor: what would it do? |
| 20:34 | redalastor | rhickey: (dissoc [:a :b :c] 1) would yield [:a :c] |
| 20:34 | rhickey | redalastor: changing the indexes of all the following items? |
| 20:34 | redalastor | Yes |
| 20:35 | rhickey | I don't think so |
| 20:35 | rhickey | dissoc removes a key, not possible with vectors |
| 20:36 | redalastor | I see, makes sense. |
| 20:36 | rhickey | e.g. removing an item still leaves its index, re-indexes the following, that's not diccoc |
| 20:36 | rhickey | disspc |
| 20:36 | rhickey | dissoc |
| 20:36 | rhickey | :) |
| 20:37 | redalastor | I guess there's no "insert" function that pushes the indexes to the right either? |
| 20:38 | rhickey | redalastor: nope, can't be done efficiently, maybe with a data structure like finger trees |
| 20:40 | jhawk28_ | are vectors array based? |
| 20:42 | ayrnieu | http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/ |
| 21:20 | rhickey | cmvkk_: these docs reflect some of the new logic, note not everything is up in svn yet: http://clojure.org/streams |
| 21:21 | cmvkk_ | aha, thanks, that's exactly what i was looking for. |
| 21:24 | cmvkk_ | i'm working on a framework right now that generates PCM data by chaining closures together; i think this sort of thing might really be useful for that. |
| 21:34 | jhawk28_ | does anyone know what an arity is? |
| 21:34 | cmvkk_ | the number of arguments a function takes. |
| 21:58 | keithb | Q: I have a vector of Java objects, and want to call instance methods on them that have side effects. What is the simplest way for me to do this? I know I can use map, but it's lazy and I'd have to force it. |
| 21:58 | cmvkk_ | doseq? |
| 21:59 | keithb | cmvkk_: Ah, thanks. |
| 21:59 | Chouser | cmvkk_: try again, with more confidence this time. |
| 21:59 | hiredman | ~def doseq |
| 22:00 | keithb | Chouser: He probably couldn't believe I didn't know that. ;) |
| 22:00 | cmvkk_ | i hate to sound like an authority on what the simplest way to do something is. |
| 22:01 | keithb | cmvkk_: On the contrary, that's the best kind of authority there is. :) |
| 22:18 | keithb | ~def in-ns |
| 23:28 | blbrown | ,(+ 1 1) |
| 23:28 | clojurebot | 2 |
| 23:28 | Chouser | surprised? |
| 23:29 | Raynes | Surprised? |
| 23:29 | Raynes | (- 1 2) |
| 23:29 | clojurebot | -1 |
| 23:29 | Raynes | That surprised me when I first started in Clojure. |
| 23:29 | Raynes | Funky LISP syntax. |
| 23:29 | Raynes | <3 |
| 23:30 | Chouser | (infix 2 - 1) |
| 23:30 | blbrown | Chouser, hehe, just checking if the bot is alive |
| 23:30 | blbrown | -clojurebot/#clojure actually I was trying to see what this meant |
| 23:30 | Chouser | http://paste.lisp.org/display/75230 -- infix |
| 23:30 | Raynes | ,(infix 2 - 1) |
| 23:30 | clojurebot | java.lang.Exception: Unable to resolve symbol: infix in this context |
| 23:30 | Raynes | That would have felt dirty anyways. |
| 23:32 | blbrown | I guess I should add save to the text editor. hmm |
| 23:33 | dcnstrct | do clojure maps impliment java.util.Map ? anyone know ? |
| 23:33 | Chouser | dcnstrct: they do |
| 23:33 | ayrnieu | ,(ancestors (class {})) |
| 23:33 | clojurebot | #{java.io.Serializable java.lang.Iterable clojure.lang.IObj clojure.lang.Obj clojure.lang.IPersistentCollection clojure.lang.Counted clojure.lang.Seqable java.util.Map clojure.lang.IMeta clojure.lang.AFn java.lang.Runnable clojure.lang.Associative java.util.concurrent.Callable clojure.lang.IPersistentMap clojure.lang.IFn java.lang.Object clojure.lang.APersistentMap} |
| 23:34 | dcnstrct | awesome, thnx |
| 23:34 | Chouser | ,(instance? java.util.Map {}) |
| 23:34 | clojurebot | true |
| 23:35 | Chouser | for almost 5 months now |
| 23:36 | hiredman | ,(pl (partial map inc) $ range $ 3) |
| 23:36 | clojurebot | java.lang.Exception: Remove at top |
| 23:36 | hiredman | damn |
| 23:37 | hiredman | blbrown: that is a NOTICE |
| 23:38 | blbrown | hiredman, did you just implement that |
| 23:38 | blbrown | I guess it is for the svn updtaes |
| 23:38 | hiredman | nope |
| 23:38 | cmvkk | it does it for ~doc responses too. why? |
| 23:38 | hiredman | svn stuff it uses a normal message |
| 23:38 | blbrown | hiredman, I have a plan to out do your bot with my own clojure bot. Just wait till this weekend and we will have bot wars |
| 23:38 | Raynes | How do you pronounce Fibonacci? |
| 23:39 | hiredman | "Fib" |
| 23:39 | Raynes | Smartass. ._. |
| 23:39 | blbrown | FIBBBB--- O - NACHI ? |
| 23:40 | cmvkk | wow, i always thought it had an R in it, like fibronacci. why did I think that? |
| 23:40 | Raynes | I was pronouncing it Fib o' nawssy. |
| 23:41 | hiredman | chee |
| 23:42 | cmvkk | i still want to know why you use notices for ~doc |
| 23:42 | Chouser | the lie of the third reich. fib o' nazi |
| 23:42 | cmvkk | ohhh |
| 23:44 | hiredman | cmvkk: I am willing to entertain arguments that it should be otherwaise |
| 23:45 | cmvkk | unavailable, since i don't really understand the difference between a notice and a message anyway. |
| 23:45 | cmvkk | oh well! |
| 23:45 | hiredman | ~google IRC NOTICE |
| 23:45 | clojurebot | First, out of 256000 results is: |
| 23:45 | blbrown | ~doc |
| 23:45 | clojurebot | A Short IRC Primer |
| 23:45 | clojurebot | http://www.irchelp.org/irchelp/ircprimer.html |
| 23:45 | clojurebot | gitdoc is http://github.com/Lau-of-DK/gitdoc/tree/master |
| 23:52 | sverrej | ~def gen-and-load-class |
| 23:52 | sverrej | gen-and-load-class is removed, or? |
| 23:53 | hiredman | yes |
| 23:53 | sverrej | Expected that, ok. Thanks. |
| 23:54 | sverrej | Still haven't managed to swallow the fact that it's not possible to create new classes dynamically. Like proxy without an interface. |