2009-04-20
| 00:22 | AWizzArd | ~ max people |
| 00:22 | AWizzArd | achso |
| 00:43 | Lau_of_DK | Hard-coding it on every route gets the job done, but it defies the documentation of Ring |
| 01:03 | AWizzArd | Yes, it would be good to be able to give a default header, and if needed, a specific one inside the GET, which overrides the default one. |
| 01:05 | Lau_of_DK | Exactly, but the default seems to be boorked |
| 01:05 | Lau_of_DK | Maybe a Ring/Compojure version mismatch |
| 01:14 | cgray | hi, how do you reload a jar file from the repl? |
| 01:20 | hoeck | cgray: reload the clojure code or the (java) classes inside the jar? For clojure code, a (require 'my-namespace :reload) should do the job. |
| 01:21 | cgray | hoeck: the classes from a different jar file (i.e. not the clojure.jar) |
| 01:23 | cgray | according to google, i need to restart clojure... |
| 01:23 | cgray | brb |
| 01:23 | hoeck | cgray: there are the same limits as to java class reloading, so once loaded, you need to restart the jvm to load the new classes |
| 01:24 | cgray | hi again, sorry, my window manager locked up |
| 01:25 | cgray | i missed the last message i think |
| 01:27 | hoeck | you need to restart clojure, thats right |
| 01:27 | hoeck | this is a jvm limitation |
| 01:28 | cgray | ok, that shouldn't be a big problem |
| 01:28 | hoeck | there is a (commercial) program to allow arbitrary class reloading for the jvm, called javarebel |
| 01:35 | Lau_of_DK | ...or Clojures own stub system |
| 01:35 | eevar2___ | cgray: http://blog.taragana.com/index.php/archive/how-to-unload-java-class/ |
| 02:14 | kadaver | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3978#a3978 <- exiting swing does work properly after i added that |
| 02:14 | kadaver | any obvious error? |
| 02:14 | kadaver | i added the write-to-file stuff |
| 02:14 | kadaver | System/exit 0 worked before |
| 02:16 | Chousuke | does it hang or something? |
| 02:16 | kadaver | yes |
| 02:16 | kadaver | i click X but nothing happens |
| 02:16 | kadaver | doesnt hang |
| 02:16 | Chousuke | hm |
| 02:17 | Chousuke | doesn't that have a misplaced paren? |
| 02:17 | Chousuke | ah, no. |
| 02:17 | Chousuke | my guess is it throws and exception when writing the file |
| 02:18 | Chousuke | and the System/exit never gets called. |
| 02:20 | Chousuke | run in from the console and see what it prints. |
| 02:20 | Chousuke | anyway, I'm off |
| 02:23 | kadaver | yeah |
| 02:23 | kadaver | (defn create-exit [playerstate] |
| 02:23 | kadaver | (proxy [WindowAdapter] [] |
| 02:23 | kadaver | (windowClosing [evt] |
| 02:23 | kadaver | should proxy or windowClosing have more args? |
| 02:23 | kadaver | Wrong number of args passed to: guilogic$create-exit--429$fn--4 |
| 02:30 | kadaver | ah |
| 02:30 | kadaver | i was not derefing(@) |
| 02:30 | kadaver | but |
| 02:30 | kadaver | (reduce #(str %1 "#" %2) "" (@playerstate :playlist)) |
| 02:30 | kadaver | (reduce #(str %1 "#" %2) (@playerstate :playlist)) |
| 02:30 | kadaver | the 2nd works in the repl but not when compiled |
| 02:42 | kadaver | wouldn't (nth n coll) be better? |
| 02:42 | kadaver | i find it more natural to write it that way |
| 02:50 | cgray | it seems like i'm having some trouble. i'm doing (ns foo (:import (bar) (baz))), and trying to evaluate that within a file using slime. but if i evaluate *ns* in the file, it tells me user |
| 02:51 | jdz | i put an (in-ns 'foo) after that |
| 02:51 | jdz | seems to work |
| 02:51 | AWizzArd | Is there something like (def- x 123) vs (def #^{:private true} x 123)? |
| 02:51 | jdz | but should be fixed |
| 02:52 | cgray | jdz: even that is not working |
| 02:53 | jdz | try re-oponing the file |
| 02:53 | jdz | re-opening even |
| 02:54 | cgray | how about that |
| 02:54 | cgray | it works |
| 02:55 | jdz | the (in-ns ...) form should be at column 0. so i put a #_ on the previous line. that's because the (ns ...) form automatically switches to the declared ns |
| 02:55 | jdz | somebody not-lazy should go and fix clojure mode :/ |
| 02:58 | AWizzArd | Yes, there were no updates for the clojure-mode and swank-clojure anymore now... |
| 02:59 | jdz | huh? i got updates today even |
| 02:59 | jdz | to swank-clojure |
| 02:59 | jdz | it uses pprint now |
| 03:01 | jdz | damn, looks like slime-edit-definition is broken now... |
| 03:03 | AWizzArd | ah oki, so clojure-mode was without updates |
| 03:08 | Raynes | Oracle bought Sun. |
| 03:08 | Raynes | http://in.sys-con.com/node/925931 |
| 03:09 | rsynnott | pretending to buy Sun is a traditional activity of large IT companies going through difficult times |
| 03:09 | rsynnott | I'll believe it when I see it |
| 03:09 | tWip | sun.com has the news also |
| 03:10 | jdz | the in.sys-con.com has ads with sound! |
| 03:10 | jdz | ffs |
| 03:10 | jdz | it's year 2009 |
| 03:16 | Raynes | rsynnott: http://www.sun.com/aboutsun/pr/2009-04/sunflash.20090420.1.xml |
| 03:16 | Raynes | You've seen it. |
| 03:16 | Raynes | Might want to believe it now. |
| 03:20 | rsynnott | heh |
| 03:28 | rsynnott | poor sparc :( |
| 03:35 | AWizzArd | Maybe Oracle has better arguments to sell those sparcs. |
| 03:37 | rsynnott | There is a lot of talk of Java and Solaris on the press release, I note |
| 03:37 | rsynnott | not so much of poor Sparc |
| 03:37 | rsynnott | (or MySQL, but Oracle already owned the interesting bits of that) |
| 04:04 | AWizzArd | To ask the Oracle about the future of Java now gets a whole new meaning... |
| 04:05 | rsynnott | well, they're unlikely to kill it |
| 04:06 | rsynnott | (not that they could; IBM is surely at least a big driving force behind modern Java as Sun is) |
| 04:06 | bstephenson | I wonder about (fear for?) the future of Sun's open-source apps like Glassfish, OpenOffice and NetBeans, much less MySQL. |
| 04:07 | rsynnott | Oracle have owned InnoDB since 2005 anyway |
| 04:07 | rsynnott | and they license BDB in much the same way as MySQL is licensed by MySQL AB and Sun |
| 04:07 | rsynnott | so it'll probably be fine |
| 04:25 | AWizzArd | Maybe upcoming JDKs will cost a nice license fee. |
| 04:31 | Raynes | I'll blow my head off and have the remains sent to Oracles doorstep. |
| 04:31 | Raynes | :| |
| 04:31 | tWip | a bit drastic |
| 04:35 | Raynes | "Guess I'd better start learning PostGreSql and F#/Mono instead of Clojure." Now that is a bit drastic. |
| 04:36 | bstephenson | I agree about OpenOffice, more a comment on philosophy than the specific product. I (or really the company I worked for) have been the victim of Oracle's CRAZY seat licensing in the past, so I always view Oracle with a somewhat jaundiced eye. |
| 04:38 | p_l | I had seen Oracle downplay a *big*, *important* company bugreports about Oracle server getting OOM-killed. We had highest support levels |
| 04:39 | cp2 | whats going on? |
| 04:39 | cp2 | oracle bought sun/java/??? ? |
| 04:39 | p_l | cp2: yup |
| 04:39 | p_l | ~$9.60/share |
| 04:39 | cp2 | lol |
| 04:40 | cp2 | damn |
| 04:40 | cp2 | this is what happens |
| 04:40 | cp2 | when you sleep |
| 04:40 | cp2 | miss out on interesting news |
| 04:40 | p_l | god bless them for opensourcing Solaris and lot of other stuff |
| 04:41 | Raynes | MySQL is dead. Long live MySQL! |
| 04:41 | p_l | Raynes: that's the good part of those news :P |
| 04:41 | Raynes | :p |
| 04:42 | Raynes | I hope people don't freak and drop Clojure and run for the hills. |
| 04:42 | jdz | what's SUN's market ticker (or whatever it is called)? |
| 04:42 | rsynnott | JAVA |
| 04:42 | rsynnott | (when it was IBM buying them, I vaguely thought it was because they wanted the ticker) |
| 04:43 | rsynnott | when it was Apple buying them (this happened about six times) I just assumed lack-of-Jobs-induced-insanity |
| 04:44 | dnolen | is there a function to convert a String to an InputStream in Clojure? |
| 04:45 | jdz | some class having StringReader in it? |
| 04:46 | gnuvince | Does anyone know a free tool to make *nice* looking charts and plots? |
| 04:46 | jdz | google charts? |
| 04:46 | gnuvince | Emphasis on the *nice*; I need it for a one-off graph, and it'd be nice if it was a beautiful one. |
| 04:47 | jdz | google charts looked very nice last time i saw them |
| 04:47 | rsynnott | google's ones are quite nice |
| 04:47 | jdz | and don't all presentation apps allow one to create charts? |
| 04:47 | stuhood | dnolen: i would use String.getBytes() into a ByteArrayInputStream |
| 04:47 | rsynnott | but careful! Confusingly they have two chart apis, which are completely different |
| 04:48 | gnuvince | jdz: oh, I didn't think about PowerPoint |
| 04:48 | rsynnott | (one is highly AJAXy, and thus confined to Gooogle Labs) |
| 04:48 | jdz | well, i had Keynote in mind :) |
| 04:48 | jdz | while speaking of *nice* |
| 04:49 | AWizzArd | The install path for Java 7 will be /u02/app23/sys/ucb/myjdkoraql/1002.12.3.45.2.2.3/vm_42/{bin,lib,etc,mesg,crs}. The machine will have Load 27 during a Thread/sleep. For finetuning pay 400$ per hour for consultants :) |
| 04:49 | dnolen | stuhood: thx |
| 04:49 | jdz | Numbers also can make a nice looking charts. too bad the app cannot be used to calculate stuff |
| 04:49 | rsynnott | in fairness, sun is quite keen on terrible, terrible paths, itself |
| 04:51 | noidi | gnuvince, if you know python, then matplotlib is nice http://matplotlib.sourceforge.net/ |
| 04:56 | gnuvince | noidi: I could try that as well... I need the first quadrant of a f(x) = 1/x curve and I want to tag some points (although I can do that with Photoshop if I need to) |
| 04:57 | jdz | the matplotlib actually looks very nice for exactly this purpose |
| 04:57 | jdz | an example: http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html |
| 04:57 | gnuvince | Very, very nice |
| 04:58 | gnuvince | I think we have a winner |
| 04:58 | cp2 | oracle did a union query while the sun execs weren't looking |
| 04:58 | cp2 | now they can't split without compromising DB integrity |
| 04:58 | cp2 | hah |
| 05:08 | stuhood | its a good thing sun already open sourced java |
| 05:11 | cp2 | indeed |
| 05:11 | cp2 | even if oracle does close it up, people will just fork |
| 05:11 | cp2 | no worries |
| 06:02 | danlarkin | so Oracle buys Sun eh? |
| 06:05 | danlarkin | I wonder what that means for mysql |
| 06:05 | Raynes | "MySQL is dead. Long live MySQL!" |
| 06:09 | Raynes | for(n <- 1 to 1000 if n % 3 == 0) yield n |
| 06:09 | Raynes | Oops, wrong window. :> |
| 06:11 | cgray | does anyone have experience creating a SecurityManager that prevents a library from killing clojure with a call to System.exit() ? |
| 06:16 | cemerick | cgray: clojurebot does this. I think hiredman might have blogged about the details at some point? |
| 06:16 | hiredman | me? I don't blog |
| 06:16 | stuhood | cgray: prolly in here somewheres: http://github.com/hiredman/clojurebot/blob/3cf335c748045fbce0aa92c82289a8df5a81063d/hiredman/sandbox.clj |
| 06:16 | cgray | thanks |
| 06:17 | cemerick | hiredman: hrm. Then someone else is blogging about clojurebot somewhere :-) |
| 06:18 | hiredman | everything I know about jvm sandboxing I cribbed from http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html |
| 06:20 | cgray | aha, thanks. i was just going to complain that the policy is too strict, but i see that you can change that with a .java.policy file |
| 07:21 | hiredman | http://code.google.com/p/clojure-contrib/wiki/DatalogOverview incase anyone hasn't seen it yet |
| 07:24 | replaca | that should set the standard for how we documentt our stuff! |
| 07:25 | replaca | Jeffery set a great example there |
| 07:26 | cp2 | looks pretty neat hiredman |
| 07:29 | danlarkin | makes me want to play with datalog :) |
| 07:36 | mattrepl | hiredman: neat! |
| 07:38 | peregrine81 | Hello everyone. My goal is to learn lisp, using clojure. What is the best place to start |
| 07:38 | peregrine81 | ?* |
| 07:39 | technomancy | peregrine81: the Clojure book from pragprog.com is quite good. |
| 07:39 | technomancy | also: in a couple days my clojure introduction screencast will be available from peepcode.com |
| 07:39 | technomancy | but I'll understand if you don't want to wait for it. =) |
| 07:40 | peregrine81 | anything freely available? |
| 07:40 | technomancy | there's the wiki, but it's kind of messy. |
| 07:40 | technomancy | the book is definitely worth it; I think it's only around $20 if you get just the PDF. |
| 07:41 | danlarkin | hey technomancy, want to see my progress on an http library so far? |
| 07:41 | technomancy | danlarkin: yeah; let's see it |
| 07:41 | peregrine81 | Alright, would it be possible to easily follow along with PCL with clojure? |
| 07:41 | technomancy | peregrine81: there's some blog posts that port portions of it over |
| 07:42 | technomancy | peregrine81: but the original book will only be marginally helpful |
| 07:42 | dliebke | peregrine81: I like Mark Volkman's introduction: http://java.ociweb.com/mark/clojure/article.html |
| 07:43 | Raynes | peregrine81: http://ociweb.com/jnb/jnbMar2009.html is a good starting point, but you're going to want the book eventually. |
| 07:43 | danlarkin | technomancy: ok I'll gist it... it's not done... I'm not positive I like the way I'm doing it yet... I think I made it too high level and it's missing some features, but it's almost there |
| 07:43 | Raynes | dliebke: Great minds think alike. :) |
| 07:43 | dliebke | :) |
| 07:43 | zakwilson | peregrine81: do you know Java already? |
| 07:43 | peregrine81 | Cool |
| 07:43 | hiredman | peregrine81: search for CS61A on youtube, it's berkeley's version of structure and interpretation of computer programs |
| 07:43 | peregrine81 | zakwilson: Yes :) |
| 07:44 | peregrine81 | Unfortunately |
| 07:44 | danlarkin | technomancy: http://gist.github.com/98612 |
| 07:44 | technomancy | danlarkin: do you have any tests for it yet? |
| 07:44 | zakwilson | Good - it helps with actually getting stuff done in Clojure because it's easier to read the documentation for various libraries. |
| 07:44 | danlarkin | technomancy: no :-o *gasp* |
| 07:45 | technomancy | danlarkin: I was wondering how you'd go about that; is there any way to serve HTTP from just the stock JDK? |
| 07:45 | zakwilson | Is it possible to stick a native executable inside an executable jar and call it from your code? |
| 07:45 | cp2 | Runtime.exec |
| 07:46 | cp2 | but thats messy |
| 07:46 | cp2 | and discouraged |
| 07:46 | danlarkin | technomancy: oh... mmm... easily? I'm not sure, but you can always call something like example.com |
| 07:46 | technomancy | danlarkin: yeah, but having tests that don't work when the network is down is not so hot |
| 07:46 | technomancy | danlarkin: plus you'd need the response to vary based on headers etc. |
| 07:47 | Lau_of_DK | technomancy: "the book from pragprog" , is that Stuarts book ? |
| 07:47 | technomancy | Lau_of_DK: yeah |
| 07:47 | technomancy | danlarkin: it'd be a shame to make the test suite require (for instance) having jetty on the classpath, but that's better than nothing |
| 07:47 | technomancy | hmmm |
| 07:47 | technomancy | anyway this looks good |
| 07:47 | Lau_of_DK | I'd be careful giving such pricey advice to new-comers, as the first option |
| 07:47 | Lau_of_DK | Most people here have learnt Clojure, through the free resources scattered across the web |
| 07:48 | technomancy | Lau_of_DK: well my $9 peepcode isn't out yet. =) |
| 07:48 | technomancy | I guess it depends on how interested you are. =) |
| 07:48 | Lau_of_DK | And the signal we want to send |
| 07:49 | Lau_of_DK | Its your call, but it stuck out :) |
| 07:49 | cp2 | technomancy: torrent now, pay later? :) |
| 07:49 | technomancy | peregrine81: the "Clojure for (Java|Lisp) programmers" presentations are very good too. They won't teach you the practical aspects of clojure, but they'll show you the philosophy and motivation. |
| 07:51 | hiredman | I was looking at berkeley's cs61a videos on youtube, and they seem a very gentle intro to lisp |
| 07:51 | hiredman | using scheme |
| 07:53 | hiredman | cs61a (the java course) is the most boring thing ever btw |
| 08:36 | unlink | Is there any way of annotating a string with metadata? |
| 08:36 | technomancy | values don't have metadata, vars do |
| 08:37 | unlink | ok |
| 08:38 | stuhood | so you could add the metadata to a def statement for a var containing the string, I think |
| 08:38 | rhickey | technomancy: no - map/set/vector/symbol values can have metadata, just not string/numbers etc |
| 08:38 | hiredman | :( |
| 08:39 | technomancy | ah, gotcha. so it's just that the built-in types aren't extensible. |
| 08:39 | unlink | so why does this evaluate to nil? (meta (let [x "hi"] #^:a x)) |
| 08:41 | taggart | ,(let [x "hi"] #^:a x) |
| 08:41 | stuhood | because you are trying to attach the metadata directly to the string: isn't a 'var' in that case, its a local, right? |
| 08:42 | unlink | So it's impossible to return metadata-annotated strings from a function? |
| 08:42 | hiredman | yes |
| 08:43 | hiredman | strings are java.lang.String |
| 08:43 | hiredman | which is a final class |
| 08:43 | hiredman | so not extensible |
| 08:43 | unlink | ok. I was trying to mark strings as "escaped" or "not-to-be-escaped" |
| 08:43 | technomancy | even if it were subclassable, having a clojure-specific string type floating around and having to figure out which is which would be pretty confusing |
| 08:44 | technomancy | for java interop work at least |
| 08:44 | taggart | it would make interop a nightmare |
| 08:45 | stuhood | especially since java.lang.String is final |
| 08:45 | technomancy | I can understand the motivation for not allowing classes to be modified after they're defined, but I can't imagine a good reason for keeping people from subclassing classes. |
| 08:45 | technomancy | is there one? or is it just one of Those Crazy Java things? |
| 08:45 | taggart | security iirc |
| 08:45 | hiredman | voodoo |
| 08:46 | unlink | OK, so what would be the idiomatic way of achieving this? pass around an application-defined datastructure which has a string and escape status? |
| 08:46 | taggart | maybe oracle will fix it for you ;) |
| 08:47 | technomancy | unlink: you sure you can't just escape it immediately upon receiving it from whatever source? then you'd never have to deal with unescaped strings. |
| 08:47 | unlink | I'm writing a library. I'd like to provide a "secure-by-default" option. |
| 08:48 | unlink | Unfortunately it's unidiomatic in virtually every programming language. |
| 08:50 | unlink | It's even awkward in Python, which is not exactly famous for its rigid type system. |
| 08:51 | stuhood | unlink: yea, i think you'll need a wrapper around the string |
| 08:52 | taggart | if symbols support metadata, then why doesn't the following work? |
| 08:52 | taggart | (def #^{:a "test"} mystr "hi") |
| 08:52 | hiredman | the CharSequence final? |
| 08:53 | hiredman | unlink: you could use CharSequence instead of Strings |
| 08:53 | hiredman | http://java.sun.com/j2se/1.5.0/docs/api/java/lang/CharSequence.html |
| 08:53 | hiredman | proxy that and add metadata support |
| 08:54 | stuhood | hiredman: or perhaps StringBuffer/Builder, since CharSequence is an interface |
| 08:54 | hiredman | I think there is a String constructor that takes a CharSequence so the conversion would be easy |
| 08:54 | stuhood | ack, both are final... |
| 08:54 | hiredman | stuhood: but Buffer and Builder are mutable :( |
| 08:55 | hiredman | yeah, better stick with CharSequence |
| 08:55 | hiredman | ugh |
| 08:55 | unlink | Clojure's greatest strength is also its greatest weakness! |
| 08:55 | hiredman | I hate this, I want clojurebot and I want my server online so I have a clojure repl and vim and etc |
| 08:56 | stuhood | /mourn clojurebot |
| 08:57 | unlink | What happened to it? Server melted? |
| 08:58 | hiredman | (defn make-char-sequence [string] |
| 08:58 | hiredman | (proxy [java.lang.CharSequence] |
| 08:58 | hiredman | (charAt [i] (.charAt string i)) |
| 08:58 | hiredman | (length [] (.length string)))) |
| 08:58 | hiredman | etc |
| 08:58 | hiredman | actually adding metadata support is an exercise for the reader |
| 08:58 | hiredman | unlink: reports are sketchy |
| 08:59 | hiredman | the server already had a hard drive die over christmas |
| 09:00 | hiredman | the machine right next to it (I presume, I haven't actually been to the physical location in a few years) as an uptime pushing 320 days |
| 09:02 | scottj | I'm trying to get a collection of all the numerical values in an html table with the condition that they have decimal places and there are 28 cells that match that condition. my regex is matching a section larger than one table and re-seq only gives the values in the last cell and I wonder if the problem is something obvious. The re looks like #"\<table.+?(\<td.*?\>(\d+\.\d+)\</td\>.*?){28}.*?\</table\>" |
| 09:05 | rhickey | unlink: you definitely don't want to derive from String even if you could - there's no way to control the provenance of every string in a system, and you'd be checking if this was a String or a MyString everywhere, doing lots of conversions etc - ad hoc concrete derivation is bad |
| 09:07 | unlink | rhickey: There would essentially be a single consumer of these objects, a function which prepares an HTTP response, and it would be the only method which cares whether it's a String or MyString. |
| 09:07 | rhickey | unlink: then just use a map {:escaped true :val "foo"} |
| 09:08 | unlink | What I meant is, everything in between would want to see something String-y, not caring whether it's a String or MyString. |
| 09:09 | hiredman | unlink: if you use something that implements CharSequence and IMeta (I think it's IMeta) you get something that is basically a String, but with metadata |
| 09:09 | rhickey | what hiredman said |
| 09:10 | hiredman | ideally most things would not specify String but CharSequence in their interface |
| 09:10 | hiredman | but somehow I doubt that is case |
| 09:10 | unlink | ok. |
| 09:10 | unlink | Good to know. |
| 09:10 | rhickey | hiredman: unfortunately that's not true of some of Clojure - could you enter an issue for it please - use CharSequence when possible? |
| 09:11 | hiredman | uh |
| 09:11 | hiredman | ok |
| 09:11 | stuhood | soo, ((partial + 1 2)) returns 3, but ((partial constantly true)) returns a function... hmm |
| 09:11 | hiredman | my first issue! |
| 09:11 | unlink | How does unicode work in clojure? |
| 09:12 | rhickey | unlink: same as Java |
| 09:14 | unlink | How do I get bytes? |
| 09:14 | hiredman | unlink: String has .getBytes |
| 09:14 | hiredman | which returns an array of bytes |
| 09:14 | stuhood | (.getBytes "blah") |
| 09:15 | taggart | more of that at the interop page: http://clojure.org/java_interop |
| 09:15 | unlink | whoops, I broke my clojure |
| 09:15 | hiredman | and the String javadoc |
| 09:16 | unlink | http://dpaste.com/35980/ |
| 09:16 | Chousuke | stuhood: isn't that what it's supposed to do. (constantly true) returns a function |
| 09:17 | hiredman | unlink: I would try again |
| 09:17 | unlink | I'm starting clojure via rlwrap --remember -c -b "(){}[],^%$#@\"\";:''|\\" java -cp clojure.jar:clojure-contrib.jar:. clojure.lang.Repl |
| 09:17 | hiredman | unlink: is it repeatable? |
| 09:17 | taggart | Chousuke: I think his point was that (partial + 1 2) should also return a function |
| 09:17 | Chousuke | taggart: it |
| 09:17 | Chousuke | er |
| 09:17 | taggart | oh, nvm, missed the double parns |
| 09:17 | Chousuke | it does |
| 09:18 | unlink | I can't repeat it. |
| 09:18 | hiredman | ghosts in the machine |
| 09:19 | hiredman | evidence of the underlying procedural nature of the machine |
| 09:19 | unlink | haha |
| 09:19 | albino | I hope that's ghosts in the jvm and not ghosts in the physical cpu |
| 09:19 | unlink | That works in #haskell. |
| 09:21 | unlink | I love the comically long stack traces produced by compojre. |
| 09:21 | hiredman | breaking news: I have been informed that the latest theory put forth by the man charged with bringing the machine that runs clojurebot back online is: bad ram |
| 09:24 | unlink | Ah, as it turns out, clojure requires RAM to operate. |
| 09:27 | stuhood | Chousuke, taggart: one executes the returned function, and the other doesn't... that is the weird part |
| 09:28 | Chousuke | stuhood: it does execute it. |
| 09:28 | Chousuke | stuhood: it's just that in the latter case it runs a function that returns a function |
| 09:28 | Chousuke | while in the former it runs a function that returns an integer. |
| 09:28 | taggart | stuhood: a successful invocation of + returns a number, a successful invocation of constantly is a function |
| 09:29 | stuhood | agh... indeed |
| 09:30 | unlink | How low-level is the bytecode generated by clojure? |
| 09:30 | Chousuke | low-level? |
| 09:30 | Chousuke | it's JVM bytecode. |
| 09:30 | unlink | It does emit JVM bytecode, correct? |
| 09:31 | technomancy | is there a nicer way to browse the JDK documentation than just googling for javadoc? |
| 09:32 | unlink | :W |
| 09:32 | taggart | http://java.sun.com/javase/6/docs/api/ ? |
| 09:32 | unlink | ... |
| 09:33 | technomancy | package |
| 09:34 | technomancy | oh are you kidding me? it makes you download it manually. |
| 09:35 | dliebke | I also like to use clojure.contrib.repl-utils/javadoc |
| 09:36 | unlink | lol @technomancy |
| 09:36 | unlink | I ran into that last night. |
| 09:37 | technomancy | dliebke: that works. Wonder if it could be adapted to a local copy of the documentation. |
| 09:38 | dliebke | good question, I haven't looked at the source |
| 09:38 | technomancy | unlink: it makes the debian DFSG problems look like nothing. |
| 09:39 | unlink | I'm sure all these problems will change with the new management. |
| 09:40 | unlink | Don't forget to chown root:root. |
| 09:41 | technomancy | unlink: hah. no. |
| 09:42 | technomancy | if I'm going to download it manually, why would I use the package manager? |
| 09:42 | unlink | To unpack it in the correct directory, of course. |
| 09:42 | unlink | And don't forget the debian changelog. |
| 09:43 | technomancy | good stuff |
| 10:15 | HAppyKAmikaze | say i'm totally new to this language, where i can find good documentation apart from clojure.org? |
| 10:16 | gnuvince | HAppyKAmikaze: there's a book: http://www.pragprog.com/titles/shcloj/programming-clojure |
| 10:16 | hiredman | HAppyKAmikaze: prior lisp experience? |
| 10:16 | HAppyKAmikaze | is still a beta book |
| 10:16 | hiredman | prior java? |
| 10:16 | HAppyKAmikaze | isn't it? |
| 10:16 | arohner_ | HAppyKAmikaze: it's still a beta language :-) |
| 10:16 | HAppyKAmikaze | say java |
| 10:16 | hiredman | it is like | | close to publishing |
| 10:16 | gnuvince | HAppyKAmikaze: yes, but it's practically done, and it's been useful for a long time. |
| 10:16 | Raynes | HAppyKAmikaze: The book is complete, just maybe a few typos. And a little content could be added before now and when it's published. |
| 10:16 | Raynes | Well, before it's printed. |
| 10:16 | hiredman | HAppyKAmikaze: there is a blip.tv into video "clojure for java programers" |
| 10:16 | Raynes | It's already published. |
| 10:17 | HAppyKAmikaze | say ok book and tv! thanks |
| 10:17 | hiredman | all the docs on the api webpage are availble from the repl using the doc command |
| 10:17 | Raynes | ,(doc println) |
| 10:18 | hiredman | all the javadocs on the internet have some relevence |
| 10:22 | Raynes | Where is clojurebot. :( |
| 10:23 | hiredman | http://delicious.com/clojurebot has some urls to might be useful for clojure |
| 10:23 | hiredman | Raynes: current theory is bad ram |
| 10:55 | technomancy | has anyone used any of the javadoc Emacs mode? |
| 10:55 | technomancy | *modes |
| 11:01 | technomancy | looks like javadoc-help does the trick; it's just got a not-so-hot interface |
| 16:44 | unlink | How is "\a\b\c" read? |
| 16:44 | Chouser | as an error |
| 16:45 | Chouser | java.lang.Exception: Unsupported escape character: \a |
| 16:45 | unlink | The quotes were intended to delineate the input |
| 16:45 | Chouser | oh |
| 16:45 | Chouser | three literal Characters |
| 16:45 | kotarak | As three chacters: a b and c. |
| 16:46 | unlink | What is the type of "three characters"? |
| 16:46 | kotarak | ,(class \a) |
| 16:46 | kotarak | Hmm.. no bot.. |
| 16:46 | Chouser | (nth [\a\b\c] 1) --> \b |
| 16:46 | dliebke | java.lang.Character |
| 16:46 | unlink | Oh, I got it |
| 16:46 | kotarak | 1:1 user=> (class \a) |
| 16:46 | kotarak | java.lang.Character |
| 16:47 | unlink | I didn't realize that you could just throw a bunch of whitespace-separated values at the repl |
| 16:47 | stuhood | and apparently non-whitespace separated in this case |
| 16:47 | unlink | right |
| 16:47 | unlink | but I guess that's just the imperative construct in clojure |
| 16:47 | stuhood | er, non-separated |
| 16:49 | Chouser | stuhood: hah |
| 16:56 | zakwilson | If I want to find out if an executable is in my path from Clojure (the equivilent of running 'which foo' in a shell), is there an easy way to do that? |
| 16:56 | arohner_ | the path is a construct created by the shell |
| 16:57 | cemerick | Runtime.exec("which foo")? :-P |
| 16:57 | arohner_ | zakwilson: I'm not aware of a good clojure wrapper yet, but it sounds like it would be useful |
| 16:58 | cemerick | I'll bet there's a handy OS-process lib that will do that, maybe in apache-land. |
| 16:58 | zakwilson | cemerick: can't count on which being available. |
| 16:58 | cemerick | zakwilson: thus the :-P ;-) |
| 16:58 | zakwilson | I'll just do it by hand for now. This doesn't need to be production quality code. |
| 17:00 | cemerick | zakwilson: there's http://commons.apache.org/exec/ -- never even downloaded it, but it's ripped from ant, so that's something. |
| 17:11 | arohner_ | anyone know what this means? |
| 17:11 | arohner_ | Clojure |
| 17:11 | arohner_ | java.lang.NoSuchMethodError: clojure.lang.MultiFn.<init>(Lclojure/lang/IFn;Ljava/lang/Object;Lclojure/lang/IRef;)V (start.clj:0) |
| 17:11 | arohner_ | user=> |
| 17:15 | kotarak | arohner_: make sure you do an "ant clean" in your Clojure and/or contrib build. |
| 17:15 | kotarak | some AOT compiled code wants to call the MultiFn constructor replace some revisions ago. |
| 17:18 | arohner_ | kotarak: thanks |
| 17:25 | arohner_ | ah, compojure was a culprit as well |
| 17:26 | arohner_ | that was trickier because it wanted a copy of clojure.jar in compojure/deps |
| 17:26 | unlink | It doesn't seem that compojure works too well with clojure-svn |
| 17:40 | unlink | Where can I read "A Friendly Introduction To Lisp Macros, Clojure Edition"? |
| 17:47 | technomancy | there's a macros chapter in the book, isn't there? |
| 17:49 | unlink | Oh, there's a book? |
| 17:49 | kotarak | "Programming Clojure" |
| 17:50 | unlink | Oh, that kind of book. |
| 17:50 | technomancy | The Book |
| 17:50 | technomancy | is that better? =) |
| 17:51 | unlink | Is it worth it? Will I save more than half an hour by reading the book versus figuring it out the long way? |
| 17:52 | technomancy | depends on what you're trying to do |
| 17:52 | alvivi | If you're a programming guru, of course yes ;) |
| 17:52 | technomancy | but in the long run the answer is yes. |
| 17:52 | unlink | Books were unhelpful in mastering Python. |
| 17:53 | unlink | But Python is better documented than Clojure. |
| 17:53 | technomancy | you might not need the book if you already know a significant amount of CL or Scheme, but I still found it helpful. |
| 17:53 | technomancy | macros are a really tricky topic, too |
| 17:53 | unlink | Oh no, now I want Programming Scala and Programming Groovy. |
| 17:54 | technomancy | buying books is dangerous |
| 17:54 | unlink | I should probably limit myself to one new JVM language after the events of this morning. |
| 17:54 | unlink | But...the Java libraries...they call... |
| 17:55 | technomancy | one language per year is a good baseline |
| 17:55 | unlink | Well I haven't learned a new language since 2007. |
| 17:55 | unlink | Wait, I learned a new on this yera. |
| 17:55 | unlink | If you can call PHP a language. |
| 17:56 | unlink | Don't worry, we ended up rewriting the project in Django. |
| 17:57 | unlink | All right, you guys better be right about this book, I'm plunging $21 into it :-) |
| 17:57 | unlink | Is one of you the author? >_> |
| 17:57 | technomancy | he's online sometimes, but not right now |
| 17:59 | unlink | OK. |
| 18:01 | unlink | Hmm, is EPL standard practice in Clojure-land? |
| 18:02 | kotarak | Mostly, I use mostly MIT, I think I saw also GPL somewhere, but EPL seems very widespread. |
| 18:02 | unlink | OK, people aren't going to shun me if I MIT then |
| 18:05 | unlink | I like it when people bill me and deny me access to the product I paid for. What am I talking about, I *love* when that happens. |
| 18:06 | sohail | unlink, which product? |
| 18:06 | sohail | are you supposed to get a license in the mail? |
| 18:06 | sohail | email that is |
| 18:06 | unlink | Programming Clojure |
| 18:07 | sohail | ah |
| 18:07 | sohail | dunno how they do that one |
| 18:07 | unlink | Very crafty of them. |
| 18:07 | sohail | I make sure that my licenses get sent out immediately and email them manually when I get a chance to make sure they have it |
| 18:07 | sohail | s/immediately/automatically/ |
| 18:08 | unlink | You must log in as the owner to download that file. |
| 18:08 | technomancy | trying to fetch it with wget or something? |
| 18:10 | unlink | no |
| 18:10 | unlink | I'm trying to do /exactly what the email instructions tell me to do/ |
| 18:10 | unlink | OK, my transaction costs have already totaled 10 minutes of effing around with this. I'm not happy. |
| 18:12 | unlink | a HA! |
| 18:12 | unlink | They associated my order with paypal email address, not with the one I used to register with the site. |
| 18:12 | unlink | Of course, why didn't I think of that. |
| 19:44 | technomancy | cgrand-rec: hey, I'm trying out the new enlive code |
| 19:44 | technomancy | I'm wondering if it's worth renaming "empty" so it doesn't conflict with clojure core |
| 20:33 | kadaver | http://code.google.com/p/clojure-contrib/wiki/DatalogOverview who made it? |
| 20:33 | kadaver | cool stuff |
| 21:34 | eee | hello |
| 21:34 | eee | i was looking at the cookbook |
| 21:35 | eee | but lost on a simple thing |
| 21:35 | eee | sort of rusty |
| 21:35 | eee | i made a set: (def a (sorted-set)) |
| 21:35 | eee | and now I want to loop, redefining set |
| 21:36 | eee | one item at a time |
| 21:36 | eee | inserting into the set |
| 21:36 | eee | i tried this |
| 21:36 | eee | (dotimes [q 40] (def a (conj a 2))) |
| 21:36 | eee | i am sure that's a hack |
| 21:37 | eee | ultimately I will time it |
| 21:38 | dnolen_ | eee: data structures in clojure are immutable, you're just redefining a 40 times |
| 21:38 | eee | yup |
| 21:38 | eee | i want to see how long it takes to do inserts |
| 21:38 | eee | to compare to my own immutable datastructure |
| 21:38 | eee | oh, you mean a doesn't |
| 21:38 | eee | accumulate |
| 21:39 | eee | even though I redefine it |
| 21:39 | eee | based on old value |
| 21:39 | eee | so I have to loop recur |
| 21:39 | dnolen_ | have you created you're own sorted set java class? |
| 21:39 | eee | odd that it doesn't take on the new value each time through the dotimes |
| 21:40 | eee | I have a different datastructure that I will time next |
| 21:40 | eee | but for now trying with sorted set |
| 21:40 | dnolen_ | eee: because a is immutable, nothing takes a new value in clojure without using one of the mutation constructs. |
| 21:40 | eee | from clojure |
| 21:40 | eee | ok |
| 21:40 | eee | so I'll rewrite with loop-recur |
| 21:40 | eee | is conj the right way to add to a set? |
| 21:41 | eee | i didn't find insert, add, or append |
| 21:44 | dnolen_ | conj works yes. |
| 21:45 | dnolen_ | ,(+ 1 2) |
| 21:45 | dnolen_ | hmm no clojurebot. |
| 21:46 | eee | oh, I know why now |
| 21:46 | eee | my orig question |
| 21:46 | eee | because a set |
| 21:46 | eee | uniquifies |
| 21:46 | dnolen_ | yup |
| 21:46 | eee | any object like a sorted vector? |
| 21:48 | eee | yes |
| 21:48 | eee | (def a (vector)) (dotimes [q 40] (def a (conj a 2))) |
| 21:48 | eee | that works like I'd think |
| 21:48 | eee | was the dedup |
| 21:48 | eee | so I need to replace 2 with a rand |
| 21:50 | dnolen_ | eee: so what exactly are trying to accomplish again? |
| 21:50 | eee | i made a new thing for clojure |
| 21:50 | eee | and someone suggested |
| 21:50 | eee | that I profile it |
| 21:50 | eee | against sorted set |
| 21:50 | eee | so I will |
| 21:50 | eee | already one diff |
| 21:50 | eee | mine needn't be unique |
| 21:51 | eee | but also |
| 21:51 | eee | my sort is semi-lazy |
| 21:51 | eee | and does other things |
| 22:14 | eee | anyone here use clojure-dev? |
| 22:14 | eee | eclipse |
| 22:15 | eee | repl isn't starting, at any rate |
| 22:19 | eee | worked around it |
| 22:47 | eee | wow. looks like I'm trumping sorted-set right now |
| 22:47 | eee | exciting |
| 22:47 | eee | purely functional too |
| 22:48 | eee | probably my bad clojure |
| 22:48 | eee | what would be the best way to pop things off the front of a sorted set one by one, returning a new sorted set? |
| 22:49 | eee | i'm just calling (rest) |
| 22:49 | Cark | that's how i would do it |
| 22:49 | Cark | but then you get a lazy seq i guess |
| 22:49 | Cark | that's not a sorted set anymore |
| 22:50 | eee | (time (def aa (loop [ret a] (if ret (recur (rest a)) ret)))) |
| 22:50 | eee | that look fair? |
| 22:50 | eee | against my heap: |
| 22:50 | eee | (time (def bb (loop [ret b] (if (not (.isEmpty ret)) (recur (.deleteMin ret)) ret)))) |
| 22:51 | Cark | hum what if you have a nil value in your set ? |
| 22:51 | eee | see here's what's bogus. for that "rest" one, it took like five minutes real time |
| 22:51 | eee | i only have random values for this test |
| 22:51 | eee | ints |
| 22:52 | eee | good thing to note though |
| 22:52 | eee | thanks |
| 22:52 | Cark | right but you shoudl do this instead |
| 22:52 | eee | but why does it report 10 seconds even though I waited ten minutes |
| 22:52 | Cark | err wait what do you want to achieve anyways ? |
| 22:52 | eee | mine actually took the 5 seconds |
| 22:52 | eee | ok |
| 22:52 | eee | I wrote a heap |
| 22:53 | eee | and someone suggested |
| 22:53 | eee | compare it to sorted set |
| 22:53 | eee | you know I wrote a priority queue |
| 22:53 | eee | purely functional |
| 22:53 | eee | persistent |
| 22:53 | Cark | right |
| 22:53 | eee | like Rich would like |
| 22:53 | eee | (time (def b (loop [ret (new PersistentHeap) i 0] (if (< i 2000000) (recur (.insert ret (rand-int 100000)) (+ i 1)) ret)))) |
| 22:53 | Cark | hum if you have that implementation already, why don't you make an iseq out of it and use it directly from clojure ? |
| 22:54 | eee | where is that edit window |
| 22:54 | eee | well, before jumping the gun on that, I wanted to test against something already there |
| 22:54 | eee | to make sure not wasting my time |
| 22:55 | eee | it needs to support heap stuff, besides seq stuff, anyway. |
| 22:55 | Cark | ok then ... but your test is only poping stuff ... if you only pop a couple items, you'll end up with a seq instead of a set |
| 22:55 | eee | i popped the whole thing |
| 22:55 | eee | while not nil |
| 22:55 | eee | as you pointed out |
| 22:55 | Cark | you need to dissoc the first item |
| 22:55 | eee | i do? |
| 22:56 | eee | we need that handy clip web page |
| 22:56 | Cark | by using dissoc, you keep using a set |
| 22:56 | Cark | i mean the return value of it will be your set instead of a seq |
| 22:57 | eee | i can't pasre that |
| 22:57 | eee | which set |
| 22:57 | eee | the sorted set |
| 22:57 | eee | or the heap |
| 22:57 | Cark | the sorted set |
| 22:57 | eee | I did this |
| 22:57 | Cark | you said you wanted to test a sorted set as a heap |
| 22:57 | eee | (time (def a (loop [ret (sorted-set) i 0] (if (< i 2000000) (recur (conj ret (rand-int 100000)) (+ i 1)) ret)))) |
| 22:57 | eee | is that wrong? |
| 22:57 | eee | yeah |
| 22:58 | Cark | that's building it, seems ok to me at first glance yes |
| 22:58 | eee | ok |
| 22:58 | eee | but then i should dissoc? |
| 22:58 | eee | i need to look that up |
| 22:58 | eee | not really good at clojure yet |
| 22:59 | Cark | by doing (rest a) you make a seq |
| 22:59 | Cark | ,(doc rest) |
| 22:59 | Cark | damn clojurebot still dead ... |
| 22:59 | eee | so it looks like a seq, but isn't that just an upcast? |
| 23:00 | eee | or OH |
| 23:00 | eee | I see |
| 23:00 | Cark | nope .... most probably some kind of a lazy sequence that looks into the original set |
| 23:00 | eee | it could explain why I wait ten minutes |
| 23:00 | Cark | so |
| 23:00 | eee | so how do I do rest on the sorted-set? |
| 23:00 | eee | i get it |
| 23:00 | eee | dissoc |
| 23:00 | eee | must remove elements |
| 23:01 | Cark | if you have a lazyseq, the time form will return before the end of processing (if i'm not mistaken about the lazy stuff) |
| 23:01 | eee | but now I need to switch to a ummmmm sorted map |
| 23:01 | Cark | nope |
| 23:01 | eee | so my keys can start with 1 |
| 23:01 | eee | so that I can remove the '1' |
| 23:02 | Cark | you can dissoc from a set |
| 23:02 | eee | but you need to know the element |
| 23:02 | eee | so |
| 23:02 | eee | I gotta ask for the first element |
| 23:02 | Cark | (first my-set) will give you the first element |
| 23:02 | eee | right? |
| 23:02 | eee | yeah |
| 23:02 | Cark | so you know it =) |
| 23:02 | eee | is there a multi-map in clj? |
| 23:03 | eee | something that allows multiple same keys? |
| 23:03 | eee | cause that's anoter difference |
| 23:03 | eee | my heap can have dups |
| 23:03 | Cark | nope there isn't |
| 23:03 | eee | ok |
| 23:03 | Cark | you could build one out of clojure maps and lists (or vectors) |
| 23:04 | eee | i see |
| 23:04 | eee | so I can do (dissoc myset (first myset)) |
| 23:04 | Cark | right |
| 23:05 | eee | trying it out |
| 23:06 | eee | having a prob |
| 23:06 | eee | must have typod |
| 23:06 | eee | class cast exception |
| 23:07 | eee | line zero? |
| 23:07 | eee | (recur ((dissoc ret (first ret)))) |
| 23:07 | eee | that's what I have |
| 23:07 | Cark | errr looks like you're right |
| 23:07 | cp2 | you are trying to invoke the return value of (dissoc ...) |
| 23:08 | Cark | dissoc isn't the right one, it's for map only |
| 23:08 | cp2 | (recur (dissoc ret (first ret))) |
| 23:08 | Cark | hum there's a functuion for that though |
| 23:08 | cp2 | o yeah |
| 23:08 | cp2 | it is only for map |
| 23:08 | cp2 | and anyway |
| 23:08 | eee | ahhh |
| 23:08 | cp2 | if you want to remove the first |
| 23:08 | cp2 | (recur (rest ret)) |
| 23:08 | Cark | noooo |
| 23:08 | eee | we just covered that |
| 23:08 | eee | don't want to turn into a seq |
| 23:09 | eee | it's a sorted set |
| 23:09 | cp2 | sorry, not paying much attention |
| 23:09 | cp2 | oh ok |
| 23:09 | Cark | ah there it is : use disj for sets |
| 23:09 | eee | ok |
| 23:09 | cp2 | my bad :) |
| 23:09 | Cark | =) |
| 23:10 | eee | think I'm in for a hurtin now |
| 23:10 | eee | the timing was offset |
| 23:11 | eee | timing in clj always messes people up |
| 23:11 | eee | until they are experts, I think |
| 23:11 | eee | cause of the lazy stuff |
| 23:11 | eee | even doall doesn't always fix |
| 23:12 | eee | working now |
| 23:12 | eee | or |
| 23:12 | eee | so far not complaining |
| 23:12 | eee | thanks for the help |
| 23:12 | eee | brb. gonna let it churn |
| 23:21 | eee | wow, still churning. disj may be slower than turning to a seq |
| 23:21 | eee | brb some more |
| 23:26 | eee | something wrong with that approach. infinite loop |
| 23:26 | eee | it turns out |
| 23:29 | eee | or somewhere else |
| 23:29 | eee | hmmmmm |
| 23:36 | eee | i'm back to something I thought was working. anyone see anything wrong with this? |
| 23:36 | eee | (time (def aa (loop [ret a] (if ret (recur (rest ret)) ret)))) |
| 23:37 | stuhood | i think you need to do (if (seq ret) ...) but i can |
| 23:37 | stuhood | can't remember why. |
| 23:37 | cmvkk | yeah, because (rest ret) will never return nil. |
| 23:37 | eee | no? |
| 23:37 | stuhood | not since the laziness changes |
| 23:37 | eee | that must have changed |
| 23:37 | cmvkk | or you can use (next ret) instead. |
| 23:37 | eee | yeah |
| 23:37 | eee | oh |
| 23:37 | eee | crap |
| 23:38 | eee | that was it |
| 23:38 | eee | dang |
| 23:39 | eee | works |
| 23:40 | eee | now my stuff not trumping anymore |
| 23:40 | eee | as predicted, faster on insert, slower on pop |
| 23:40 | eee | but inserts + pops is slower than just sorting ahead of time |
| 23:41 | eee | so only useful if you want to pop a handful of things |
| 23:41 | eee | or I improve algorithms :) |
| 23:42 | eee | thanks for the help |
| 23:42 | eee | sux that you can't ask for nil ananymore |
| 23:43 | stuhood | eee: like cmvkk said, you can just use (next) everywhere for the old behaviour |
| 23:44 | eee | ok. ret is fewer chars than (next ret) . . . but I suppose the latter is more descriptive anyway |
| 23:45 | stuhood | i mean, (next) instead of (rest) |
| 23:46 | eee | oh |
| 23:46 | eee | i see |