2010-03-30
| 00:09 | brian__ | Hi, how can I tell the data type returned by a function? |
| 00:10 | Raynes | ,(type (+ 3 3)) |
| 00:10 | clojurebot | java.lang.Integer |
| 00:10 | brian__ | ok |
| 00:11 | brian__ | tnx |
| 00:12 | nteon | that JD decompiler gives me wrong answers. |
| 00:13 | nteon | just for everyones information |
| 00:14 | wooby | arohner, got it! thanks in no small part to your insight http://gist.github.com/348741 |
| 00:14 | nteon | http://fpaste.org/LeHL/ |
| 00:14 | nteon | i know this actual function works |
| 00:15 | arohner | wooby: great |
| 00:15 | nteon | but I can't see how it could work if that is _actually_ representative of the generated bitcode |
| 00:16 | nteon | according to JS decompiler, we find the (right) answers, then set the variable to null, then reference the variable |
| 00:17 | nteon | i have to bicycle home, but if anyone could look anad let me know in half an hour if I'm taking crazy pills, that would be aweome |
| 00:41 | defn | http://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/the_eternal_flame-god_wrote_in_lisp.mp3 |
| 00:44 | defn | "and i basically hate hieroglyphs, so i wont write APL." |
| 00:47 | nteon | hi folks |
| 00:48 | defn | nteon: hello |
| 00:53 | nteon | defn: any chance I could persuade you or someone else to look at what I posted 3/4 of an hour ago in the scrollback? I apologize if anyone already responded; I had to go offline and don't have something like irssi setup |
| 00:55 | joshua-choi | defn: But APL is so *pretty*. And it got its own Unicode block! |
| 00:56 | defn | joshua-choi: haha i was just laughing at the lyrics |
| 00:56 | defn | http://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/code_monkey.mp3 |
| 00:56 | defn | that's another excellent one |
| 00:57 | joshua-choi | Wow, I didn't see that link. |
| 00:57 | defn | haha these are great man |
| 00:57 | joshua-choi | That's so...well, I'm smiling broadly :) |
| 00:57 | wooby | wow |
| 00:57 | wooby | gold |
| 00:57 | defn | pure gold |
| 00:58 | joshua-choi | I guess it was just a matter of time before a musical programmer did something. :) |
| 00:58 | defn | haha these are all different submissions |
| 00:58 | defn | i found these because of the crypt-o song: http://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/crypt-o.mp3 |
| 00:58 | joshua-choi | Ah. Well, it was a matter time before someone aggregated musical programmers. :) |
| 00:58 | defn | joshua-choi: :) |
| 00:59 | fanatico | yeah, thanks for linking to that. |
| 00:59 | defn | fanatico: no problem -- here's a page with a bunch more: http://www.catonmat.net/blog/musical-geek-friday-crypto/ |
| 01:00 | defn | http://www.catonmat.net/blog/category/musical-geek-friday/ |
| 01:00 | defn | that's a better link |
| 01:11 | defn | Yes, God had a deadline. |
| 01:11 | defn | So he wrote it all in Lisp. |
| 01:11 | defn | hahah -- ah man -- geek love |
| 01:11 | ndimiduk | is there an equivalent macro to doto which will conditionally apply the methods/functions against its first parameter? |
| 01:12 | ndimiduk | or rather, i'd like to use a doto block, but call methods on a java object instance only (when ...) specific conditions are met for each method. |
| 01:14 | ndimiduk | something like (doto* (Foo.) (when (pred-a?) (.bar)) (when (pred-b?) (.baz))) |
| 01:15 | ndimiduk | or should i just use a let block? :) |
| 01:16 | leifw | ndimiduk: I'd suggest composing a multimethod and doto somehow |
| 01:16 | leifw | but I know very little about either, so maybe that is silly |
| 01:16 | leifw | I mean, depending on what kind of predicates you're looking at |
| 01:17 | leifw | suppose you did have doto* like above, how are you intending to use it? |
| 01:17 | ndimiduk | to conditionally call methods on an anonymous instance of a java object :) |
| 01:18 | leifw | yes, but on what sorts of conditions? |
| 01:18 | noidi | ndimiduk, maybe something like (doto foo (#(when cond (action %)))) ? |
| 01:18 | leifw | I guess I don't know anything builtin that will help; you should rpobably just roll your own |
| 01:19 | noidi | oops, that cond is a bit misleading, I meant it as a variable there :) |
| 01:19 | noidi | (doto foo (#(when (.bar %) (action %)))) |
| 01:19 | ndimiduk | basically, i have a thin clojure wrapper over a java library. This particular fn instantiates an api object, calls setters based on the existence of fn params, and returns the object |
| 01:20 | ndimiduk | more or less, i'm constructing api objects based on clojure maps. |
| 01:21 | ndimiduk | these objects tend to have default constructors and property setters. so, make the instance and then call the right setter if a key exists in the map |
| 01:21 | leifw | so you want to call something like (doto* instance (:field1 val1) (:field2 val2)) |
| 01:21 | ndimiduk | or, i guess more correctly, if a key value in the map is not nil |
| 01:22 | leifw | rather, (doto* instance {:field1 val1, :field2 val2}) |
| 01:22 | leifw | tbh I'd just roll it myself |
| 01:23 | ndimiduk | ah, why not. just a sec. |
| 01:24 | noidi | (doseq [[k v] argmap] (condp k = :foo (.setFoo obj v), :bar (.setBar obj v))) |
| 01:24 | leifw | for example: (defn setAll [inst setMap] (map (fn [[k v]] (when (contains? inst k) (. inst ((setter k) v)))) setMap)) |
| 01:25 | noidi | leifw, can you stuff methods into maps? |
| 01:26 | leifw | sure |
| 01:27 | leifw | http://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-%28memfn%20method-name%20arg-names%2A%29 |
| 01:27 | leifw | hmm |
| 01:27 | leifw | ,(doc memfn) |
| 01:27 | clojurebot | "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn." |
| 01:27 | leifw | there it is |
| 01:27 | noidi | thanks |
| 01:28 | noidi | it's better to use doseq instead of map there, because map is lazy |
| 01:29 | leifw | noidi: yup |
| 01:29 | leifw | I frequently run into that issue and get confused for 10 minutes |
| 01:29 | leifw | :/ |
| 01:29 | ndimiduk | I want to make this method simpler: http://github.com/ndimiduk/clobo/blob/master/src/clobo.clj#L40 |
| 01:29 | noidi | yeah, I learned the difference the hard way :) |
| 01:30 | noidi | after lots of painful debugging |
| 01:30 | ndimiduk | please forgive me. this is my first clojure code in the wild - be kind by being cruel ;) |
| 01:30 | leifw | did I miss something, or does that infinitely loop on (facet-spec [])? |
| 01:32 | leifw | seems pretty straightforward to me |
| 01:32 | ndimiduk | good question, i shall swank it up... |
| 01:32 | leifw | you could use naming conventions to write something that maps :key-words to java setKeyWords() and getKeyWords(), and make it a bit shorter |
| 01:32 | leifw | but that seems like it would get nasty, and wouldn't actually be that useful |
| 01:33 | leifw | maybe there's a way to do it with Bean properties, but I don't know anything about those, and I kind of hate the thought of javabeans anyway |
| 01:34 | ndimiduk | this api has a handful of objects which are created in this way. i'm only wrapping a small portion of the api right now. |
| 01:34 | ndimiduk | so a simple fn/macro/mechanism for repeating this "pattern" in a simple way would be nice. |
| 01:36 | noidi | ndimiduk, maybe this could work? https://gist.github.com/cfe69717a9086961989d |
| 01:37 | ndimiduk | noidi: yes, that could work. |
| 01:38 | Raynes | noidi: I'm pretty sure memfn is generally frowned upon. #(.method % args) is the better alternative. An actual fn. |
| 01:38 | leifw | you'll want (get setters k) there |
| 01:39 | noidi | ok |
| 01:39 | ndimiduk | does memfn also curry over the arguments as your gist suggests? |
| 01:39 | noidi | leifw, why? |
| 01:40 | noidi | ndimiduk, there's no currying, memfn only takes argument names |
| 01:40 | leifw | because setters is a map, not a function |
| 01:41 | noidi | leifw, maps are functions of their keys |
| 01:41 | noidi | ,({:foo 1} :foo) |
| 01:41 | clojurebot | 1 |
| 01:41 | leifw | ok never mind |
| 01:41 | Raynes | Maps are functions. |
| 01:41 | leifw | for some reason that didn't work for me today |
| 01:41 | Raynes | Oh, too late. |
| 01:41 | leifw | but I'm probably remembering that wrong |
| 01:41 | noidi | ndimiduk, but like Raynes said, you should use a lambda there |
| 01:42 | leifw | here's something else you could use for setter: http://gist.github.com/348800 |
| 01:43 | ndimiduk | obfuscation for the sake of simplicity? is this perl? :) |
| 01:43 | Raynes | leifw: The time when get is most useful is when 'nil' is a valid return value for a key in your map, and you want to differentiate between a bad nil and a good nil. With get, you can make it return whatever you like if the key is not in the map instead of nil if need be. |
| 01:43 | ndimiduk | yeah, there's enough setters in this api that i'd like something along those lines. |
| 01:44 | leifw | right |
| 01:44 | leifw | ndimiduk: as long as your naming is consistent, something like that should be okay |
| 01:45 | leifw | oh wait |
| 01:45 | leifw | ok edited |
| 01:45 | leifw | haha, way better |
| 01:45 | leifw | I guess I could kill the cons too, but meh |
| 01:48 | leifw | the more difficult part will be the reflection to get the java method from the string name of it |
| 01:48 | leifw | about which I don't know much |
| 01:48 | Raynes | ~def printf |
| 01:52 | ndimiduk | thanks! |
| 01:54 | leifw | ndimiduk: looks like you'll want Object.getClass(), Class.getMethod() (you'll need the parameter types :/) or Class.getMethods() (which you can search), and Method.invoke() |
| 01:54 | leifw | Method.getName() will be helpful if you go with Class.getMethods |
| 01:54 | leifw | good luck |
| 01:58 | _ato | nteon: the decompiler is probably reordering the instructions |
| 01:58 | _ato | probably clojure is nulling the variables in between pushing them onto the stack and returning |
| 01:58 | _ato | you can't represent that in java code |
| 01:59 | nteon | _ato: doesn't that make the JD debugger useless? |
| 01:59 | _ato | dunno, never used it |
| 02:00 | _ato | the nulling is to prevent holding onto the head |
| 02:00 | _ato | as soon as a variable is no longer referenced its nulled out |
| 02:00 | _ato | so it can be garbage collected |
| 02:00 | nteon | my problem is that I have some nested macros, which expand incorrectly (Somehow), but when I use macroexpand on them in slime, the result I get works fine |
| 02:01 | nteon | I'm building a fn, but calling it gives me a null-ptr exception, unless I macroexpand it myself and then call that |
| 02:02 | _ato | strange... |
| 02:02 | _ato | there should be no difference between you macroexpanding and the compiler doing it, its the same code |
| 02:02 | leifw | ndimiduk: actually I'm kinda drunk and distractable, so I wrote you something anyway: http://gist.github.com/348811 |
| 02:03 | leifw | ndimiduk: may or may not work, I haven't tested it |
| 02:03 | nteon | _ato: possibly different environment, includes and such. thats what im looking at now (I'm expanding it in a test file I'm using as a scratch buffer) |
| 02:03 | leifw | and method-for-class won't work for polymorphic functions, but if you just have getters and setters, that shouldn't matter |
| 02:16 | leifw | ndimiduk: ok this actually works: http://gist.github.com/348817. Try (getter (. java.math.BigInteger/ONE (getClass)) :lowest-set-bit) |
| 02:17 | ndimiduk | leifw: hawt |
| 02:18 | leifw | I always try to rewrite (. obj (method)) as (.method obj); dunno why |
| 02:20 | LauJensen | Morning |
| 02:21 | tomoj | leifw: that's the recommended style, I think |
| 02:21 | tomoj | (.method obj) I mean |
| 02:22 | leifw | didn't work for me |
| 02:22 | defn | ,(:foo {:foo 1}) |
| 02:22 | clojurebot | 1 |
| 02:22 | defn | also works fwiw |
| 02:22 | leifw | maaaaaan you guys and your idioms |
| 02:23 | Raynes | LauJensen: Have you written anything cool in J? |
| 02:23 | LauJensen | Raynes: I'm strictly a 1-liner kind of a J guy, so nothing more than that |
| 02:24 | defn | what do you guys think of Lua? |
| 02:24 | Raynes | I think it's an embeddable scripting language and therefore of no interest to me. |
| 02:24 | leifw | good for configuring window managers, probably not much else? |
| 02:25 | nteon | so my problem is this: http://paste.lisp.org/display/97059 when I pass a string containing clojure code to load-string, http://paste.lisp.org/display/97059 , the java.lang.Math/exp ends up being null? |
| 02:25 | albino | possibly narrow minded too |
| 02:25 | leifw | it's okay, it just doesn't have anything excellent that no other language has (apart from a small footprint and I don't care enough about that) |
| 02:26 | defn | it's kind of neat you only get the essentials |
| 02:26 | defn | if you want break or continue you need to add that by hand |
| 02:26 | leifw | you're thinking of scheme ;) |
| 02:26 | Chousuke | lua is excellent for what it's for |
| 02:26 | Chousuke | which is being embedded in applications |
| 02:26 | defn | Chousuke: in your opinion what is it for |
| 02:27 | defn | *nod* |
| 02:27 | defn | i have a project id like to learn a little lua for, an application i use at work has an embedded interpreter |
| 02:27 | Raynes | No opinion about it. It's pretty much for that. |
| 02:27 | defn | just curious what your thoughts were |
| 02:27 | leifw | you can probably learn it in under an hour |
| 02:27 | defn | yeah it looks easy |
| 02:27 | defn | tables |
| 02:28 | leifw | especially if you've done python or ruby |
| 02:28 | defn | ruby [x] |
| 02:31 | tomoj | what? |
| 02:31 | clojurebot | What is meta |
| 02:32 | tomoj | you people like other languages too? |
| 02:32 | defn | heh |
| 02:32 | leifw | ...I did until last friday :) |
| 02:36 | nteon | python has some wonderful functions, namely map, reduce and filter |
| 02:36 | tomoj | beh |
| 02:36 | tomoj | python is like clojure with it's legs broken |
| 02:37 | nteon | hahaha |
| 02:37 | tomoj | well, no, I'm sure it's great for lots of people |
| 02:37 | tomoj | I just kept trying to use it like I'd use clojure |
| 02:37 | tomoj | and it wouldn't cooperate |
| 02:37 | nteon | tomoj: its really nice when writing little scripts to not have to wait a couple seconds for the JVM to get its act together. |
| 02:37 | defn | i do most of my prototyping in ruby |
| 02:38 | defn | and then re-write it in clojure |
| 02:38 | tomoj | nteon: yeah |
| 02:38 | albino | nteon: big AGREE on that one |
| 02:38 | tomoj | I think there's a way to get around that |
| 02:38 | defn | yeah but if you distribute your script |
| 02:38 | defn | ... |
| 02:39 | albino | defn: define distribute? |
| 02:39 | _ato | there's nailgun, but it's always fiddly to setup and doesn't work in all situations. python/perl/ruby scripts just work |
| 02:39 | tomoj | yeah I think I see what you mean |
| 02:39 | defn | give out to other people who won't have the settings necessary to make your script run right away |
| 02:39 | albino | distributing CPython can't be that much harder than distributing the JVM |
| 02:40 | tomoj | distributing python is usually much easier, no? |
| 02:40 | leifw | baaaaaaaash |
| 02:40 | albino | tomoj: depends on the OS |
| 02:40 | defn | leifw: heh yeah |
| 02:40 | leifw | -_o |
| 02:40 | leifw | kind of a wide-eyed wink I guess |
| 02:41 | defn | search a file in clojure, or use grep? |
| 02:42 | _ato | grep |
| 02:42 | defn | :) |
| 02:43 | defn | night leifw |
| 02:43 | nteon | tomoj: what I was thinking was to have a long running daemon w/ an initialized JVM & clojure libs, to which you pass a filename and arguments, and have it fork(2) and exec(3). similar in concept to emacs and emacsclient |
| 02:43 | nteon | should get around most of the startup time, except for the first time |
| 02:43 | defn | nteon: and that's awesome, but when you distribute your code to others, it doesnt change the startup time |
| 02:44 | defn | unless they do those steps too, which seems like an extra mess to get your script to download a comic book from the internet or something to startup quicker |
| 02:44 | _ato | nteon: http://martiansoftware.com/nailgun/ |
| 02:44 | nteon | defn: not immediately, your right. If I can get it right over the next few weeks, I'll package it up for others |
| 02:44 | defn | nteon: that'd be nice |
| 02:45 | defn | id like a sort of "throw this clj in this directory and it will be on your path and work like a regular uitlity" |
| 02:45 | defn | utility |
| 02:45 | defn | sort of a pre-packaged instant clojure utils environment |
| 02:46 | defn | _ato: that's cool i guess i wasnt aware that's what nailgun did |
| 02:48 | nteon | defn: cool, didn't know about that. what I want to do is a little different; I want each 'client' to run in its own process, with its own instance of the JVM and copy-on-write memory |
| 02:48 | _ato | you can't fork the JVM though can you? |
| 02:49 | _ato | I guess you could try calling fork() via JNI or something and see what happens |
| 02:49 | _ato | actually |
| 02:49 | Raynes | _ato: You can stick a fork in your monitor with a graphical representation of a JVM process running. |
| 02:49 | _ato | no it won't work cause the garbage collector thread will be murdered |
| 02:49 | _ato | as fork only preserves the current thread |
| 02:50 | nteon | _ato: haven't looked into it too much yet :) I am planning to try it from the C side of things, looking at how the 'java' binary intializes thigns |
| 02:50 | defn | i read that as "java binary initializes thighs" |
| 02:50 | albino | you can't use ProcessBuilder to spawn another jvm process? |
| 02:50 | _ato | well you can, but then you don't have the benefit of reduced startup time |
| 02:51 | _ato | of course one option would be to have a pool of pre-initialized JVMs |
| 02:51 | _ato | but then as soon as you use up your pool its back to being slow again |
| 02:51 | nteon | _ato: I know its been done for Python, so I am naiively assuming it will be possible for Java |
| 02:52 | _ato | yeah, python has a native fork call though |
| 02:52 | _ato | its also not garbage collected and doesn't use threads by default |
| 02:52 | _ato | (well it is garbage collected, but its optional... its ref counted) |
| 02:53 | _ato | would be awesome if you can get it to work though |
| 02:53 | nteon | _ato: yup, well, I will keep you apprised :) I unfortunately can't look more into it until this weekend. |
| 02:54 | albino | you could use JNA to make the fork() call |
| 02:54 | albino | why the jvm doesn't have this by default is sort of amazing to me |
| 02:55 | nteon | albino: thanks, I will keep that in mind. |
| 02:55 | nteon | heh yea |
| 02:55 | albino | I think it has to do with that "run everywhere" mentality |
| 02:55 | albino | but it just seems broken to me on platforms where these syscalls have been around forever |
| 02:55 | nteon | albino: i think its only recently with clojure and some other languages that its actually useful for scripting-type things, where startup time maters |
| 02:56 | albino | nteon: well I was trying some of this in Java a few years ago |
| 02:56 | _ato | Criticism of Java has it's on wikipedia page :p |
| 02:56 | albino | nteon: but I'm weird, I actually expect programming languages to include reflection as part of them being useful |
| 02:56 | _ato | s/on/own/ |
| 02:56 | nteon | heh |
| 02:57 | albino | everytime I run 'mvn clean' I feel like jvm startup time matters :) |
| 02:58 | nteon | albino: ugh, good point |
| 02:58 | nteon | albino: although, its hard to say if thats jvm time or mvn time :) |
| 02:58 | nteon | its not exactly a speed deamon |
| 02:58 | nteon | demon ... |
| 02:58 | albino | this one project I use it on, all it does is 'rm -rf' the 'target' directory |
| 02:59 | _ato | a fair whack of java's startup time is actually reading jars and loading classes |
| 03:00 | albino | I had heard that |
| 03:00 | _ato | also clojure doesn't start fast, due I guess to the compiler. a hello world java class loads considerably faster than a hello world clojure |
| 03:01 | _ato | % time java foo |
| 03:01 | _ato | java foo 0.04s user 0.01s system 49% cpu 0.100 total |
| 03:01 | _ato | that's just a hello world |
| 03:02 | _ato | % time java -cp ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar clojure.main -e '(System/exit 0)' |
| 03:02 | _ato | java -cp ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar -e 0.65s user 0.04s system 115% cpu 0.601 total |
| 03:04 | albino | my favorite java limitation is chdir(). IMO this is a process's basic right. |
| 03:04 | nteon | albino: no way. the static, arbitrary memory limits are my favorite. its like im back on class MacOS |
| 03:05 | nteon | I particularly love when maven crashes because I forget to set some environmental variable giving it more than the java default memory |
| 03:06 | albino | nteon: but most of the memory limits are configurable, where as chdir() is just not there |
| 03:06 | nteon | albino: okay :) I can agree that is quite bad as well. |
| 03:30 | LauJensen | Its quite impressive that everybody misunderstood my prefix/infix joke in my last blogpost - Humor in writing is a dangerous thing :) |
| 03:30 | vIkSiT | hi all |
| 03:31 | vIkSiT | the programming clojure book has a line - (use '[clojure.contrib.str-utils .. ) |
| 03:31 | vIkSiT | I can't find the str-utils package in the clojure-contrib.jar though |
| 03:31 | vIkSiT | is it deprecated since the book came out ? |
| 03:32 | LauJensen | vIkSiT: Its probably renamed to "string" |
| 03:33 | LauJensen | disregard 'probably', it is |
| 03:34 | vIkSiT | aha |
| 03:34 | vIkSiT | let me check it out, thanks |
| 03:36 | LauJensen | np |
| 03:37 | vIkSiT | LauJensen, hmm weird |
| 03:37 | vIkSiT | doesn't look like its working |
| 03:38 | vIkSiT | I get a : repeat already refers to: #'clojure.core/repeat in namespace: user \n [Thrown class java.lang.IllegalStateException] |
| 03:38 | LauJensen | When evaluating what? |
| 03:38 | vIkSiT | on a simple (use 'clojure.contrib.string) |
| 03:39 | LauJensen | Weird, string seems to exclude that |
| 03:40 | vIkSiT | LauJensen, not sure what you mean. excluse the core/repeat? |
| 03:40 | LauJensen | vIkSiT: If you get the 1.1 snapshot, then all the str-utils code should work as it does in the book |
| 03:40 | vIkSiT | excuse* |
| 03:41 | vIkSiT | LauJensen, sigh. I changed everything to 1.2.0 yesterday :) |
| 03:41 | LauJensen | vIkSiT: And that should also work, just as string instead of str-utils. But I'm not able to test that atm so I cant help you much with it |
| 03:41 | Raynes | LauJensen: Write a blog post about J. |
| 03:42 | LauJensen | Raynes: I already have 2 blogposts that are heavily J oriented |
| 03:42 | vIkSiT | sure. let me try that, although just replacing str-utils with string doesn't seem to help. apparently, re-split isn't public anymore |
| 03:42 | Raynes | Oh. Well, write a Go vs * comparison. |
| 03:42 | Raynes | Entertain me, man. |
| 03:43 | LauJensen | Go? I mentally hibernate whenever I see Go code |
| 03:44 | Raynes | Go to your happy place. |
| 03:44 | Raynes | :> |
| 03:44 | LauJensen | You mean the REPL ? :) |
| 03:44 | vIkSiT | turns out re-split has become split. hrm |
| 03:44 | Raynes | Hehe. |
| 03:44 | Raynes | LauJensen: Okay, Reia. Learn Reia, and then blog about it vs *. Final offer. |
| 03:44 | LauJensen | REJECTED |
| 03:45 | Raynes | x_x |
| 03:46 | dcnstrct | is there a method in clojure to get a random element of a vector ? something like the methods first or second except it chooses a random element. |
| 03:46 | LauJensen | ,(nth (range 100) (rand-int 100)) |
| 03:47 | dcnstrct | hrmm |
| 03:47 | _ato | <clojurebot> 57 |
| 03:47 | LauJensen | hehe |
| 03:47 | LauJensen | thanks Alex |
| 03:48 | _ato | :-p |
| 03:48 | _mst | that's not the number I got... |
| 03:48 | LauJensen | haha |
| 03:48 | dcnstrct | (defn pick [s] (nth s (rand-int (count s)))) |
| 03:48 | _mst | best out of three :P |
| 03:48 | dcnstrct | something like that maybe ? |
| 03:48 | _ato | _mst: might be a bug... I'm running an old version of clojure... :-P |
| 03:48 | LauJensen | exactly like that |
| 03:48 | _mst | ah, probably held onto your head :P |
| 03:49 | dcnstrct | thnx ;) |
| 03:49 | dcnstrct | I vote for adding that to the language proper |
| 03:50 | _mst | clojure.contrib.seq-utils has rand-elt that does that |
| 03:50 | Raynes | When clojurebot doesn't work, I usually have a bot up in #clojure-casual. $eval or $(whatever). Of course, it's much more limited than clojurebot at this point due to clj-sandbox being in it's infancy. |
| 03:52 | Raynes | LauJensen: Clever. |
| 03:52 | LauJensen | Raynes: I'll only be impressed if you implement it in lua |
| 03:52 | LauJensen | and compile it with Go |
| 03:52 | Raynes | :o |
| 03:52 | Raynes | LauJensen: That was awful off-topic, sure it shouldn't have been in #clojure-casual? ;) |
| 03:53 | LauJensen | Raynes: #clojure has always contained the casual talks in the absense of language discussions, so..no |
| 03:54 | albino | we're off-hours here anyway, I don't see rhickey or chouser or stuart |
| 03:54 | Raynes | Heh. |
| 03:55 | LauJensen | albino: Agreed - Its only when Raynes gets drunk and start telling camp-fire stories that we have to move into #casual |
| 03:55 | LauJensen | Although I'll admit, that happens frequently |
| 03:55 | Raynes | I don't get drunk. :> |
| 03:56 | LauJensen | Glad to hear it |
| 04:00 | Raynes | I'm totally straight edge. If I drank, I wouldn't be nearly as annoying as I am now, because I wouldn't be able to find my IRC window among my virtual desktops. |
| 04:00 | albino | he had to quit to give us that little nugget |
| 04:00 | albino | though I like random.choice() from python better |
| 04:01 | _ato | pick doesn't imply its random though |
| 04:02 | Raynes | albino: http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/seq.clj#L145 |
| 04:03 | Raynes | And rand-elt below it. |
| 04:06 | _mst | I always think you have to be sober to get drunk... |
| 04:08 | kencausey | Should I expect to be able to use leiningen in cygwin? It chokes on trying to find clojure.main even though I have CLASSPATH working to the point that 'java clojure.main' gets me a repl. |
| 04:09 | LauJensen | kencausey: I heard of people using it under Windows |
| 04:10 | kencausey | I suspect it's a path issue, I'm using a window version of Java so I have to use a mix of unix and Windows style paths |
| 04:10 | Raynes | LauJensen: I herd u liek mudkipz. ; This is the extent of my off-topic chatter tonight. Sadly, I'm not immune to sleep deprivation, and I have to get up early. Farewell, my friend. <3 |
| 04:11 | LauJensen | Raynes: Bye bye dear friend - Sleep tight :) |
| 04:11 | _ato | kencausey: have you tried: java -jar leiningen-1.1.0-standalone.jar |
| 04:11 | kencausey | where did leiningen install itself? |
| 04:12 | tomoj | ~/.m2 |
| 04:12 | _ato | $HOME/.m2/repository/leiningen/leiningen/1.1.0/ |
| 04:12 | _ato | which on windows I guess is documents and settings/your_username |
| 04:13 | kencausey | actually, no, under cygwin it's in my cygwin home directory |
| 04:15 | nteon | okay, how can I tell if a static method on a java class is resolvable? |
| 04:22 | kencausey | _ato: Well, it works fine if I change into the same directory with it, but I can't sem to find a CLASSPATH or -cp that will make it work elsewhere, *sigh* |
| 04:22 | kencausey | . is in my CLASSPATH |
| 04:23 | kencausey | actually I know very little about java, I come more from a Lisp background |
| 04:23 | kencausey | I used java only a little in the 90s |
| 04:24 | kencausey | I'm not sure how CLASSPATH and -jar interact |
| 04:24 | kencausey | For clojure I added the full path including the .jar file into CLASSPATH |
| 04:24 | nteon | kencausey: I've been told specifying -jar makes java ignore the -cp option |
| 04:24 | kencausey | ah, OK, well, that won't help ;) |
| 04:25 | nteon | kencausey: yes, I've been doing that. adding the jar to the classpath, and then just specifying the class you want |
| 04:25 | _ato | kencausey: java -cp leiningen-1.1.0-standalone.jar leiningen.core |
| 04:25 | kencausey | OK |
| 04:25 | nteon | java -cp libs/\*:my-jar.jar net.nteon.Example |
| 04:26 | nteon | yea |
| 04:26 | _ato | for the path.. you might need to use double backslashes, like c:\\foo\\bar\\baz |
| 04:26 | _ato | one to escape it in the shell |
| 04:26 | kencausey | of course |
| 04:26 | kencausey | as I said, I've got clojure working ;) |
| 04:26 | _ato | ah right |
| 04:26 | nteon | _ato: if kencausey is using cygwin, I think he can use the nicer unix path separator |
| 04:26 | _ato | right, but java is not part of cygwin |
| 04:27 | kencausey | no I can't, because this Java thinks all the world is Windows |
| 04:27 | _ato | then again, I don't know much about java on windows |
| 04:27 | nteon | sigh |
| 04:27 | nteon | I wish I liked java |
| 04:28 | _ato | the JVM is really awesome, if only it weren't also severely crippled too ;-) |
| 04:28 | nteon | heh |
| 04:37 | LauJensen | _ato: crippl0red? |
| 04:37 | kencausey | _ato: I'm really puzzled, I've added C:\\cygwin\\home\\ken\\.m2\\yadayada to CLASSPATH much as I did for clojure, ant, etc. and I've done it both for bash and for windows environment variables, but unless I'm in the same directory with the jar I can't get it to work, whether in cygwin or command.com, in both cases it chokes with "java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V |
| 04:37 | kencausey | (core.clj:1)" and after the backtrace "Could not find the main class: leiningen.core." |
| 04:38 | _ato | hmm |
| 04:38 | Chousuke | looks like conflicting versions |
| 04:38 | _ato | that restfn error usually means using an incompatible version of clojure |
| 04:38 | _ato | you're only putting lein's jar on the classpath right, nothing else? |
| 04:38 | _ato | (lein's jar contains clojure) |
| 04:38 | kencausey | aha |
| 04:38 | kencausey | no |
| 04:39 | kencausey | trying that now |
| 04:39 | kencausey | I'm using clojure from git |
| 04:40 | kencausey | java -cp $(cygpath -w ~/.m2/repository/leiningen/leiningen/1.1.0/leiningen-1.1.0-standalone.jar) leiningen.core |
| 04:40 | kencausey | that does work |
| 04:41 | kencausey | so, move the original lein shell script and write my own simple version? |
| 04:42 | _ato | yep |
| 04:42 | _ato | most of the lein shell script is performance hacks and the little niceties like self-install and upgrade |
| 04:50 | kencausey | _ato: OK, a simple one liner seems like it is going to work, only time will tell. I've moved the original but kept it handy for the fancy stuff |
| 04:51 | kencausey | night |
| 05:27 | aiba | Is there a way to apply a java method, like (apply Integer/parseInt '("123"))? clojure doesn't seem to like that. |
| 05:28 | noidi | you have to wrap it in a function |
| 05:28 | noidi | ,(apply #(Integer/parseInt %) '("123")) |
| 05:28 | noidi | hmm, no bot |
| 05:28 | LauJensen | ,(map #(Integer. %) ["123" "345"]) |
| 05:29 | aiba | thanks! |
| 05:32 | LauJensen | hiredman_: Where's your bot? |
| 05:36 | LauJensen | Guess they went out to dinner |
| 05:40 | talios | even bots need sleep and good |
| 05:40 | talios | s/g/f/ |
| 06:00 | Borkdude | Is there a clj-sandbox running somewhere behind a website, where I can just paste a quick clojure expression instead of here? |
| 06:01 | Borkdude | (where everybody can see my foolish attempts ;-)) |
| 06:02 | cemerick | talios: they're appreciated :-) |
| 06:03 | talios | Borkdude: http://ideone.com - has clojure support. paste code, and it runs ( i believe ) |
| 06:03 | talios | cemerick: have you listened to any at all? |
| 06:04 | cemerick | talios: talking about Illegal Argument, right? |
| 06:04 | talios | yep |
| 06:04 | cemerick | Sure. Not sure when I subscribed, but it's been some months now. |
| 06:05 | talios | I think it's been some months since we published the last episode :) seems that way at least |
| 06:05 | cemerick | yeah. My own podcast attempt has gone fallow at this point. Not sure when I'd get back to that. |
| 06:06 | talios | we might just have to skype you in for some clojure lovechat :) |
| 06:06 | mikem | Borkdude: you can also start a query with clojurebot |
| 06:06 | talios | problem with that is all the international timezones |
| 06:06 | cemerick | talios: IA is good stuff though; far more entertaining and informational than the posse. |
| 06:07 | cemerick | hah, that'd be fun |
| 06:07 | talios | mikem: clojurebot's gone out to lunch tho |
| 06:07 | cemerick | I often have calls in Asia, so it wouldn't be so hard :-) |
| 06:07 | mikem | talios: oic :) i should pay more attention |
| 06:07 | talios | its 11pm here now, whats the time where you are? |
| 06:07 | Borkdude | mikem, tnx, but I don't want to disturb you guys with my attempts ;) |
| 06:08 | cemerick | 6AM |
| 06:08 | Borkdude | talios: great website! |
| 06:08 | talios | 6am! freak :) |
| 06:08 | mikem | it's just past 6pm here |
| 06:08 | talios | Borkdude: ideone is wonderful. I'm surprised no one ever thought of marrying a code snippet/paste with a compiler |
| 06:08 | cemerick | yeah, I know :-) I've been doing the 5AM thing for about a year now. |
| 06:09 | talios | cemerick: that could he harsh tho - we generally record from 8pm-11pm on Thursdays, so unless you feel like getting up at 3am :) |
| 06:09 | talios | Tho we did do a late (11pm our time ) skyper with Reiner and Rule once |
| 06:09 | talios | which was fun |
| 06:10 | cemerick | talios: hey, whatever it takes to gain fame and international renown! ;-) |
| 06:10 | talios | outing yourself as a maven lover isn't enough? :) |
| 06:11 | talios | Richard -reallllly- doesn't like maven, or sonatype. |
| 06:11 | cemerick | the 5AM thing falls apart when I need to talk to Asia, anyway. |
| 06:12 | cemerick | eh, I was outed a long time ago, but felt like I had to make a little noise for various reasons |
| 06:12 | cemerick | I feared maven like the plague for years, after a bad encounter circa 2005? |
| 06:13 | talios | that would have been maven1 timeframe wouldn't it? |
| 06:13 | talios | maven1 was a nasty hack built ontop of ant |
| 06:14 | Associat0r | http://www.reddit.com/r/programming/comments/bjxbf/functional_fluid_dynamics_in_clojure/ |
| 06:14 | talios | good premise, just bad execution. Really loving Maven 3 tho so far |
| 06:15 | talios | Borkdude: hur, I just saw your ideone tweet show up in my clojure search timeline ;-) |
| 06:16 | Borkdude | ah :) |
| 06:17 | Borkdude | I see from your bio you're doing podcasts, on what exactly? |
| 06:18 | talios | Borkdude: http://www.illegalargument.com/ <- java and jvm development, mixture of mobile foo, groovy, grails, clojure, scala |
| 06:19 | talios | We also talk about pain with maven often it seens :) |
| 06:19 | talios | Which, since we keep using maven - must mean we're sadists or something |
| 06:21 | Borkdude | ok great |
| 06:23 | Borkdude | I'll have a listen later, when I'm home |
| 06:24 | cemerick | talios: yeah, that was maven1. That's called a bad first impression. :-) |
| 06:27 | talios | When I first started at my current gig we had an inhouse buildtool written in groovy that wrapped ant called "sod". Sadly we spent more time in those first few months of the project adding required features to the build tool than the product itself :( |
| 06:27 | cemerick | ouch |
| 06:28 | talios | also left a bad taste in my mouth about groovy, altho it was really more the build tool, and ant integration than anything |
| 06:29 | cemerick | Not that I've given it much of a chance, but groovy rubs me the wrong way as well. |
| 06:30 | cemerick | I suppose it might have been a big deal when it first appeared for those stuck in Java, but if I have my timeline right, I was in python ~2.3 at that point embedding java libs via jpype |
| 06:32 | talios | heh. |
| 06:33 | talios | pre-java I was doing Delphi, and did some small patches/contribs to the Python For Delphi project, we had embedded python code inside paradox database records, executed from a delphi app :) |
| 06:33 | talios | I wonder what a functional python might look like |
| 06:36 | cemerick | I did tinker with lython for a bit, but that project's long since disappeared last I checked. |
| 06:36 | cemerick | but "functional python" is quite the oxymoron :-) |
| 06:38 | talios | well ok, clean syntax with the wacky space indent block syntax. get rid of objects, and its wacky (self, xxx) param which always irked me |
| 06:39 | cemerick | of course, clojure has adopted the [this & args] approach in places, too :-P |
| 06:42 | talios | I love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal [] |
| 06:44 | talios | It's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work. |
| 06:47 | talios | wb |
| 06:47 | talios | I love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal [] |
| 06:47 | talios | It's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work. |
| 06:52 | cemerick | yeah, sorry about that. Should've killed the irc client before fiddling with the wifi :-( |
| 06:52 | talios | heh |
| 06:53 | talios | I love the new named args too. I like the proprosed syntax someone posted to the list about using (defn foo {:name val :name val}) as well, where you just have a {} instead of the normal [] |
| 06:53 | talios | It's a pity I'm not using clojure beyond toy applications and experiments. Would be nice to use it at work. |
| 06:53 | talios | is what I'd said :) |
| 06:53 | cemerick | ah :-) |
| 06:53 | cemerick | I didn't see that (I can't keep up with the list these days). It's funny how destructuring has allowed Rich to back into kwargs, which he totally rejected in the beginning. |
| 06:54 | talios | he was? heh |
| 06:55 | talios | well, coffee finnished and its 6 mins to midnight. time for bed I think. |
| 06:55 | SynrG | heh |
| 06:55 | cemerick | yeah. Before destructuring was around, people were asking for kwargs, but w/o destructuring, that would have required clojure fn invocation to have a mismatch with java method invocation |
| 06:55 | cemerick | i.e. big perf hit |
| 06:55 | talios | right. |
| 06:57 | talios | http://hg.genunix.org/onnv-gate.hg/rev/03c4bd206296 <- a monumental commit :( |
| 06:59 | gstratton | I'm seeing some really strange performance characteristics with a function I'm trying to optimise; I'm not sure whether the it's the JVM or Clojure being weird |
| 07:00 | talios | Right - its now Wednesday morning, night all. |
| 07:00 | cemerick | talios: see you this afternoon ;-) |
| 07:01 | talios | heh |
| 07:01 | gstratton | I have a function which searches a byte array for a subarray. If I start Clojure, create a 10 million byte array and test it, I get consistently around 110ms |
| 07:01 | gstratton | If I then redefine the function, it takes around 200ms |
| 07:04 | cemerick | gstratton: Microbenchmarks are nearly useless. You're probably just bumping up against a new fn def that hasn't been JITed yet. |
| 07:08 | gstratton | cemerick: All I am doing is re-running the defn. I can run the function as many times as a like before I redefine it and get consistently around 110ms (except the second run, which is always around 85ms!), but after the redefinition I can run it as many times as I like and consistently get around 210ms. |
| 07:08 | gstratton | I'm trying to optimise the function, so this is quite frustrating! |
| 07:11 | cemerick | gstratton: I can sympathize, but redefining a fn carries a lot of consequences -- relevant here is that the resulting fn will not be JITed for some time. The conditions under which code is JITed vary significantly. |
| 07:12 | cemerick | gstratton: are you starting java with -server? |
| 07:12 | gstratton | cemerick: no |
| 07:13 | cemerick | gstratton: that'd be the first thing to do. The "server" vm is far more aggressive about optimization. |
| 07:16 | gstratton | cemerick: With -server, I get around 145ms before I redefine and around 230ms after |
| 07:17 | cemerick | gstratton: OK. I'd again warn against microbenchmarking. Aside from that, if you paste the code, that might help. |
| 07:25 | LauJensen | gstratton: Did you catch my post from last night? I go through quite a bit of optimization - despite cemericks warning |
| 07:26 | gstratton | cemerick: The code is at http://paste.lisp.org/display/97065 With my test array the first function is never called, so I'm just optimising the second |
| 07:26 | gstratton | LauJensen: Yes, it was your post that got me looking at this again |
| 07:27 | gstratton | I have just added some extra type stuff courtesy of your post. Now it's 90ms before redefinition and 215ms afterwards! |
| 07:27 | LauJensen | gstratton: type hinting is different from primitives - I suggest you adopt cgrands deep-aget and deep-aset instead |
| 07:27 | LauJensen | That should cut your traversal down to about 10% |
| 07:30 | noidi | http://ptrthomas.wordpress.com/2006/06/06/java-call-stack-from-http-upto-jdbc-as-a-picture/ |
| 07:30 | carkh | hello all |
| 07:30 | carkh | yay ... this nickserv thing is annoying =/ |
| 07:31 | Borkdude | Dudes, I have a little idea for Twitter, to teach newcomers to Clojure a little thing each day |
| 07:31 | Borkdude | http://twitter.com/ceotd ;; Clojure Example of the Day |
| 07:31 | Borkdude | if you want to provide me with some ideas please send them to me |
| 07:31 | carkh | anyways, i'm (finally) giving a test run to defprotocol and reify, and it looks like there is an issue with rest parameters on protocols |
| 07:32 | carkh | is this to be expected ? |
| 07:32 | LauJensen | Borkdude: Only complaint is people should be doing (map count args) and not (map #(.length %) args) |
| 07:32 | LauJensen | And then there's the whole char-limit thing. Twitter is designed to be superficial, so teaching wouldn't come natural ? |
| 07:34 | Borkdude | well it's not really teaching, but more like getting people familiar with clojure a little |
| 07:34 | gstratton | LauJensen: To be honest I'm not too worried about 10% performance, but I am worried about the fact that something which I thought should have no effect changes the runtime by a factor of 2.5 |
| 07:35 | cemerick | gstratton: why do you think that redefining a function should have no effect? |
| 07:36 | cemerick | If everything were simply interpreted, then I'd agree with you. |
| 07:36 | LauJensen | gstratton: I meant it would cut it down to 10%, ie save you 90% of the runtime |
| 07:38 | cemerick | gstratton: to be clear, there are JVM options that will force optimization of all methods, and/or tweak the optimizer so that it does its work more eagerly. I'm just saying, don't ignore the man behind the curtain that makes stuff go fast. :-) |
| 07:39 | carkh | here is a very simple example for my protocol/reify problem : http://gist.github.com/349024 |
| 07:39 | gstratton | LauJensen: Oh, sorry! If that works then it'll be faster than the Java version :) |
| 07:41 | Borkdude | LauJensen, why is count better? It's considered more idiomatic? I'm new to Clojure as well, so great to have some feedback |
| 07:41 | LauJensen | Borkdude: Yes, idiomatic clojure functions are more idiomatic than java methods in my oppinion - You're demonstrating interop where a Clojure fn does the same, its redundant |
| 07:42 | Borkdude | Ah, so tomorrow's tweet could be: ;; More idiomatic version of yesterday's example: (map count ["foo" "bar"]) |
| 07:42 | Borkdude | tnx :) |
| 07:42 | LauJensen | np |
| 07:44 | duncan_bayne | Hi all, I'm trying to build clojure-contrib according to instructions at http://riddell.us/ClojureOnUbuntu.html but I'm seeing a test failure: Testing clojure.contrib.test-jmx |
| 07:44 | duncan_bayne | |
| 07:44 | duncan_bayne | ERROR in (various-beans-are-readable) (run-test5457370694010191789.clj:40) |
| 07:44 | duncan_bayne | Uncaught exception, not in assertion. |
| 07:44 | duncan_bayne | expected: nil |
| 07:44 | duncan_bayne | actual: java.lang.RuntimeException: javax.management.RuntimeMBeanException: java.lang.NullPointerException |
| 07:45 | duncan_bayne | |
| 07:45 | cemerick | ugh, the jmx tests are acting up again, it looks like |
| 07:46 | cemerick | duncan_bayne: yup, it's failing on build.clojure.org, too :-( |
| 07:46 | cemerick | duncan_bayne: looks like d1e831b8a8a3d8e08b0f3aa9650b3d43954cb707 is the last commit that succeeded |
| 07:47 | LauJensen | Wow, its been down for 7 days now |
| 07:48 | LauJensen | cemerick: I think its more likely that this is the culprit 6cfd3b286680fd59021382fdc516be6be82a8834 |
| 07:48 | carkh | i had this when building it yesterday : FAIL in (test-as-url) (run-test7773307746706794632.clj:40) |
| 07:49 | duncan_bayne | cemerick: Thanks, thought it might have been something I was doing. Is there any way of getting the last-known-good version of clojure-contrib from Git? I'm keen to give Clojure a whirl ... |
| 07:50 | carkh | get it from build.clojure.org maybe ? |
| 07:50 | cemerick | duncan_bayne: yeah, just back up a few commits. Refer to http://github.com/richhickey/clojure-contrib/commits/master or use your favorite git tools. I'd go back to 0a1bfc9 to start, get before the most recent jmx stuff. |
| 07:51 | cemerick | duncan_bayne: or better, what carkh said :-) |
| 07:52 | _ato | duncan_bayne: in case you're not familiar with git: git checkout 0a1bfc9b4a1d5e20365d1905806eaf61e13c6db1 |
| 07:52 | duncan_bayne | Sweet, thanks :-) |
| 07:59 | carkh | still noone to have a look at my rest parameter problem on protocols/reify ? http://gist.github.com/349024 |
| 08:00 | duncan_bayne | _ato: building with 'mvn package' from that checkout worked nicely. Thanks for the git tip; I still think like a Subversion user :-) |
| 08:06 | Chousuke | carkh: does reify even support rest arguments? :/ |
| 08:07 | carkh | looks like it doesn't ... maybe it's planed for the future ? |
| 08:07 | Chousuke | you need to ask rhickey about that |
| 08:07 | carkh | i tried doing it the java way, since there's an interface behind the scene |
| 08:08 | carkh | but that doesn't work either ='( |
| 08:08 | bsteuber | so in java interfaces support ... arguments? |
| 08:08 | carkh | there can be a last array argument |
| 08:09 | Chousuke | bsteuber: the ... thing is just a shorthand for an array argument AFAIK |
| 08:09 | bsteuber | chousuke: so Java does the real work on the caller side? |
| 08:10 | Chousuke | I don't know what it does :P |
| 08:10 | Chousuke | probably transforms a call to a variadic method to something that constructs an array and then passes that to the method |
| 08:10 | bsteuber | i see |
| 08:13 | Borkdude | "Quick, let me switch to #clojure to make it look like I'm working" - Huh? "At least it looks more like work than Twitter"... |
| 08:17 | noidi | Borkdude, especially if you use this theme for irssi http://irssi.org/themefiles/c0ders.png |
| 08:18 | Borkdude | noidi, hehe |
| 08:33 | zmila | kill-my-eyes theme |
| 08:58 | powr-toc | I hear the latest swank-clojure has breakpoint support! Does it still work with techomancy's SLIME master branch? |
| 09:03 | dnolen | powr-toc: yeah it works with technomancy's SLIME in ELPA. but from what I understand, things are close to working again with SLIME master as well. |
| 09:13 | powr-toc | dnolen: cool... I've just tried setting a (swank.core/break) in some code, and it throws a stack trace :-\ any ideas what I'm doing wrong? |
| 09:14 | dnolen | it's supposed to do that. then you can press enter on frame 0 and the locals |
| 09:14 | dnolen | you can also press 'c' to continue to the next breakpoint, previous might work as well, haven't gotten too deep into it. |
| 09:15 | dnolen | and the locals -> and see the locals |
| 09:15 | powr-toc | ahh yeah... just realised that! |
| 09:17 | powr-toc | hmm... I get [No Locals] when I think there should be some |
| 09:22 | dnolen | powr-toc: you only see locals on the first frame |
| 09:23 | powr-toc | dnolen: Yeah, but it doesn't seem to display any either |
| 09:24 | dnolen | powr-toc: are you using clojure 1.2.0-master-SNAPSHOT ? |
| 09:29 | powr-toc | dnolen: ahh that'll be it |
| 09:29 | powr-toc | I'm using 1.1.0 |
| 09:30 | powr-toc | time for an update me thinks... |
| 09:30 | dnolen | powr-toc: yeah, the break stuff uses the new env things in 1.2.0. with lein it's easy to use 1.2.0 for a specific project without messing your setup. |
| 09:31 | dnolen | just add clojure and clojure-contrib 1.2.0-master-SNAPSHOT as deps then run lein swank. |
| 09:32 | powr-toc | yeah, was just about to do that |
| 09:32 | powr-toc | but thanks for letting me know it wont kill anything else! :-) |
| 09:32 | powr-toc | I'm really quite liking lein... not perfect, but pretty good... |
| 09:34 | powr-toc | though after the recent maven discussions on the clojure list I'm curious to see what polyglot maven's like |
| 09:39 | cemerick | powr-toc: people have been pinging me looking for a demo of polyglot; I may do that sometime soon |
| 09:42 | Ankou | hi, is there a function to logically combine 2 functions? something like (and (f1 x) (f2 x)) => (fand f1 f2 x)? |
| 09:43 | Borkdude | what is the standard java terminology for anonymous classes, just that, or 'anonymous inner class'? |
| 09:43 | LauJensen | cemerick: Has anyone fixed this 7-day breakage yet ? |
| 09:44 | cemerick | LauJensen: doesn't look like it |
| 09:44 | LauJensen | cemerick: Did you work out which commit blew it ? |
| 09:45 | cemerick | LauJensen: I think you had it right, although it's odd that a later commit is shown as successful. |
| 09:45 | cemerick | LauJensen: you'd have to bother chouser or stuartsierra about it, I'm just a civilian. :-) |
| 09:46 | LauJensen | stuartsierra: Ping |
| 09:46 | LauJensen | chouser: Pong |
| 09:46 | cemerick | or perhaps laity is better ;-) |
| 09:46 | noidi | Ankou, comp |
| 09:46 | esj | cemerick: laity is funny |
| 09:47 | cemerick | esj: I try, sometimes too hard. :-) |
| 09:47 | noidi | Ankou, sorry, misunderstood you at first |
| 09:47 | stuartsierra | LauJensen: pong |
| 09:47 | LauJensen | stuartsierra: Contrib has been broken for 7 days now - Are you the guy who's about to fix it ? |
| 09:47 | chouser | ~stuartsierra? |
| 09:48 | LauJensen | I have a hunch that Halloways commit broke it |
| 09:48 | stuartsierra | I'll take a look. |
| 09:48 | LauJensen | 6cfd3b286680fd59021382fdc516be6be82a8834 |
| 09:48 | chouser | bah, no clojurebot |
| 09:48 | LauJensen | Thats my best bet |
| 09:48 | chouser | stuartsierra: let me know if you need to tag-team |
| 09:49 | stuartsierra | It's the c.c.jmx lib still. |
| 09:50 | stuartsierra | It's been failing tests for a while. |
| 09:50 | stuartsierra | What changed is that I updated the Maven plugin; so now the failing tests actually stop the build. |
| 09:51 | hugod | dnolen: I couldn't repro your issue with the exception-location branch, though I added a fix for navigating to top level namespaces |
| 09:51 | hugod | dnolen: if you could message me the details, I'll investigate further |
| 09:51 | dnolen | hugod: yeah I saw that you committed something. but it did not fix it for me. do you think this is because of SLIME ELPA? |
| 09:51 | stuartsierra | I can't reproduce the error shown here http://build.clojure.org/job/clojure-contrib/44/console |
| 09:52 | hugod | dnolen: I suspect it's not related to the branch - did you try on the release version? |
| 09:52 | stuartsierra | Same error persists here http://build.clojure.org/job/clojure-contrib/46/console |
| 09:53 | dnolen | hugod: no should I? the one clojars you mean right? |
| 10:06 | LauJensen | stuartsierra: will you drop a comment here once its fixed? |
| 10:07 | stuartsierra | sure |
| 10:07 | LauJensen | Great, thanks |
| 10:07 | stuartsierra | I emailed Halloway about it to see if he has any ideas. |
| 10:09 | cemerick | It seems just a bit odd that jmx stuff is in contrib at all, but that's probably just me. |
| 10:09 | LauJensen | If jmx has been failing tests for some time now, how about moving it out of the testing to get a working build, and then fixing it behind the scenes |
| 10:10 | stuartsierra | ok |
| 10:18 | stuartsierra | OK, contrib is alive again http://build.clojure.org/job/clojure-contrib/47/ |
| 10:26 | Licenser | greetings |
| 10:26 | LauJensen | Great, thanks stuartsierra |
| 10:26 | stuartsierra | you're welcome |
| 10:26 | npoektop | hi! what is clojure-contrib-slim.jar for? |
| 10:30 | esj | female, French, clojurians. |
| 10:30 | LauJensen | npoektop: I think its just the classes and no source |
| 10:31 | pdk | contrib-slim is just to take less space when you want to bundle it with an applet |
| 10:32 | npoektop | ok, thank you |
| 11:27 | drewr | npoektop: actually, clojure-slim is the uncompiled clojure source and the compiled java classes |
| 11:28 | drewr | smaller jar, hence slim |
| 11:37 | cemerick | The fact that AOT compilation compiles all transitive namespace dependencies of the namespaces to be compiled is becoming an actual problem. Some libs include support for optional libraries that I'd rather not have around at all, but need to be available for AOT to succeed. |
| 11:40 | chouser | cemerick: where would it be best to control that property? a literal flag in ns :require? |
| 11:40 | chouser | default to AOTing only the libs named specifically in (compile ...)? |
| 11:41 | cemerick | I'm not sure. I think it's probably wise to keep control of AOT in compile, rather than pushing it down into ns declarations. Those are generally not under your control if you're having problems. |
| 11:42 | cemerick | It's totally reasonable to have the current behaviour be the default. I think. :-) |
| 11:42 | chouser | so maybe compile should take an option list of libs *not* to compile? |
| 11:42 | cemerick | No, nevermind, you really should have to specify all the namespaces you want to have compiled. |
| 11:43 | cemerick | or, a pattern, anyway. #"com\.mycompany\..*", etc |
| 11:43 | chouser | hm. (compile foo.bar :filter #"clojure\.contrib\..*") ? |
| 11:44 | cemerick | chouser: a blacklist would be irritating when dependencies change, along with namespace names. |
| 11:44 | chouser | right. filter is a whitelist |
| 11:44 | chouser | oh |
| 11:44 | chouser | so my example was bad |
| 11:45 | chouser | (compile foo.bar.baz :filter #"^foo\.bar\.") |
| 11:45 | chouser | regex seems a poor fit. |
| 11:45 | cemerick | Right, that's better. |
| 11:46 | cemerick | clojure-maven-plugin just happens to use them for namespace exclusion/lists, so that's what came to mind first. |
| 11:46 | chouser | (compile foo.bar.baz :only [foo.bar.* clojure.contrib.*]) |
| 11:46 | chouser | meh |
| 11:46 | cemerick | I think it's totally reasonable for compile to just take a list of namespaces, and leave the mechanics of building that list to people's build tools. |
| 11:47 | cemerick | With some provision to get back to compile-the-world-starting-here sort of behaviour. |
| 11:47 | chouser | (compile-only foo.bar1 foo.bar2) |
| 11:47 | cemerick | Sure, that would do. |
| 11:48 | chouser | of course that probably demands all sorts of tools support the new fn. maven plugin, lein, IDEs... |
| 11:49 | cemerick | well, some significant change will affect them one way or the other. The current behaviour really is a little nuts, at least anywhere where you're not just shipping an uberjar |
| 11:50 | cemerick | (which is pretty impolite these days, anyway) |
| 11:50 | cemerick | (in many scenarios) |
| 11:53 | chouser | it should be possible to write 'compile-all' without patching clojure |
| 11:53 | chouser | er, compile-only |
| 11:56 | cemerick | chouser: How? Doesn't it trigger of reload of each lib's dependencies? |
| 11:56 | cemerick | Hrm, no, it doesn't. |
| 11:57 | chouser | hm, direct linking (is that what it's called) may prevent a patchless solution. |
| 11:58 | chouser | I was thinking of binding load-file (or whatever is needed) to get a chance to change *compile-files* |
| 12:00 | cemerick | That may work as an implementation strategy, but I don't think that eliminates the need for API changes. Build tools all run through clojure.lang.Compile. |
| 12:01 | chouser | I'm just talking about providing a compile-only fn -- tooling is above my paygrade. |
| 12:01 | chouser | I suppose clojure.lang.Compile could have a method that calls compile-only |
| 12:02 | chouser | but I need to tweak clojure.core/load and I bet direct linking will make me patch it instead of binding it. :-/ |
| 12:02 | cemerick | well, it only has one method (main). It could certainly grow an option or two. |
| 12:13 | npoektop | hi! i'm trying to setup emacs with slime for clojure. Can't do (require 'swank-clojure-autoload) -- there is no such file. |
| 12:15 | chouser | cemerick: so one detail is that 'require'd libs still need to be loaded, they just wouldn't be compiled unless in the list. |
| 12:15 | npoektop | the only file i can find is swank-clojure.el |
| 12:16 | cemerick | chouser: Sure, that's unavoidable I presume. |
| 12:16 | chouser | cemerick: and that means if its required by something earlier in the list, but appears later in the list, it still needs to be compiled that first time. |
| 12:17 | hugod | dnolen: the problem is that the clojure compiler exception is saying line 0 - not much I can do at the swank level... |
| 12:17 | chouser | so it'd be nice to avoid re-compiling it that second time. though I guess that could be an optimization later. |
| 12:17 | dnolen | hugod: I suspected that. |
| 12:17 | cemerick | chouser: I can't imagine that being a problem. The only thing that matters is what's in *compile-path* when compile returns. |
| 12:18 | dnolen | hugod: is there a Clojure bug report for that? |
| 12:18 | hugod | dnolen: no idea |
| 12:20 | drewr | npoektop: how did you go about installing swank-clojure? |
| 12:20 | drewr | you'll need the entire source distribution somewhere |
| 12:20 | lpetit | chouser: (defn compile-only [lib ns-filter-pred]) ? |
| 12:20 | dnolen | hugod: well then other than that the exception branch seems to work :) |
| 12:22 | npoektop | drewr, i did git clone ..., moved it to ~/.elisp, wrote (require 'swank-clojure-autoload), and it did not work |
| 12:22 | hugod | dnolen: thanks! I'll try and merge it later |
| 12:22 | cemerick | lpetit: the question is, when would ns-filter-pred ever allow anything other than the explicit set of namespaces one might have in a given project? |
| 12:23 | npoektop | drewr, also added path to load-path |
| 12:23 | dnolen | npoektop: save yourself a lot of time use setup your Clojure Emacs environment via ELPA |
| 12:23 | drewr | npoektop: I think swank-clojure-autoload was removed a while back |
| 12:24 | npoektop | dnolen, what if i want to use slime with other lisps? |
| 12:24 | dnolen | npoektop: http://tromey.com/elpa/install.html, the only thing you need to actually install from ELPA is swank-clojure it will grab and configure everything else you need. |
| 12:25 | dnolen | npoektop: yeah, a manual approach will probably be more frutiful, tho I've been able to tweak my ELPA setup to handle other lisps. |
| 12:25 | drewr | npoektop: you'll need to frob slime-lisp-implementations in that case |
| 12:25 | lpetit | cemerick: maybe you're right. But why close the door to the unknown when a general solution is not that bad ? Or maybe a (compile-only* ) witht the predicate, and a (compile-only) with the sugar for the common case ? |
| 12:26 | lpetit | the sugar could even be a macro to avoid having to quote the symbols |
| 12:27 | cemerick | lpetit: huh, I figured explicitly naming the libs to be compiled *was* the general solution (since whatever is invoking compile can build that list however it wants) |
| 12:28 | lpetit | cemerick: why not, but the list can be quite long. a predicate fn is maybe not what people may want in general, but is certainly more generic |
| 12:29 | lpetit | but I'm just musing here, I'll let you do the right choice. Must leave to house. cu |
| 12:29 | cemerick | lpetit: heh, not up to me, talk to chouser :-) |
| 12:40 | chouser | yeah, I like a predicate for the unsugared version |
| 12:42 | cgrand | (compile-only* 'my.lib '#{other.lib.i.want.to.compile}) |
| 12:42 | chouser | right |
| 12:43 | chouser | I mean, good point. :-) |
| 12:50 | npoektop | people, share you .emacs for slime+clojure, please |
| 12:50 | chouser | npoektop: I don't use emacs or slime. sorry. |
| 12:51 | lithpr | npoektop: have you considered the emacs starter kit |
| 12:52 | npoektop | no, i have my own emacs setup, and i want to setup slime+clojure manually |
| 12:54 | lithpr | yeah, i looked at my cusomizations, and it looks like the ESK took care of that for me :)P |
| 12:55 | drewr | npoektop: http://gist.github.com/349294 |
| 12:55 | drewr | use at your own risk :-) |
| 12:56 | drewr | I'm not currently using any other lisp implementation, but you can edit slime-lisp-implementations as you need |
| 12:57 | npoektop | drewr, thank you! |
| 12:59 | npoektop | drewr, would you upload ~/bin/clojure, please |
| 13:01 | drewr | done |
| 13:02 | stuartsierra | Halloway and I fixed the JMX bug in contrib, builds ok now. |
| 13:03 | npoektop | drewr, thank you again! |
| 13:06 | LauJensen | stuartsierra: great job |
| 13:07 | stuartsierra | Thank halloway, he fixed it. I just nagged. :) |
| 13:08 | LauJensen | I was happy about the bit that there was a quick temp fix, and no lack of follow-up to get the real issue fixed |
| 13:08 | LauJensen | However - I think it would be in place to set up some kind of alert system so that a build isn't lying in pieces for 7 days |
| 13:21 | cemerick | Not sure about that. No one really complained about it for 7 days. :-) |
| 13:22 | LauJensen | In my oppinion thats the weakest possible argument for accepting such a failure |
| 13:22 | drewr | ,(conj '(1 2 3) 4) |
| 13:22 | clojurebot | (4 1 2 3) |
| 13:22 | drewr | ,(conj [1 2 3] 4) |
| 13:22 | clojurebot | [1 2 3 4] |
| 13:22 | drewr | I've never noticed that before |
| 13:22 | cemerick | LauJensen: well OK. But Hudson *is* the alert system, fundamentally. |
| 13:23 | cemerick | yup, conj is polymorphic |
| 13:23 | LauJensen | ,(reduce conj '() [1 2 3 4 5]) |
| 13:23 | clojurebot | (5 4 3 2 1) |
| 13:23 | LauJensen | drewr: noticed that? :) |
| 13:23 | chouser | it's hard to make people not ignore stuff they want to ignore. At least not without other social consequences. |
| 13:23 | drewr | why does one want conj to behave like cons for lists? |
| 13:23 | LauJensen | chouser: I didn't get the impression that this was caused by anyone with bad intentions? |
| 13:24 | cemerick | drewr: conj is a polymorphic cons. |
| 13:24 | chouser | LauJensen: I was referring to people ignoring the build failure alert in hudson. |
| 13:25 | LauJensen | chouser: Yea, am I'm just asking the question, did they know it was there? |
| 13:25 | drewr | I get that it's polymorphic; I'm confused as to why you want to build lists the other direction as you do with vectors |
| 13:25 | chouser | you can subscibed to an RSS feed of failures, so it's easy to know. but if people are ignoring that, well, what are you going to do? |
| 13:25 | chouser | drewr: that the only direction you can build lists efficiently. |
| 13:25 | cemerick | drewr: because that's the only way one can add to a list efficiently. |
| 13:25 | LauJensen | drewr: No other way to build lists efficiently |
| 13:25 | cemerick | chouser: oh, here we go again! :-P |
| 13:26 | cemerick | damn, almost down to the word, even |
| 13:26 | LauJensen | chouser: Cant we just assign the main responsibility to you, and then you'll handle it? |
| 13:26 | drewr | I'm sensing here it has something to do with efficiency |
| 13:26 | drewr | ;-) |
| 13:26 | chouser | LauJensen: no thanks |
| 13:26 | cemerick | conj adds an item to a collection, in whatever way makes sense for that collection. |
| 13:26 | drewr | I get it, so you don't have to traverse the entire list to append to the tail |
| 13:26 | cemerick | ,(conj {} [:a 5]) |
| 13:26 | clojurebot | {:a 5} |
| 13:26 | LauJensen | chouser: I would ask cemerick but he's busy sorting out his XML |
| 13:28 | cemerick | LauJensen: Not really, it sorta just works, and is busy deploying apps to three different app servers at the moment. ;-) |
| 13:28 | LauJensen | hehe |
| 13:28 | LauJensen | :) |
| 13:28 | LauJensen | cemerick: I'll watch your screencast and see if you dont end up making a good case for it |
| 13:29 | joshua-choi | We being Hickey, the dictator, of course |
| 13:29 | Beket | Hey people! I'd like a cool starting project to learn clojure. Something non-trivial + interesting. Any suggestions ? :D |
| 13:29 | drewr | joshua-choi: that's where I was headed; I assumed PersistentList was very different from Cons |
| 13:30 | chouser | PersistentList is only different in that it promises the rest part is also a PersistentList, and also it knows its own length |
| 13:31 | joshua-choi | Yeah, I guess countability is a big difference. (Though that PersistentList promises that its rest is another list is moot if Cons become also lists.) |
| 13:31 | cemerick | are people still using lists? |
| 13:31 | cemerick | I mean, explicitly? |
| 13:31 | joshua-choi | Hmm, yeah, countability throws a wrench in that idea, then... |
| 13:31 | joshua-choi | I do. |
| 13:31 | lithpr | Beket: i'm reluctant to respond. Do you really want suggestions? |
| 13:32 | cemerick | joshua-choi: why? |
| 13:32 | chouser | well, you're asking for a polymorphic 'cons'. Which ... doesn't sound particularly bad I guess. |
| 13:32 | joshua-choi | cemerick: In a Clojure-in-Clojure parser. :P |
| 13:32 | drewr | cemerick: I apparently haven't yet after 2.5 yrs :-) |
| 13:32 | LauJensen | Beket: Go check out my blog, there should be something worth trying out: http://www.bestinclass.dk |
| 13:32 | Beket | lithpr, please don't respond, if that makes you feel bad :) |
| 13:32 | cemerick | joshua-choi: oh, OK, nevermind. Have fun :-D |
| 13:32 | lithpr | k |
| 13:32 | Beket | Thanks for the pointer LauJensen |
| 13:32 | cemerick | drewr: that's where I was going... :-) |
| 13:32 | joshua-choi | cemerick: Also, we use them all the time in macros. Though list* secretly returns a Cons. |
| 13:32 | drewr | I just haven't read as much of the source as I should have by now |
| 13:33 | joshua-choi | ,(list? (list* 5 2 [1 2])) |
| 13:33 | clojurebot | false |
| 13:33 | cgrand | on lists vs seqs: in my experience treating lists as seqs hurts performance (pop/peek/conj vs next|rest/first/cons) |
| 13:33 | joshua-choi | Its docs are misleading too |
| 13:34 | cemerick | cgrand: I always produce vectors, and consume seqs, unless otherwise required. That eliminates any issues AFAICT. |
| 13:34 | cemerick | This is all app-level talk, of course. |
| 13:36 | joshua-choi | In certain cases with monads, I get right-grouping, so I use lists and cons's instead of vectors. |
| 13:46 | norton | hello |
| 13:47 | chouser | norton: hi |
| 13:47 | norton | I was wondering if anyone could help me understand an error I am seeing when trying to use conjure-contrib.sql |
| 13:48 | norton | (ns database-manager (require [clojure.contrib.sql :as sql])) |
| 13:48 | norton | (require 'database-manager) |
| 13:48 | norton | java.lang.VerifyError: class clojure.contrib.sql$loading__4946__auto____47 overrides final method meta.()Lclojure/lang/IPersistentMap; (database_manager.clj:1) |
| 13:48 | chouser | that should be ":require" instead of "require", but that's probably not causing your error. |
| 13:49 | chouser | sorry, "(ns database-manager (:require" Your second one is correct. |
| 13:50 | rhickey | so, any more input on the names for deftype variants? |
| 13:50 | norton | so the first one (ns ... ) is written in a file: database_manager.clj |
| 13:50 | chouser | rhickey: When you're not here, we just talk about our favorite build tools. So no. |
| 13:50 | norton | the second one is entered into a repl fired up using "lein repl" |
| 13:51 | rhickey | chouser: I see |
| 13:51 | rhickey | I thought you talked about editors :) |
| 13:51 | chouser | norton: that's not an error I've seen much. do you have matching clean builds of clojure and contrib? |
| 13:52 | norton | This is whatever is in clojars |
| 13:52 | rhickey | I was wondering if the distinction I made between program constructs and domain data constructs holds |
| 13:52 | norton | btw, I have some unit tests on the database_manager ns that execute fine |
| 13:53 | norton | its just when I try and require it into the repl I get the problem |
| 13:53 | norton | so I would think its a classpath issue, execpt it doesn't seem to be |
| 13:53 | chouser | drewr: http://clojure-log.n01se.net/date/2010-03-25.html (just looked it up myself) |
| 13:54 | drewr | thanks |
| 13:56 | Licenser | (map greet (who #clojure)) |
| 13:56 | chouser | rhickey: yeah, I think the conceptual distinction is sound. "program construct" doesn't automatically suggest to me what I think you mean though. |
| 13:57 | rhickey | deftype + deftmap ? |
| 13:58 | chouser | where deftype is raw and deftmap is mappy. meh. |
| 13:59 | rhickey | ideally the names would suggest the distinction, those don't |
| 13:59 | drewr | deftypem |
| 13:59 | rhickey | deftype + defrecord/defentity |
| 14:00 | chouser | their behavior around non-closure methods, fields, and performance will be similar, right? having somewhat related names might be useful. |
| 14:00 | rhickey | chouser: yes, very similar and could be variant of same base, but then they get longer |
| 14:00 | chouser | defrawtype + defmaptype |
| 14:00 | rhickey | deftype defmaptype |
| 14:01 | drewr | eww |
| 14:01 | chouser | defrawtype deftype |
| 14:01 | chouser | "raw" isn't quite right |
| 14:02 | drewr | I think I still like deftype/deftypem -- implies the latter is an extension of the former, and doesn't tie too much logic into the name (which usually backfires) |
| 14:02 | LauJensen | what does 'defmaptype' cover exactly ? |
| 14:02 | drewr | plus, I like brevity |
| 14:02 | chouser | LauJensen: like (deftype ... clojure.lang.IPersistentMap) is now |
| 14:02 | rhickey | LauJensen: deftype w/full map implementation |
| 14:03 | drewr | of course, I'm the guy that actually likes car/cdr |
| 14:03 | rhickey | data + datamap |
| 14:03 | drewr | too overloaded |
| 14:03 | LauJensen | ah, so their uses are totally different? |
| 14:03 | chouser | drewr: and yet doesn't know which end lists grow on. ;-) |
| 14:04 | drewr | haha |
| 14:04 | rhickey | datatype datamap |
| 14:05 | LauJensen | rhickey: would deftype and defmap be totally wrong? :) |
| 14:05 | chouser | I actually like data. deftype already needs a different word in prose, "datatype". So we'd just need something similar for 'data' |
| 14:05 | LauJensen | yea datatype and datamap aren't bad |
| 14:06 | arohner | I like datamap |
| 14:06 | rhickey | chouser: I'm not sure which name means which in your sentence |
| 14:06 | chouser | I like having something to indicate type in both, because that's what's being defined: a named type. not an instace, an example, a map, or anything else. |
| 14:06 | drewr | chouser++ |
| 14:06 | rhickey | datatype maptype |
| 14:07 | chouser | yes! |
| 14:07 | joshua-choi | Are these ideas for Clojure 1.2? |
| 14:07 | Licenser | chouser++ ?is that chouser with objects? |
| 14:07 | chouser | Licenser: perhaps. and my mutable state is indeed uncoordinated. |
| 14:08 | chouser | joshua-choi: yes |
| 14:08 | rhickey | so, what about not having def prefix? |
| 14:08 | Licenser | chouser: *snickers* |
| 14:09 | chouser | rhickey: that would feel weird, at least at first. |
| 14:09 | LauJensen | rhickey: I'd prefer prefixing both of those suggestions with def |
| 14:10 | drewr | if map is going to be in the name, then I like deftype/defmap |
| 14:10 | drewr | the "def" prefixing "map" implies that it's some kind of blessed map |
| 14:11 | LauJensen | To me it just seems natural to keep all of this conventional, defmaptye, defn, defmacro, etc |
| 14:12 | drewr | LauJensen: why is defmaptype conventional? |
| 14:12 | rhickey | def* for me is fundamentally about some shortcut for (def blah ...), that is not the case for these |
| 14:13 | LauJensen | rhickey: I know thats the case, but I don't think most users perceive it like that. I could be wrong though |
| 14:13 | rhickey | I'd also change current definterface to interface |
| 14:14 | rhickey | interface X, datatype X, maptype X |
| 14:14 | chouser | hm |
| 14:14 | dnolen | rhickey: ++ |
| 14:14 | dnolen | i mean, inc |
| 14:14 | drewr | I don't like it, but you have a larger picture in your head than I do |
| 14:15 | dnolen | a different convention because they are all "lower level constructs" in my mind, not the thing you should normally be reaching for. |
| 14:16 | drewr | I have a need for typed maps quite frequently |
| 14:16 | chouser | I guess all existing def* are about Vars, aren't they. |
| 14:16 | rhickey | protocol X |
| 14:17 | rhickey | chouser: yes |
| 14:17 | rhickey | and though datatype/maptype do create vars, not their primary purpose |
| 14:17 | rhickey | protocol more about vars |
| 14:17 | rhickey | interface not at all |
| 14:18 | chouser | for me what's uncomforatable is that they look like some kind of side-effect-free conversion function or something. |
| 14:18 | rhickey | (datatype Foo [a b c] ...) |
| 14:18 | chouser | like (maptype Foo [a b]) is coercing the vector and returning something... |
| 14:19 | drewr | yes |
| 14:19 | fogus | chouser: What if the first letter was capitalized? |
| 14:19 | rhickey | fogus: Datatype and Maptype? |
| 14:20 | chouser | those look like class names to me, not verbs |
| 14:20 | fogus | rhickey: right Interface X also |
| 14:20 | drewr | it does imply construction of some kind, but you feel like you need to def it to a var |
| 14:20 | rhickey | chouser: agreed |
| 14:21 | chouser | is there a new prefix we can use for these? we're not defining vars, but we're certainly definining something. |
| 14:21 | rhickey | def* does have the "this probably belongs at toplevel" feel |
| 14:21 | dnolen | chouser: I always thought ns looked kinda weird as well. is datatype, maptype, et. al. so different? |
| 14:21 | fogus | chouser: Moreso than the lowercase version? |
| 14:21 | drewr | rhickey: yes |
| 14:21 | fogus | I suppose caps hold too much baggage |
| 14:22 | rhickey | fogus: if we are going to adopt uppercase at all, I'd like it to be for type names |
| 14:22 | fogus | got it |
| 14:22 | rhickey | chouser: new and shorter prefix welcome :) |
| 14:23 | chouser | so if we're not "def"ining, and certainly not "declare"ing, what are we doing? installing, instilling, embedding... |
| 14:23 | fogus | newtype newinterface ... again new has too much baggage |
| 14:24 | dnolen | chouser: ns creates a namespace object and returns a nil. we don't do def-ns |
| 14:24 | chouser | specifying. specmaptype |
| 14:24 | rhickey | dnolen: because it would be defns |
| 14:24 | chouser | dnolen: perhaps not. I'm sure we'd get used to it. |
| 14:24 | dnolen | rhickey: heh, yeah, not good. |
| 14:25 | drewr | I'm stuck on deftypem or defm |
| 14:25 | rhickey | drewr: those seem awkward |
| 14:25 | LauJensen | chouser: its a shame we need a prefix, mapspec, typespec, sounds nice |
| 14:25 | drewr | what about deftype*/deftype |
| 14:26 | drewr | not sure if that idiom applies here though |
| 14:26 | rhickey | drewr: people normally shouldn't be using the * versions of things |
| 14:26 | drewr | ok |
| 14:27 | drewr | though as a user, I'm really only interested in creating typed maps |
| 14:27 | astoddard | What about a sigil prefix or suffix, such as +datatype or >datatype? |
| 14:27 | LauJensen | ouch |
| 14:27 | rhickey | astoddard: duck! |
| 14:27 | ndimiduk | forgive my ignorance, but isn't this was namespaces are for? |
| 14:27 | drewr | seems like if I'm creating a type with only hash/= I'm in java-land |
| 14:28 | fogus | then we could add twigils! :p |
| 14:28 | rhickey | drewr: unless you are writing collection or reference types... |
| 14:28 | LauJensen | rhickey: Do they need to be associates in any way? Or would deftype and datamap work ? |
| 14:28 | chouser | delinitiate. delmaptype :-) |
| 14:28 | rhickey | delete |
| 14:28 | chouser | right |
| 14:28 | fogus | Has anyone proposed any literal representations? |
| 14:29 | rhickey | LauJensen: without a connection we will need duplicate docs, where one is clearly like the other plus a bit |
| 14:29 | chouser | fogus: for instances of these things? That's a whole other rabbit-trail. |
| 14:29 | LauJensen | True |
| 14:29 | fogus | chouser: right... was curious if anyone has taken that trail yet. |
| 14:29 | rhickey | fogus: printing is easy, reading requires the supporting defs be loaded first |
| 14:30 | drewr | "delinitiate" that took a moment to parse |
| 14:30 | LauJensen | I'm ducking out, but deftype and defdatamap would be my best bet |
| 14:30 | chouser | drewr: gah, sorry for the typo. "delineate" |
| 14:30 | drewr | ah! that's how I read it :-) |
| 14:30 | chouser | but useless because we all know "del" means "delete" |
| 14:30 | chouser | fix |
| 14:31 | fogus | freshtype freshmap freshinterface yuck |
| 14:31 | chouser | resolve, appoint, establish, dictate |
| 14:31 | rhickey | defdatatype and defdatamap start to become sentence-in-a-word |
| 14:31 | chouser | rhickey: is that good or bad? |
| 14:31 | rhickey | bad |
| 14:32 | rhickey | given we don't have the def- convention |
| 14:32 | rhickey | def-datatype and def-datamap are better |
| 14:32 | chouser | oh, I see. yes. |
| 14:32 | joshua-choi | There is clojure.template/def-template, I recall. |
| 14:33 | chouser | I guess if you're sure we won't want 'datatype' or 'protocol' for some non-top-level thing later, it's just a matter of getting used to it. |
| 14:33 | rhickey | def-maptype |
| 14:33 | fogus | joshua-choi: deftemplate @ http://github.com/richhickey/clojure-contrib/blob/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/macro_utils.clj#L236 |
| 14:34 | drewr | I'd just assume have defmaptype |
| 14:34 | joshua-choi | fogus: ! It was def-template when I last saw it |
| 14:34 | rhickey | switching to def- will just leave people wondering when to use which |
| 14:34 | joshua-choi | Ah! |
| 14:34 | joshua-choi | I was confused with do-template |
| 14:36 | fogus | My favorite for the defmaptype thing is still deftemplate, but I seem to be the only person |
| 14:36 | joshua-choi | What *is* defmaptype? This seems to be a very new development |
| 14:37 | rhickey | fogus: in support of defmaptype? |
| 14:37 | drewr | fogus: that makes me think of something metasyntactic, not a datastructure |
| 14:37 | dnolen | joshua-choi: creating a datatype that acts like a map is a big pain. so rhickey making it easier for us by providing some that's easy for us to extend that already has that functionality. |
| 14:38 | joshua-choi | dnolen: As a shortcut for (deftype Type [...] clojure.lang.IPersistentMap ...)? |
| 14:38 | drewr | joshua-choi: yes, but also to have a more generic deftype behind it I think |
| 14:39 | fogus | dnolen: Not using the IPersistentMap magic is the hard part correct? |
| 14:39 | fogus | rhickey: In place of defmaptype |
| 14:39 | joshua-choi | drewr: Could you elaborate on "more generic deftype"? |
| 14:40 | rhickey | fogus: I'm confused |
| 14:41 | rhickey | ignoring the deftemplate in contrib? |
| 14:41 | fogus | rhickey: Are contrib names off-limits? |
| 14:41 | hugod | defmapped |
| 14:41 | dnolen | joshua-choi: I think clojure.lang.IPersistentMap is a lot for anyone to implement (I should read the irc backlogs more closely) just to get map-like behavior. |
| 14:41 | rhickey | I'm just trying to understand your proposal, given that you just linked to contrib deftemplate |
| 14:42 | astoddard | What about spec-datatype or add-datamap? To avoid def def- confusion. |
| 14:42 | drewr | joshua-choi: I described it backwards; you were essentially correct in your estimation |
| 14:43 | joshua-choi | rhickey: No, I wasn't proposing anything. If you're talking to me. :P I was confused. I was referring to clojure.core/doall, doseq, etc. vs. clojure.template/do-template, which has a hyphen. |
| 14:43 | rhickey | joshua-choi: sorry, no, fogus |
| 14:43 | fogus | rhickey: I see. The link was meant for joshua-choi but reminded me that my proposal last week of using the name deftemplate in place of defmaptype was met with silence. I'm not trying to link the contrib macro with defmaptypes |
| 14:43 | clojurebot | contrib is http://github.com/richhickey/clojure-contrib/tree/master |
| 14:44 | rhickey | fogus: ok. I don't see the map variant as a template |
| 14:45 | joshua-choi | Why did clojurebot talk again? What prompted it? |
| 14:45 | rhickey | interface-type, data-type, map-type |
| 14:45 | fogus | rhickey: The etymology of deftemplate goes back to my knowledge of the "similar" CLIPS construct. |
| 14:46 | drewr | as an app-level user, I'd rather definterface/deftype/defmap |
| 14:46 | drewr | I know you want some separation from those, but I think it would be confusing |
| 14:47 | chouser | interface-spec, data-spec, map-spec |
| 14:47 | rhickey | fogus: ah |
| 14:47 | chouser | that conflates or overloads the "specifying" with the "specification" |
| 14:47 | rhickey | template has taken on a lot of baggage since then |
| 14:48 | fogus | rhickey: yes. That is very true |
| 14:49 | dnolen | spec seems weird to me, but that's just my experience, make me think of testing frameworks. |
| 14:50 | rhickey | in any case, template begs the question, template for a what? |
| 14:50 | rhickey | defmaptemplate |
| 14:51 | fogus | That was my thought |
| 14:54 | astoddard | Are the "def" (or whatever is better) versions of the names going to be macros like defn is for def fn? |
| 15:03 | Licenser | cooookies! |
| 15:16 | powr-toc | Hey... just started using labrepl, under netbeans on Windows and it looks like clojure-1.2.0-SNAPSHOT is not downloaded in the dependencies... any idea why? |
| 15:16 | powr-toc | I can't see it in build.clojure.org/releases |
| 15:17 | kotarak | powr-toc: it's in build.clojure.org/snapshots |
| 15:34 | powr-toc | kotarak: we're doing a clojure workshop just now... one of the guys on windows is having some problems... For some reason his labrepl doesn't seem to have any css applied to its pages etc... |
| 15:34 | powr-toc | also he doesn't see any code snippets |
| 15:35 | rhickey_ | powr-toc: that would be due to no css - how is he running it? |
| 15:35 | defn | my labrepl works fine |
| 15:35 | rhickey_ | powr-toc: e.g. in what environment? |
| 15:35 | defn | *(im not on netbeans + windows, though) |
| 15:37 | rhickey_ | if he's on Netbeans he needs the latest enclojure plugin: http://github.com/downloads/EricThorsen/enclojure/enclojure-plugin-2010-23-mar.nbm |
| 15:37 | rhickey_ | that fixes an issue where the project repl did not get the project dir as the working directory, causing exactly what you describe |
| 15:39 | TakeV | Huh, enclojure updated? |
| 15:40 | powr-toc | hey rich |
| 15:41 | rhickey_ | powr-toc: yes? |
| 15:41 | powr-toc | he's on windows 7, but it turns out he didn't download the latest version of enclojure, because he had it already |
| 15:42 | powr-toc | Also we had some problems under both windows and ubuntu with enclojure/netbeans... nbgit seemed to struggle cloning the github repo |
| 15:42 | powr-toc | it failed with an auth error |
| 15:42 | powr-toc | so we had to git clone it ourselves |
| 15:45 | cemerick | powr-toc: in my experience, nbgit is rubbish, unfortunately. |
| 15:45 | Licenser | good freif |
| 15:45 | cemerick | I hear that NetBeans will have git support baked in sometime soonish, but who knows |
| 15:46 | cemerick | cmd line + gitx is a pretty killer combo in the meantime |
| 15:48 | cemerick | rhickey_: do you have any pointers to materials discussing approaches to "porting" (reimagining?) mutable data structures to a persistent form? |
| 15:49 | rhickey_ | cemerick: heh, no |
| 15:49 | cemerick | I figured. :-) |
| 15:50 | rhickey_ | there is some generic technique described in "Making data structures persistent" Tarjan et al |
| 15:50 | cemerick | So much literature out there, describing good stuff, all semi-taboo now that I know what it's like to not deal with mutability. |
| 15:50 | defn | hmmm i found something that's not working in labrepl -- just something small -- on 'its_all_data.clj' the (code (quote println)) is actually displayed as 'println in the rendered page -- where i assume it should be (quote println). i'm looking at labrepl/util.clj but my macro foo is not strong enough to know how to fix this one. if anyone has a minute and wants to take a look thatd be cool: http://github.com/relevance/labrepl/blob/master/src/labrepl/util.clj# |
| 15:51 | defn | (did all of that come through or did it get cut off?) |
| 15:51 | defn | http://github.com/relevance/labrepl/blob/master/src/labs/its_all_data.clj#L51 |
| 15:51 | defn | that's the (code (quote println)) |
| 15:51 | rhickey_ | cemerick: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.133.4630 |
| 15:51 | rhickey_ | cemerick: but I rejected that technique |
| 16:00 | chouser | after the reader's done, there's no way to differentiate between (quote foo) and 'foo |
| 16:03 | defn | chouser: interesting |
| 16:03 | chouser | that's true generally of reader macros, actually |
| 16:04 | chouser | ,'#() |
| 16:04 | clojurebot | (fn* [] ()) |
| 16:04 | chouser | ,'(fn* [] ()) |
| 16:04 | clojurebot | (fn* [] ()) |
| 16:04 | arohner | is there a version of nth that counts from the end of the list, or do I have to do (nth (- (count list) x) list)? |
| 16:05 | drewr | hugod: I'm finding that as I encounter breakpoints, my swank thread count goes up but never down |
| 16:05 | defn | chouser: so in this instance the best way to deal with it would just be to not run it through any (code (...)) whatsoever and just print it out in HTML? |
| 16:06 | hugod | drewr: nested breakpoints? how are you counting threads? |
| 16:06 | chouser | defn: I don't know enough about what laprepl is doing there to answer that |
| 16:06 | defn | http://github.com/relevance/labrepl/blob/master/src/labrepl/util.clj#L25 && http://github.com/relevance/labrepl/blob/master/src/labs/its_all_data.clj#L51 |
| 16:07 | rhickey | chouser: ever look at: http://functionaljava.googlecode.com/svn/artifacts/2.22/javadoc/index.html ? |
| 16:08 | rhickey | erm, http://functionaljava.googlecode.com/svn/artifacts/2.22/javadoc/fj/data/fingertrees/package-summary.html |
| 16:09 | drewr | hugod: I mean the execution threads that swank fires off |
| 16:09 | chouser | rhickey: ha! no, I hadn't. |
| 16:09 | chouser | defn: perhaps |
| 16:10 | chouser | defn: perhaps 'code' should optionaly take a string instead of a form? |
| 16:10 | drewr | hugod: it should tell you in your modeline |
| 16:11 | defn | chouser: like a multimethod maybe? |
| 16:11 | lancepantz | if i read a java properties file within a jetty webapp, will it reopen the file for every connection? |
| 16:12 | drewr | hugod: that may have been because I was killing sldb windows out of frustration though |
| 16:12 | drewr | no, it was from sldb-inspect-in-frame |
| 16:12 | drewr | which doesn't seem to work |
| 16:14 | drewr | hugod: how recent of a slime version do I need? |
| 16:14 | drewr | mine's probably a couple months old |
| 16:14 | hugod | drewr: you see locals? |
| 16:14 | hugod | anything from elpa to head |
| 16:14 | drewr | ah, hadn't hit return yet |
| 16:14 | drewr | I was doing eval-in-frame |
| 16:15 | drewr | and typing the binding name |
| 16:15 | hugod | just typing the local symbol should work |
| 16:19 | maxhodak | is it possible to do (partial (new myclass)) ? |
| 16:20 | hiredman | nope |
| 16:20 | hugod | drewr: woops, eval-in-frame doesn't seem to work -thanks |
| 16:20 | chouser | no, but you can do #(new myclass %) |
| 16:20 | hugod | drewr: the locals should be available at the repl, and through inspection of the first stack frame |
| 16:20 | maxhodak | chouser: i want to do something like `(new ~myclass anotherclass) |
| 16:21 | maxhodak | but anotherclass isn't in scope inside the quote, and ~anotherclass give me "print-dup not defined" |
| 16:21 | chouser | maxhodak: this is in a macro? |
| 16:21 | maxhodak | chouser: yes |
| 16:22 | maxhodak | er no |
| 16:22 | chouser | rhickey: I'm not sure they make 9-sided coins. |
| 16:22 | hiredman | 1d9 |
| 16:22 | clojurebot | 7 |
| 16:22 | maxhodak | chouser: its not in a macro; i'm using *gasp* eval |
| 16:22 | technomancy | hugod: did you post a writeup of swank break yet? |
| 16:22 | hiredman | :D |
| 16:22 | esj | rhickey, you could use the 'Universe Splitter' app on the iPhone and go with all of them ! |
| 16:23 | hugod | technomancy: not yet... - it might solve some questions |
| 16:23 | rhickey | I'm not loving datatype for the base version, as map types are for plain data IMO |
| 16:24 | drewr | hugod: I think I've got the hang of it, though if something goes awry, the errant sldb never dies and swank keeps accruing threads |
| 16:24 | drewr | I can try to track that down |
| 16:24 | chouser | the base version is techincally more general, so: deftype and defmaptype ? |
| 16:24 | chouser | plus or minus "def" |
| 16:24 | rhickey | chouser: yes, those are the current, unloved, leaders |
| 16:25 | drewr | s/defmaptype/defmap/ and you have a winner |
| 16:25 | hugod | drewr: exceptions are nested - you should have restart to go back to the previous level - I'm not sure "thread" is the correct terminology here... |
| 16:25 | Chousuke | that kind of implies defining a map instance :/ |
| 16:26 | drewr | Chousuke: how so? defmap isn't anything like hash-map or sorted-map |
| 16:27 | drewr | hugod: ok, yes, it works if I remember to hit 1 instead of 0, but I would think a QUIT should completely kill the sldb session |
| 16:27 | chouser | drewr: you're not defining a map, but a thing that describes a whole class of maps. |
| 16:28 | chouser | optionally replace the word "class" there with: category, kind, type... :-) |
| 16:28 | rhickey | deftype and deftype-map |
| 16:28 | drewr | couldn't that argument be made about defstruct? |
| 16:29 | chouser | defstruct has a few naming problems IMO. :-) |
| 16:29 | hiredman | (deflineage ...) |
| 16:29 | hugod | drewr: you should have the option to do either (QUIT to the top level, ABORT to the previous level) |
| 16:30 | drewr | hugod: I do, but QUIT leaves a lingering execution thread |
| 16:31 | drewr | chouser: in that case, I vote for deftype/deftypem |
| 16:32 | chouser | (deftype Foo [a b] :as this :automap true) |
| 16:32 | chouser | ew, scratch that |
| 16:32 | chouser | or rather have 'true' be the default |
| 16:33 | hugod | drewr: then that's a bug - could you tell me how to reproduce it |
| 16:33 | dnolen | I vote datatype, maptype, protocol, interface. a clear, uncommon, succinct set of names, doesn't add more def stuff (a conceptual break), easy on the eyes. |
| 16:34 | drewr | hugod: invoke a break, : foo RET q, then you should see in your modeline your slime execution count incremented |
| 16:35 | chouser | map maptype mapcat -- which is a pure function that returns a seq and which defines a new namespace-global type name? |
| 16:36 | dnolen | considering I don't even know mapcat very well, I wouldn't get confused about maptype, what could that possibly mean? |
| 16:36 | dnolen | as fn operation I mean. |
| 16:36 | hugod | drewr: that gives me sldb buffer with a sldb[2] indicating a nested exception - pressing 0 closes the buffer and takes me back to the repl |
| 16:37 | chouser | maybe it takes a dataype name and seq of regular maps, and returns a seq of instaces of the dataype. :-) |
| 16:37 | drewr | hugod: I think you'll only see what I'm talking about if you are working from a source file |
| 16:37 | drewr | the modeline for the repl doesn't have it |
| 16:40 | dnolen | chouser: not likely :) I generally expect Clojure to be fairly obvious. maptype sounds special, especially since there's only one other name with the word type in it. datatype. |
| 16:41 | chouser | ,(type 5) |
| 16:41 | clojurebot | java.lang.Integer |
| 16:41 | dnolen | and that makes conceptual sense. |
| 16:41 | dnolen | ,(maptype [1 "foo" :bar}]) |
| 16:41 | clojurebot | Unmatched delimiter: } |
| 16:42 | dnolen | I don't think that'll be a very common thing to try :) |
| 16:43 | dnolen | ,(map type [1 "foo" :bar]) |
| 16:43 | clojurebot | (java.lang.Integer java.lang.String clojure.lang.Keyword) |
| 16:44 | chouser | my point in comparing map maptype and mapcat though is mostly about how their names all look like regular pure functions. |
| 16:44 | dnolen | But Clojure has 11 special forms, there really no way to distinguish between special forms and pure functions. |
| 16:44 | chouser | as I said before, if we're sure we're never going to want regular pure functions named protocol or interface or maptype, I'm sure we would all get used to those defining namespace-global names. |
| 16:45 | dnolen | for example I keep trying to use "and" as a pure function. |
| 16:45 | cemerick | rhickey: it's hard to not cringe @ the Driscoll et al. in a world that has Okasaki & Huet |
| 16:45 | drewr | hugod: http://img.skitch.com/20100330-f1fbxt918y1iwcw41jy5685etk.jpg |
| 16:45 | hugod | drewr: can't miss that arrow :-) |
| 16:45 | drewr | what arrow??? |
| 16:46 | drewr | skitch ftw :-) |
| 16:46 | dnolen | chouser: couldn't we just use protocol/protocol* in that case? |
| 16:47 | chouser | dnolen: which one means what though? * carries very little meaning, except the general implication you might want to avoid calling it. |
| 16:47 | chouser | s/general/vague/ |
| 16:49 | hugod | drewr: its leaking sldb buffers, the number of threads is stable |
| 16:52 | drewr | hugod: if I type (Thread/sleep 5000) and hit C-x C-e twice, that number increments by two |
| 16:53 | drewr | are those not threads of execution? |
| 16:53 | dnolen | chouser: I supposed mostly concerned with the addition for 4 new def(things). I'm more afraid of some new to Clojure wondering whether they should deftype, defmaptype, defstruct, defprotocol, definterface. when really they should just be using maps. But perhaps this really isn't a valid concern. |
| 16:53 | kylesmith | So I'm still trying to get emacs working with clojure. I removed all the system-wide paths to slime (in favor of technomancy's github version), but now emacs is complaining about slime-fancy. Any ideas? |
| 16:54 | chouser | dnolen: I'm not sure that choosing different names does anything to reduce that concern. :-) |
| 16:54 | drewr | dnolen: they'll need to learn what each thing does anyway; I like using def because it communicates something declarative and top-level |
| 16:54 | drewr | although I just realized that ns isn't defns |
| 16:54 | drewr | so maybe I shouldn't care |
| 16:57 | hugod | drewr: I don't think so - slime-list-threads doesn't show any changes |
| 17:01 | drewr | hugod: ah, ok, that number is overloaded then, because: http://img.skitch.com/20100330-nf3h4hrxc1nhm8wjm731p364ws.jpg |
| 17:04 | kylesmith | Can somebody tell me again why swank-clojure-autoload was deprecated? All I wanted to do was update my emacs setup to get a bugfix, and now everything's changed so much that I can't get it to work. |
| 17:06 | dnolen | kylesmith: technomancy's slime unfortunately removes support for other lisps, you need to add those files back from that commit of slime. |
| 17:06 | hugod | drewr: the number is (length (slime-rex-continuations slime-default-connection)) |
| 17:07 | dnolen | kylesmith: for what it's worth this problem should soon be over. hugod's work make's swank-clojure work with SLIME master again. |
| 17:08 | hugod | drewr: so continuations aren't being handled properly |
| 17:08 | drewr | hugod: interesting, thanks for tracking that down |
| 17:08 | technomancy | kylesmith: the old installation method was very complicated and error-prone; the new one is automated and causes way fewer problems. |
| 17:08 | kylesmith | Ok. When is that expected to be finished? |
| 17:09 | hugod | kylesmith: current 1.2-SNAPSHOT should work with slime head |
| 17:09 | hugod | unless you are using slime-autodoc |
| 17:09 | kylesmith | great! can you give me a link, please? |
| 17:10 | hugod | in which case you will need the changes in the autodoc branch |
| 17:10 | hugod | kylesmith: clojars or technomancy's repo on github |
| 17:11 | TakeV | Is there a standard guide for getting SLIME and swank-clojure working with Emacs 23? Because I can't get it working. >_> |
| 17:11 | kylesmith | So use technomancy's repo of swank-clojure with cvs version of slime? |
| 17:12 | lithpr | TakeV, i strongly recommend using the "Emacs Starter Kit" if you are new to emacs. |
| 17:13 | technomancy | TakeV: the swank-clojure readme is pretty comprehensive |
| 17:13 | TakeV | lithpr: Alright, thanks. |
| 17:13 | lithpr | It comes with elpa and a bunch of packages that are very useful. You can get clojure-mode, clojure-test-mode, swank-clojure, etc |
| 17:13 | lithpr | from elpa |
| 17:13 | hugod | kylesmith: I'm using 2010-03-10 - let me know if you have issues |
| 17:17 | lithpr | TakeV: http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/ |
| 17:17 | kylesmith | Well, I can get to inferior-lisp, but I have to add this to my .emacs (add-to-list 'slime-lisp-implementations `(clojure ,(swank-clojure-cmd))) |
| 17:17 | TakeV | lithpr: That's what I was doing before, but it didn't work. |
| 17:18 | lithpr | oic |
| 17:18 | kylesmith | otherwise, I just get "no such file or directory, lisp" |
| 17:19 | lithpr | TakeV: still take a look at his .emacs on that page. some good stuff there :) |
| 17:19 | TakeV | Sure. |
| 17:22 | lithpr | TakeV: one last tip that wasn't immediately obvious to me. To customize your setup in ESK, you can make a [username].el in your .emacs.d dir |
| 17:22 | Crowb4r | Anyone here made a rather large gui app in clojure? |
| 17:22 | lithpr | instead of an .emacs in your home dir |
| 17:22 | kylesmith | hugod: This might be a dumb question, but when you said 1.2-SNAPSHOT, was that referring to clojure, or slime/swank-clojure, etc? |
| 17:23 | lithpr | cemerick has |
| 17:23 | cemerick | I've what? |
| 17:23 | hugod | kylesmith: swank-clojure |
| 17:23 | Crowb4r | made a gui app in clojure |
| 17:23 | cemerick | Crowb4r: oh, sure |
| 17:23 | cemerick | Used the NetBeans Platform, FWIW. |
| 17:25 | kylesmith | hugod: Ok, I'm on that version, but I'm still getting a file not found exception for swank/swank.clj |
| 17:25 | kylesmith | which path is swank.clj supposed to be on? |
| 17:26 | Crowb4r | cemerick: Iwas about to ask about netbeans. So that answers that question. I'm just trying to see how some small app development in clojure goes and getting it to a exe with launch4j |
| 17:27 | tomoj | kylesmith: you shouldn't have to worry about swank.clj... |
| 17:28 | hugod | kylesmith: you might find that swank-clojure-project is a useful way to start the repl |
| 17:28 | tomoj | oh, maybe you should if you're doing something weird I didn't read about above :) |
| 17:28 | TakeV | Hmm, the instructions for the emacs-starter-kit don't seem to be working. |
| 17:29 | TakeV | Clone the git repo into ~/.emacs.d, right? |
| 17:29 | rhickey | cemerick: yes, but even Okasaki is challenged in sticking with purely functional implementation - Clojure's persistent data structures don't, and that's a key to making them fast |
| 17:30 | cemerick | Crowb4r: NB has its own launcher, FWIW. It's not the best I've used, but is perfectly servicable. |
| 17:32 | kylesmith | swank-clojure-project gives me "wrong argument type: Stringp, nil" |
| 17:32 | Crowb4r | cemerick: Ahh thanks |
| 17:33 | Crowb4r | cemerick: I was thinking of writing a simple car maintaince application and stuffing it as an exe on windows. |
| 17:33 | cemerick | Crowb4r: all in one file, you mean? |
| 17:34 | Crowb4r | cemerick: No I meant convert the jar to a .exe |
| 17:34 | Crowb4r | after I write it |
| 17:34 | Crowb4r | I should have been specific with stuff it |
| 17:34 | cemerick | Crowb4r: right, well, that's not the easiest thing to do with an NBRCP app. The installation is a dir, with a pile of jars (modules), and a launcher. |
| 17:35 | cemerick | A proper installer can put a single icon in the start menu linked to the launcher, for the same user experience. |
| 17:35 | cemerick | There are tools (like jsmooth, and others I've forgotten about) that will take a pile of jars, a main entry point, and emit an .exe |
| 17:36 | cemerick | rhickey: yeah...I was about to go hunting for the clojure widget that supports mutable fields :-P |
| 17:36 | Crowb4r | cemerick: launch4j seems to be pretty active. |
| 17:36 | cemerick | I've not used that before, but sure. |
| 17:37 | Crowb4r | It's all an experiment. I will record the results and make a post about them if I finish it. |
| 17:38 | hugod | kylesmith: something might have changed since the version I'm using. have a look at the emacs backtrace. |
| 17:39 | kylesmith | I honestly don't understand what I'm doing wrong here. I have 1.2-SNAPSHOT of swank-clojure and slime master. I haven't customized anything. |
| 17:39 | Crowb4r | I really like the language a lot and just want to see what it can be used to develop. So thanks for the help cemerick. |
| 17:42 | hugod | kylesmith: you have a need for slime cvs head? the elpa version and instructions are much simpler... |
| 17:43 | kylesmith | I tried the elpa version, and it complained some gibberish about slime-fancy |
| 17:43 | kylesmith | here's where I'm at now http://paste.lisp.org/display/97104 |
| 17:46 | kylesmith | "swank-clojure.el:47:1:Error: Cannot open load file: slime-fancy" |
| 17:46 | hugod | drewr: should be fixed now - thanks for the debugging |
| 17:47 | kylesmith | That's what happens when I follow the elpa directions exactly. |
| 17:49 | quidnunc | Is there a non-raw SQL library in clojure? Something like an ORM? |
| 17:50 | hugod | kylesmith: the protocol version identifies that as slime head, not elpa - I suggest you remove slime head, restart emacs, and try the elpa route again |
| 17:50 | kotarak | quidnunc: clojureql, but it's in heavy flux right now |
| 17:50 | lithpr | inc hugod |
| 17:51 | quidnunc | kotarak: Thank you |
| 17:51 | kotarak | quidnunc: beware: *heavy* flux |
| 17:52 | quidnunc | kotarak: Noted, thanks. |
| 17:52 | kylesmith | hugod: that pastebin was from slime-head. The last two things I posted were from my attempt at elpa. I wanted to show that I've tried installing it both ways. |
| 17:53 | kylesmith | I just noticed the version of slime in my elpa is 20091016. How do I get 2010-03-10? |
| 17:53 | tomoj | looks like that's not in elpa yet |
| 17:54 | kylesmith | Ack, how convenient |
| 17:54 | lithpr | i would mention that i've had nothing but success using 20091016. Other people have gone through hell trying to get other versions to work. |
| 17:54 | lithpr | fwiw |
| 17:55 | tomoj | I've been using 20091016 as well, but dunno what I'm missing |
| 17:55 | lithpr | tomoj: (=) |
| 17:56 | technomancy | kylesmith: you've got some old config somewhere that's assuming you're using slime trunk. you need to remove it to use elpa slime. |
| 17:57 | kylesmith | I thought I did that already, but let me double check. |
| 17:57 | lithpr | kylesmith: if technomancy suggests something re: emacs, definitely do it :) |
| 17:57 | technomancy | could be apt-get slime |
| 18:00 | kylesmith | Well, that's the thing. slime is actually installed via apt-get (and my sysadmin says it has to stay for various reasons). So, I did C-h v load-path and removed all references to slime in my .emacs, before elpa loads. Are there paths other than load-path that my system-wide slime could still be under? |
| 18:04 | kylesmith | I can confirm that after installing slime through elpa, C-h v load-path contains only references to the elpa version of slime. |
| 18:07 | technomancy | are you calling clojure-slime-config? that's deprecated. |
| 18:07 | kylesmith | nope |
| 18:08 | shales | How should I remove an item from the middle of a vector? so far I'm doing this: |
| 18:08 | technomancy | that's the only place from elpa that slime-fancy is mentioned, so it must be coming from outside an elpa package |
| 18:08 | shales | ,(let [v [0 1 2 3] i 2] (apply conj (subvec v 0 i) (nthnext v (inc i)))) |
| 18:08 | clojurebot | [0 1 3] |
| 18:10 | shales | Is there no better way? |
| 18:10 | kylesmith | Ok, I'll keep digging. |
| 18:14 | Associat0r | anyone here using clojure on .NET? |
| 18:15 | dakrone | shales: (concat (take 2 [0 1 2 3]) (drop 3 [0 1 2 3])) but that's not really pretty either |
| 18:32 | defn | (app :get [["hi [name #"fred|ethel|lucy"]] ["hello " name "!"] ["hi" _] "I don't talk to strangers."]) |
| 18:32 | defn | i find that pretty confusing -- am i alone? |
| 18:33 | defn | don't answer that -- i just find the syntactic sugar used in that example to be complicate things more than just using the regular syntax |
| 18:34 | defn | s/be// |
| 18:39 | dnolen | defn: personally I like it and find it easy to read, but printed in IRC you lose the proper formatting. |
| 18:40 | fanatico | and if you're not familiar with pattern matching, it may be a little foreign. |
| 18:40 | fanatico | but I thought it was a very cool example. |
| 18:42 | defn | yeah i think i was just maybe initially a little shocked by it |
| 18:43 | defn | but i already used it :) |
| 18:44 | defn | (def my-app (app [#".*" &] {:get "every route!"})) |
| 18:44 | defn | that's pretty cool |
| 19:00 | Licenser | heya defn how is walton going? |
| 19:03 | defn | Licenser: I haven't played with it much -- I've been working on a little geoip thingamajig that I haven't put up yet |
| 19:04 | SynrG | /win 5 |
| 19:04 | defn | Licenser: Well I'm sort of tangentially working on it |
| 19:04 | SynrG | ups |
| 19:05 | defn | Licenser: I'm building a little enlive + moustache front end for walton -- then im going to let it run overnight on (ns-publics) and have a little website with examples setup |
| 19:05 | Licenser | defn: very nice! |
| 19:05 | Licenser | SynrG: irssi? |
| 19:05 | defn | Licenser: Finally I'd like to use solr or something and make a little clojure example search thing |
| 19:07 | Licenser | defn: you could use an irc bot to feed the data dynamically to walton, instead of one shot parsing the data |
| 19:11 | underdev | defn, that would be great |
| 19:44 | SynrG | Licenser: yah. i habitually use /win instead of alt keys because they can be typed offline on the bus and will be buffered (even though i'm not presently on the bus) |
| 19:44 | Licenser | ^^ |
| 19:53 | raek | is all expressions in clojure compiled? (I know fns are...) |
| 19:53 | raek | i.e., if I eval (+ 1 2 3), will it be compiled first? |
| 19:54 | Licenser | raek: I think (with a big note on think) not |
| 19:55 | arohner | raek, Licenser: no, it is |
| 19:55 | arohner | clojure doesn't have an interpreter |
| 19:56 | underdev | raek: I think (witha big note on think) yes. I seem to remember that clojure... |
| 19:56 | arohner | it compiles every expression to classes, then runs those |
| 19:56 | underdev | rt, no interpreter |
| 19:56 | underdev | arohner: doesn't that make the answer yes? |
| 19:56 | arohner | underdev: yes, everything is compiled |
| 19:57 | raek | ah, I suspected so... |
| 19:57 | raek | otherwise, there had to be a interpreter too |
| 19:57 | underdev | oic, "no, it is" |
| 19:58 | underdev | "no, its not not compiled, it is compiled" |
| 19:58 | arohner | sorry, that could have been more clear |
| 19:58 | erikcw1 | I'm trying to figure out how to debug a function in Emacs/Swank that keeps throwing a NullPointerException. I've looked though the stacktrace, and non of it seems very helpful. How can I figure out where this exception is being thrown? |
| 19:58 | underdev | i was confused, you were not confusing |
| 19:58 | arohner | erikcw1: I normally look for the last line in the stacktrace that comes from my code |
| 19:59 | arohner | actually, it's a little more complicated than that |
| 19:59 | arohner | 1 |
| 19:59 | arohner | 1) find the root exception, this is the lowest section that says "caused by" in the stack trace |
| 20:00 | arohner | once you're there, find the last line that comes from your code. this is the highest line in the root exception that has your_file_name.clj next to it |
| 20:00 | arohner | look at that line |
| 20:00 | arohner | that probably wasn't clear either. |
| 20:01 | arohner | erikcw1: does that make sense? |
| 20:01 | arohner | oh right, you're in slime. keep hitting 0 to get the cause of the exception until you can't anymore |
| 20:01 | arohner | then look at the highest line in the stack trace that contains your code |
| 20:03 | raek | arohner: isn't 0 abort? |
| 20:04 | arohner | raek: I don't remember off the top of my head. whichever says 'cause' |
| 20:05 | alexyk | how do you unzip a sequence of pairs [x y] into two seqs, firsts and seconds, in one fell swoop? |
| 20:08 | arohner | alexyk: does it have to be in one pass? |
| 20:08 | arohner | [(map first s) (map second s)] is pretty straight forward |
| 20:09 | alexyk | arohner: yeah, I kinda hoped for an stdlib unzip or some such |
| 20:09 | alexyk | the idea of two passes vaguely annoys me |
| 20:10 | arohner | alexyk: I don't think there's a std one yet. you can build it using reduce |
| 20:11 | alexyk | arohner: yep... |
| 20:14 | drocko | Hello |
| 20:16 | erikcw1 | arohner: I don't see "cause/caused" by anywhere http://pastebin.com/B1CDw3Zk |
| 20:16 | drocko | I need a little bit of guidance. I have several items that I am representing as structs in a list. I store this list as a ref as it's pretty much the only mutable part of what i'm doing. Adding items from the list is pretty easy. What is the best way to modify structs in the list? |
| 20:16 | drocko | also which sort of list should I use? I am unsure |
| 20:17 | raek | drocko: have you used assoc-in and update-in? |
| 20:17 | drocko | raek: I have not. I shall look these up. |
| 20:17 | drocko | raek: any tips on what sort of thing I should make this list into? |
| 20:18 | raek | ,(assoc-in [{:foo "xyz"} {:foo "ijk"}] [1 :foo] "abc") |
| 20:18 | clojurebot | [{:foo "xyz"} {:foo "abc"}] |
| 20:18 | raek | drocko: that depends on what you need to do with it |
| 20:19 | arohner | erikcw1: ah, you're using eval region. if this is a multiline expression, try putting it in a function, load the function with C-c C-l (load file), and then run the function |
| 20:19 | arohner | erikcw1: I basically only use C-c C-l, and the repl |
| 20:19 | raek | vectors have fast random access with indices |
| 20:19 | arohner | sorry, got to run |
| 20:20 | drocko | right. i guess it sort of depends on how i want to build and manage this piece of data |
| 20:20 | drocko | ah the terminology is kind of loaded |
| 20:21 | drocko | like if i say list, hash, collection, or set they all mean different things! |
| 20:22 | drocko | raek: I think you have given me the clues i needed. Thanks! |
| 20:23 | raek | drocko: some sources of info: http://clojure.org/data_structures and http://clojure.blip.tv/file/707974/ |
| 20:24 | drocko | cool thanks! |
| 20:24 | raek | need to sleep now... (02:24) bye! |
| 22:05 | lithpr | how do you negate a regexp in clojure? |
| 22:07 | wooby | lithpr, same as you would in java, which is i think with ?! |
| 22:08 | lithpr | okay, didn't check with java docs... thrown off that the whole thing has to be in quotes... |
| 22:09 | joshua-choi | There was actually a little discussion back in the day, before Clojure 1.0, about those regex quotes... |
| 22:09 | lithpr | i guess i could just use a function to negate... for now... |
| 22:15 | lithpr | and by willing, i mean "capable" |
| 22:21 | chouser | lithpr: new compared to what? |
| 22:22 | lithpr | tcl, perl, ruby... |
| 22:23 | lithpr | its always worth the effort... just not tonight... |
| 22:24 | joshua-choi | lithpr: Java regex syntax is very similar to Perl's. I can't remember any differences, but there is a section in Pattern's Java docs. |
| 22:25 | lithpr | since you can't negate outside of the quotes, it's different |
| 22:25 | lithpr | again, all my bad, nm, i'll do the legwork :) |
| 22:28 | lithpr | its not like wrapping a not around a function is difficult |
| 22:52 | Crowb4r | Anyone play with Conjure a all? |
| 22:53 | Raynes | I don't use anything that has 'jure' at the end except Clojure. |
| 22:56 | cemerick | Crowb4r: this is the web framework? |
| 22:56 | cemerick | huh, it's grown some |
| 23:12 | Blackfoot | has anyone gone through Lau Jensen's tutorial on hadoop? |
| 23:23 | ztellman | does reify have a 'this' reference? |
| 23:24 | ztellman | nm, just re-read the docstring |
| 23:24 | carkh | (reify :as this AProt .... |
| 23:55 | mcburton | hey all, i'm new to clojure and have an idiomatic question: I'm looking to generate a sequence of vectors w/ random int pairs ([1 3][1 4]...) and I'm having difficulty making a lazy sequence. |
| 23:55 | mcburton | i tried something like this: (def random-ints (repeatedly #(vector((rand-int 100)(rand-int 100))))) and then used (take 4 random-ints) |
| 23:56 | hiredman | def like that will hang on to the head |
| 23:56 | mcburton | but there is something wrong with my anonymous function that I can't figure out |
| 23:57 | mcburton | hiredman: right, I can wrap the taake |
| 23:57 | hiredman | you have too many parens |
| 23:57 | mcburton | but but right now i can't even get it to run |
| 23:57 | hiredman | "wrap the take"? |
| 23:58 | mcburton | ah |
| 23:59 | mcburton | (defn wrapper [n func] (take n (repeatedly func))) |
| 23:59 | mcburton | should solve head problem yes? |
| 23:59 | mcburton | where func is (vector (rand-int 10) (rand-int 10)) |
| 23:59 | hiredman | sure |
| 23:59 | hiredman | that will not work |