#clojure log - Dec 29 2008

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:01 ericlavigne: gnuvince: I used "Head First Java" as a Java intro book. It is easy to read quickly and does a good job covering the basics.

0:02 gnuvince: Java in a Nutshell is another good option.

0:04 kabny: Thinking in Java

0:05 thats what ill start reading tomorrow

0:05 dont know who it targets though

0:18 gnuvince: I heard good things about Head First Java

0:18 I just might check it out

0:23 rhickey: achim_p: ok, I've tracked down and removed that problem in svn 1186. With 1186, I can dx --dex clojure.jar with no errors. This should allow people looking to play with Android to proceed

0:27 Nafai: rhickey: Awesome!

0:27 I was having problems last week when I tried it :)

0:28 rhickey: Is there still the dynamic classloader issue though?

0:28 rhickey: Nafai: there may still be others, including missing runtime library support etc, but at least this gets past the bytecode translation issues

0:28 Nafai: Cool

0:28 I'll give it a try

0:28 I just need to figure out how to call a superclass method in an overriden method

0:29 Is 1186 in trunk?

0:30 rhickey: depends. There is still a dynamic loader but it won't be used if all code is AOT compiled. That may be good enough for Android. It isn't for applets, which disallow the construction of a custom classloader

0:30 yes

0:31 Nafai: check out the new :exposes-methods section of gen-class

0:31 Nafai: rhickey: Thanks

0:35 Now I need to write a ant task to compile clojure code

0:40 kabny: rhickey: If one would want to rewrite the compile-function, what exact stuff would one need to change?

0:41 rhickey: kabny: rewrite for what purpose?

0:42 kabny: fun

0:42 speed

0:43 im thinking for Android

0:43 hmm if it is efficient enough we should get an Android lib for contrib

0:44 rhickey: I don't understand - Android translates JVM bytecode, which is what Clojure generates

0:46 Nafai: Yeah

0:46 Clojure generates JVM bytecode

0:46 And then you use the Android tools to compile JVM bytecode into dalvik bytecode

0:46 And then that is packaged in an apk

0:48 Has anyone written any ant code to compile clj code?

0:49 Chouser: Nafai: I think so. have you searched the google group?

0:49 * Nafai looks

0:50 kabny: apk is rougly a .jar for Android?

0:50 Nafai: From what I understand, I believe so

1:05 replaca: rhickey: I added an issue to the google code issues list. Was that OK? I only noticed later that it was still your private sandbox.

1:11 Nafai: Anyone help me? http://paste.lisp.org/display/72771

1:12 I'm trying to figure out how to use :exposes-methods correctly

1:13 Chouser: Nafai: just a stab in the dark, but you might try moving your import block into the ns macro call.

1:14 (ns ...hello (:import (android...)) (:gen-clas ...))

1:14 Nafai: Hrm

1:14 Chouser: :gel-class with two s's of course

1:15 inertia-: what is the ETA for 1.0?

1:17 Nafai: Chouser: No luck: http://paste.lisp.org/display/72771#3

1:19 n/m

1:19 I'm silly :)

1:19 Chouser: oh?

1:19 oh

1:21 Nafai: How about this one? http://paste.lisp.org/display/72771#5

1:21 The code is right above that annotation

1:22 I'm not sure what to make of that error message

1:28 Chouser: hah, sweet. I just fixed the implementation of a method on an existing instance.

1:28 gnuvince: Just caught a message on the mailing list from a gentleman who wondered why there was no mod in Clojure (and I guess div too)

1:28 Chouser: knew it was possible, just hadn't ever done it yet.

1:29 gnuvince: Do you think this sort of change is minor enough that Rich wouldn't mind integrating them?

1:29 Nafai: Any idea on my last error message?

1:29 Chouser: gnuvince: he said a patch to add 'mod' is welcome.

1:30 gnuvince: http://groups.google.com/group/clojure/browse_thread/thread/f5d20852622430bd

1:31 Nafai: you're getting the error when you run (compile ...)?

1:31 Nafai: Chouser: Yessir

1:31 gnuvince: Chouser: I'm not a registered contributor

1:32 kabny: how big is the cache ina modern desktop computer?

1:32 gnuvince: kabny: CPU cache?

1:33 Chouser: gnuvince: it's easy to register, just send in your CA

1:33 Nafai: I've got a working example of :exposes-methods on a subclass of Thread now

1:33 Nafai: not seeing that error yet

1:34 kabny: yes

1:34 Nafai: Chouser: Am I using it the same as you?

1:34 replaca: Nafai: try :name HelloWorld ... :extends android.app.Activity

1:34 it shouldn't be strings

1:34 Chouser: Nafai: yes, but of course I don't have to import anything. I'm still suspicious about that part.

1:34 gnuvince: kabny: can't find the info for L1, but L2 is about 4MB according to Intel specs

1:35 L1 is probably in the KB range

1:36 32-64 KB is probably a good guess

1:36 Nafai: replaca: Still the same error

1:36 Chouser: Nafai: your code's messed up. you've got the 'defn' inside the 'ns' call now.

1:37 Nafai: Yeah, noticed that now :)

1:38 Okay, now it is complaining it can't find onCreateSuper

1:38 kabny: L1 and L2 are what? dualcore?

1:38 it is the data cache im wonmdering about whatever that is

1:38 Chouser: Nafai: good. Try (.onCreateSuper ...) instead (note leading dot)

1:38 Nafai: Am I using :exposes-methods right?

1:39 Sweet

1:39 So when I import something

1:40 Do I still have to refer to it's fully-qualified name?

1:40 Chouser: nope, that's the point of importing it.

1:40 I don't think it's right to have your namespace named differently from your gen-class

1:41 Nafai: What should it be?

1:41 Chouser: Nafai: what is (. setContentView tv) -- does that work?

1:43 Nafai: Well, it's not getting that far because it is complaining about TextView

1:43 setContentView is a superclassmethod

1:44 Chouser: ok, here's my best guess: http://paste.lisp.org/display/72771#6

1:45 that's got the namespace/classname/filename matching, the correct usage of :import in 'ns', and what may be the correct call to setContentView

1:45 kabny: is there no way to import a whole packaghe?

1:45 Chouser: kabny: correct

1:47 kabny: why not?

1:48 Nafai: Chouser: Okay, I had to use the fully-qualified name for Activity in :extends, because it thinks I'm wanting java.lang.Activity

1:48 And then I get this error:

1:48 kabny: it is fairly annoying if it is huge and you need most of them?

1:48 Nafai: http://paste.lisp.org/display/72771#7

1:48 (Thanks for all the help, btw)

1:50 Chouser: kabny: I believe importing all classes from a package has been described as a mis-feature.

1:50 kabny: personally, I dislike trying to make sense of code that include names brought in from unknown sources.

1:50 Clojure has this problem also (IMO) with the 'use' function.

1:51 Nafai: where's the extra ".hello." coming from?

1:51 Nafai: Chouser: I also added that, because that's the full package name

1:52 Chouser: Nafai: ok, and you've got it in the file path and the namespace name as well?

1:52 Nafai: and you have the value of *compile-path* in your classpath?

1:53 Nafai: Yes, I believe so

1:54 Chouser: Nafai: double-check it. That error looks like what I see when I forget to include ./classes in my classpath, or if that directory didn't exist when I started up the JVM.

1:54 Nafai: Ok

1:55 Chouser: you might also check that directory -- it seems likely you've got a buch of class files in there now.

1:57 Nafai: I didn't correctly, so I've fixed that now

1:57 Now I get this exception:

1:57 java.lang.Exception: namespace 'net.travishartwell.android.hello.HelloAndroid' not found after loading '/net/travishartwell/android/hello/HelloAndroid' (precompile.clj:0)

1:58 kabny: is there any need for use at all? why not take it away?

1:59 Chouser: kabny: others disagree with me, for one. But 'use' is ok with me as long as you name each thing you're bringing in using the :only or :rename options.

1:59 Nafai: you changed the name from HelloWorld, or is that some other class?

2:00 Nafai: Ah :)

2:00 Fixed that now

2:01 Sweet, it built!

2:01 Chouser: nice

2:01 well, I'm off to bed. Happy androiding.

2:01 kabny: congrats Nafai, post how you did on the google group ok?

2:02 Im gonna try to get it going tomorrow

2:02 Nafai: kabny: Sure will, in the morning :)

2:02 kabny: rhickey: would refs and agents work to translate to dex ?

2:02 ie if some of clojure works on android, do all then?

2:03 Chouser: kabny: I don't think refs and agents are likely to be a problem. Inside they're not using particularly unusual features of Java.

2:04 Nafai: "built" as in .class files, not all the way to android files (whatever they're called) right?

2:07 Nafai: Chouser: Nope, all the way :)

2:08 Chouser: oh, beautiful.

2:08 kabny: Chouser .dex

2:08 Nafai: Darn

2:08 Didn't quite work

2:09 When I run it in the emulator, I get a force close dialog

2:10 kabny: happens to me with java too though sometimes

2:10 dont quite know why yet

2:11 Nafai: Code that compiles: http://paste.lisp.org/display/72771#8

2:11 kabny: is a namespace in clojure the same as package in java?

2:11 Nafai: Error from Android:

2:11 http://paste.lisp.org/display/72771#9

2:12 Chouser: Nafai: you need the square-brackets in :exposes-methods?

2:12 Nafai: It compiled with them

2:12 I guess it's fine without them too

2:13 Chouser: don't use them -- it'll give you a runtime error, I think.

2:14 Nafai: Ok, trying again

2:15 Chouser: kabny: not quite -- every Clojure function is a Java class, and every Clojure namespace compiles to one or more Java classes.

2:15 kabny: a namespace foo.bar.baz will compile to a bunch of classes in a foo.bar Java package

2:16 ok, bed now, really. g'night!

2:31 fffej: I'm creating a map with (zipmap x y), but the order is random (because it's a hash map by default I guess) - what's the easiest way of creating a sorted map from the same data?

2:37 replaca: fffej: Do you mean sorted or ordered? (i.e, do you want to sort on the key or do you want a map that iterates in the same order as the original seqs?)

2:39 fffej: replaca: I think I've found the answer, I want something like (sort-by < (zipmap (range 1 100) foo)). I was after sorting on the keys

2:41 replaca: yeah, you can also use "sorted-map" here:

2:41 (into (sorted-map) (zip-map ...))

2:42 if you want to keep it in a map

2:42 *zip-map = zipmap

2:42 fffej: replaca: thanks, I didn't know about into - that looks the more "idiomatic" way to do things, so I'll use that, thanks

2:45 replaca: cool, enjoy

2:45 of course you could even you map here since you don't really need the map created by zipmap. But the map mechanism ends up being more tokens.

2:46 fffej: not sure what you mean there? could you give an example?

2:46 replaca: (into (sorted-map) (map #(vector %1 %2) (range 1 100) foo))

2:47 ... I think that does it ...

2:47 Lau_of_DK: Morning guys

2:48 replaca: It's Lau! That's my signal that it's bedtime!

2:48 fffej: looks like it does - is %1 and %2 shorthand for the two args? I've never seen the #(vector %1 %2) syntax before

2:48 replaca: Morning, Lau.

2:49 fffeg: yeah, that's shorthand for (fn [a b] (vector a b)), very nice for use with map and other quick lambdas

2:50 fffej: thanks replaca, I always seem to learn more here in 5 minutes than I do spending an hour just tottering around

2:51 Lau_of_DK: :)

2:51 replaca: no prob. I'm on the same road. :-)

2:53 eldok: what is the timecomplexity for insert/lookup in a sorted-map?

2:53 O(1) still?

2:53 replaca: Are clojure maps really O(1)? I think they're O(logN)

2:54 based on a functional implementation of red-black trees

2:55 oh no, that's just sorted maps

2:55 so, sorted maps are O(logN)

2:57 regular maps are O(1)

3:33 yangsx: Would it be reasonable to request re-pattern automatically escape the string?

3:46 Lau_of_DK: yangsx: Does it add/remove any options?

4:06 yangsx: Lau_of_DK: I ask because that would be easier for me to str some strings to be used in re-matches

4:07 or I'm forced to call Pattern.quote in my code

4:13 Lau_of_DK: ok, I guess you would want to talk with RSchulz when he gets in, he has good insights on regex/clojure

6:03 bOR_: remind me of the name of this function?: if it is a number, make it a (list num), if it is a list, just pass the list on.

6:03 thought we had this as a function already.

6:03 and good afternoon everyone :)

6:08 nevermind, I'll write something =)

6:10 kotarak: (condp instance? s Number (list s) IPersistentList s) (Not tested)

6:11 bOR_: ah. that brings me to a bigger problem. Not all functions are in the api.

6:11 I kept thinking I was missing functions in the clojure.org api page.

6:11 thanks for the help.

6:11 kotarak: condp is relatively recent...

6:13 bOR_: thought the api was auto-generated.

6:13 but good to remember.

6:14 kotarak: Hmm... maybe Rich has to push the "automatic generation" button manually? ;)

6:24 bOR_: ok. done for today with the clojure project, back to the previous one :)

8:45 achim_p: rhickey: thanks a lot for looking into the dx/bytecode issue!

8:46 rhickey: achim_p: sure - anyone have any luck so far?

10:42 mchurch: I have a question about exception-handling in Clojure. It seems that certain types of exceptions/errors break through try/catch. For example, (try (/ 1 0) (catch Exception e "FAIL")) => "FAIL", as it should, but if I blow the stack by defining (defn blow-stack [] (blow-stack)) and eval. (try (blow-stack) (catch Exception e "FAIL")) it does not return "FAIL", as it should.

10:42 Why is this, and is there any way to truly catch all error conditions (except possibly for OOM type stuff that nothing can catch)?

10:43 It seems like stack-blowing should not fall through a try-catch.

10:44 Chouser: mchurch: try catching Throwable instead of Exception

10:44 mchurch: Chouser: Works beautifully.

10:45 Chouser: So shall I assume Throwable is a superclass? What's the semantic distinction between Throwable and Exception?

10:45 Chousuke: There are two kinds of Throwables

10:45 Errors and Exceptions

10:46 Chouser: yes, Throwable is the base class of all things that are, well, throwable, including Exceptions.

10:46 Chousuke: or hm, was UncheckedException separate from Exception?

10:46 mchurch: Chouser: So an exception is when something exceptional occurs that is not a malfunction of the program, and an Error is when the program itself fails?

10:46 Chouser: your question about the distinction is a Java question, and one I'm not really equipped to answer.

10:47 Chousuke: mchurch: something like that

10:47 Chouser: I think a major part of the distinction is between checked and un-checked exceptions.

10:47 kotarak: mchurch: I would think so.

10:47 markaddleman: an Error is a throwable which occurs when there is some kind of unrecoverable JVM error that prevents further computation

10:48 for example, division by zero, stack overflow or internal JVM bug

10:48 Chousuke: catching Throwable is considered bad style I believe.

10:48 markaddleman: exceptions are intended for programmatic or environmental problems

10:49 yes, it's very rare to have a legitimate reason to catch Throwable

10:49 mchurch: Chousuke: This makes sense

10:49 Chousuke: "Catch-all-error" constructions tend to indicate poor forethought and bad field performance

10:52 Chousuke: mchurch: I believe clojure makes use of a catch-all though.

10:52 to work around java's checked exception stuff.

10:53 bOR_: catch-all-errors and return nil.

10:53 that sounds horrible ;)

10:56 markaddleman: i'm a long time java guy who is trying to wrap his head around macros. can someone help me out with anonymous functions in macros?

10:56 the following code does not work:

10:56 (defmacro m1 [l]

10:56 whoops... try again: (defmacro m1 [l] `(take-while #(true? %) l))

10:57 but this does: (defmacro m2 [l] `(take-while (fn [p#] (true? p#)) ~l))

10:57 Chousuke: why do you need the anonymous function?

10:57 markaddleman: it has something to do with clojure's scoping rules, i think.

10:57 Chousuke: mchurch: the #() reader macro expands into something that breaks macro rules.

10:57 markaddleman: the anonymous function is just a syntactic convenience

10:58 Chousuke: markaddleman: just use fn in macros

10:58 instead of #()

10:58 kotarak: "#() is not a replacement for fn" (from the docs)

10:59 Chousuke: but in that particular case, couldn't you just use `(take-while true? ~l)

10:59 markaddleman: sure, but my real code needs a function

11:00 Chousuke: use fn then

11:00 kotarak: clojurebot: macro

11:00 clojurebot: http://groups.google.com/group/clojure/browse_thread/thread/bba604cee3b232d9/28837d55525306d8?lnk=gst&q=recursive+macroexpand#28837d55525306d8

11:00 kotarak: clojurebot: macro help

11:00 clojurebot: macro help is http://clojure-log.n01se.net/macro.html

11:01 markaddleman: kotorak: thanks for the pointers

11:01 kotarak: The first was actually no pointer. ;)

11:01 I suspected the second.

11:01 markaddleman: heh

11:01 Chousuke: that form will not work since lisppaste8 is gone

11:01 kotarak: This is gives some help which information is helpful when debugging macros.

11:02 Yes. Unfortunately the lisppaste bot has holidays.

11:04 rhickey: mchurch: catching Throwable is not advised, at least not without great care

11:08 Nafai: rhickey: When I get a chance, I'll post my code, but I ran inot a problem when I tried to run my clojure-compiled code on Android:

11:08 http://paste.lisp.org/display/72771#9

11:08 It's a problem in Clojure itself

11:09 Since there are not .class files in Dalvik

11:11 I'm getting ready to fly back home from visiting my in-laws, but I'll get my code available sometime soon

11:14 rhickey: Nafai: I see and understand - will look into it

11:15 Nafai: Thanks!

11:21 mchurch: rhickey: I have a question. I really like Clojure, but it's not as easy to debug as SBCL (although perhaps this is just because I'm more used to SBCL). For example, SBCL provides a useful backtrace consisting of Lisp functions that I understand, and drops me into the debugger where I can fool around with stuff. Clojure gives me a Java runtime exception that I usually don't understand. Are there Clojure debuggers in the works?

11:22 I think Clojure is a better language than the CLs, being unconstrained by backward compatibility and concurrency-oriented, but I think debugging is a serious weakness of Clojure (on the other hand, it's an extremely new language) compared to other Lisps.

11:22 rhickey: mchurch: you can use a Java debugger like JSwat, which will let you set breakpoints and step-debug Clojure code, see locals etc

11:23 If you haven't tried that you can't judge Clojure's debugability

11:23 mchurch: rhickey: Ok, thanks. I'll look into JSwat. Do I need to be knowledgeable about Java to use it?

11:24 rhickey: mchurch: not really, people here can help

11:31 mchurch: (take 3 [1 2])

11:31 Whoops. Sorry.

11:31 grosours: hi clojurians

11:31 mchurch: I was testing what error Clojure throws on an overreaching take from a vector; wrong buffer.

11:31 kotarak: mchurch: it returns nil

11:32 * kotarak is stupid.

11:33 mchurch: kotarak: It returns (1 2).

11:33 kotarak: yep.

11:33 was thinking drop

11:33 mchurch: Anyway, it was not my intention to use IRC as a Repl, and I apologize. :)

11:45 Chousuke: mchurch: nah, you can do that

11:45 ,(println "hello!")

11:45 clojurebot: hello!

11:47 mchurch: ,(+ 1 2 3)

11:47 clojurebot: 6

11:47 mchurch: Chousuke: Very cool

11:47 Chousuke: But is that not dangerous?

11:47 kotarak: ,(take-over-the-world)

11:47 clojurebot: java.lang.Exception: Unable to resolve symbol: take-over-the-world in this context (NO_SOURCE_FILE:0)

11:48 Chousuke: mchurch: only if the sandbox has holes.

11:48 mchurch: Chousuke: "I am scrupulous but dangerous" -- I have used this phrase 5 or 6 times in the past 2 weeks, but shall refrain from discussing context

11:48 Chousuke: Ok. What if someone set off an infinite loop? (I don't intend on trying it.)

11:49 Chousuke: ,(loop [] recur)

11:49 clojurebot: java.lang.Exception: Unable to resolve symbol: recur in this context (NO_SOURCE_FILE:0)

11:49 Chousuke: eh, blah

11:49 ,(loop [] (recur))

11:49 should timeout

11:49 in about 10 seconds

11:49 clojurebot: Execution Timed Out

11:49 Chousuke: yay

11:49 mchurch: Chousuke: Ok. I just don't want to put one in the failbox and end up a celebrity before my time.

11:50 Chousuke: heh

11:50 mchurch: Chousuke: At my current level of competence, being well-known in any context is undesirable.

11:50 Chousuke: the timeout functionality was added after clojurebot was once sent into an infinite loop :P

11:50 I think it's still possible though.

11:50 achim_p: mmm, anybody got some clojure code running on android? i'm stuck since clojure's load seems to rely on ClassLoader.getResource, which is not supported on android

11:50 Chousuke: by spawning a thread.

11:51 Nafai: achim_p: rhickey is looking at it

11:51 achim_p: Nafai: cool!

11:52 Nafai: achim_p: I got this last night: http://paste.lisp.org/display/72771#9

11:52 rhickey: achim_p: Is the problem getResource isn't supported or there are no .class files? It seemed the latter from the stack trace I saw

11:52 Nafai: achim_p: From the way I'm interpreting it, it's not that getResource() isn't supported

11:52 achim_p: It seems that it is that there are no .class files

11:53 Because of the compiling down to dalvik

11:53 I was going to write an experiment when I get a chance to see what can be loaded from the classpath

11:54 mchurch: Chousuke: Has anyone accidentally set off the Clojure Repl?

11:55 achim_p: rhickey: the android docs state: "Returns an URL which can be used to access the resource described by resName, using the class loader's resource lookup algorithm. The default behavior is just to return null." (http://code.google.com/intl/de-DE/android/reference/java/lang/ClassLoader.html)

11:56 URLClassLoader isn't documented to behave differently

11:57 Chousuke: mchurch: you mean, running repl?

11:57 hmm

11:57 Nafai: achim_p: I should probably look at the docs closer :)

11:58 mchurch: Chousuke: Not necessarily an infinite loop. I'm just wondering if anyone ever typed something that set off the Clojure bot.

11:58 Chousuke: Someone was typing carelessly with examples ,(+ 18 23)

11:58 I guess that *didn't* set it off.

11:59 Chousuke: It would be a cool surprise if unexpected.

11:59 achim_p: but i don't really know - just started playing with android yesterday

11:59 Chousuke: it only accepts lines that start with ,(

11:59 mchurch: Chousuke: Got it. So an inline ,(form) wouldn't have that effect.

12:00 Chousuke: yeah

12:00 though clojurebot has a bug in its "bad-forms" function

12:00 mchurch: Chousuke: Reminds me of the time when I wrote something about "resist posting" and the in-line "ist post" was recognized as a "1st post" cognate, getting auto-replaced.

12:01 Chousuke: On Fark back in 2002.

12:01 Chousuke: What's the bug?

12:02 rhickey: Nafai: ok, svn 1188 added speculative load when no .clj or .class resource found, for Dalvik VM

12:02 Chousuke: it considers for example "defn" a bad form

12:02 but clojure.core/defn is fine

12:02 :P

12:02 moral of the story: blacklists are not secure

12:03 danm_: heh

12:03 mchurch: Chousuke: This makes sense. You don't wnat the namespace to get cluttered up.

12:03 This should also fail (hopefully):

12:03 ,(def x 4)

12:03 clojurebot: DENIED

12:04 Chousuke: well it's also easy to clean up

12:04 mchurch: ,(let [x 1 y 2] (+ x y))

12:04 clojurebot: 3

12:04 mchurch: ,(let [f (fn [x] (* x 2))] (f 13))

12:04 clojurebot: 26

12:05 mchurch: Chousuke: True.

12:07 Chousuke: ,(clojure.core/defmacro mydef [& rest] (concat (list (symbol "def")) rest))

12:07 hmm

12:07 Nafai: rhickey: I'll give it a try

12:08 Chousuke: ,(mydef x 1)

12:08 clojurebot: #'foo/x

12:08 mchurch: ,(+ x 1)

12:08 clojurebot: 2

12:08 mchurch: Chousuke: Uh oh.

12:08 Chousuke: :)

12:09 mchurch: Chousuke: So it lets you do defmacro but not defn?

12:09 ,(defmacro m [] `(+ 1 2))

12:09 clojurebot: DENIED

12:09 mchurch: ,(clojure.core/defmacro m [] `(+ 1 2))

12:09 Chousuke: that works.

12:09 mchurch: ,(m)

12:09 clojurebot: 3

12:10 mchurch: ,(clojure.core/defn f [] (rand))

12:10 Chousuke: I think defn is useful for it though.

12:10 clojurebot: #'foo/f

12:10 mchurch: (f)

12:10 ,(f)

12:10 clojurebot: 0.6791550154947764

12:10 Chousuke: what's wrong with clojurebot's svn report functionality though

12:10 my bot is reporting stuff just fine

12:11 mchurch: Chousuke: I guess it makes you package-qualify defn/defmacro to keep the script kiddies out. :)

12:13 Nafai: rhickey: http://paste.lisp.org/display/72771#10

12:13 Chousuke: ,(dorun (map #(ns-unmap *ns* %) (keys (ns-interns *ns*))))

12:13 ,(f)

12:13 clojurebot: java.lang.Exception: Unable to resolve symbol: f in this context (NO_SOURCE_FILE:0)

12:18 rhickey: Nafai: have you got your classpath setup correctly?

12:19 Nafai: findClass shouldn't be called unless parent loader can't find it, and it should

12:19 Nafai: rhickey: Good question. Let me check my manifest

12:20 Hrm. The manifest isn't setting the classpath, that's probably the issue now

12:20 * Nafai wishes he didn't have to pack right now, debugging this is more fun

12:29 Chouser: Why doesn't AFn support withMeta, even though it's an Obj and therefore has a _meta member?

12:32 rhickey: Chouser: I've been on the fence about it - two values of the same fn, also would need to gen code for it

12:33 I'm going to try to standardize metadata for ref types soon.

12:33 ref/atom/var/agent/namespaces

12:34 Chouser: what do you mean by standardize?

12:34 rhickey: uniform support

12:34 dreish: Almost there: http://www.google.com/trends?q=clojure%2Cocaml&ctab=0&geo=all&date=ytd&sort=0

12:35 rhickey: http://www.google.com/trends?q=clojure%2Cocaml%2C+jython%2C+jruby&ctab=0&geo=all&date=ytd&sort=0

12:35 dreish: Nice.

12:36 Those are better comparisons.

12:37 Chouser: yet plenty of room to grow: http://www.google.com/trends?q=clojure%2C+python%2C+ruby&date=ytd

12:37 dreish: The problem with those is they have so many other widely-used meanings.

12:37 Chouser: good point!

12:37 rhickey: Oregon cop battles 12-foot python to save pet store owner

12:38 Python eats Australian family dog

12:38 vogelrn: yeah but the programming uses probably dwarf the other ones

12:38 rhickey: Woman Finds Python In Washing Machine

12:38 dreish: lol

12:38 Maybe it was the language!

12:38 ericlavigne: Regarding popularity, I'd be more concerned about this one: http://www.google.com/trends?q=clojure%2Cejb&ctab=0&geo=all&date=ytd&sort=0

12:40 It'd be nice work with clojure by day, but it's not catching up to EJB any time soon. As long as it's something I only do when I don't have to ask permission, I don't so much care if it's popular.

12:41 rhickey: Clojure does have plenty of room to grow

12:42 dreish: It seems to me that Clojure is unusual in not really needing desperately to be popular, since it can just pick up libs that were written for Java, but the growth of Lispier libraries is something to look forward to.

12:43 ericlavigne: dreish: That is a big part of why I like Clojure. Making Lispier libraries is also much easier than writing libraries from scratch, so it doesn't require a big community.

13:00 drewr: In clojure.main, what gets triggered as the result of it being the Main-Class in the jar?

13:32 Chousuke: hmm

13:34 drewr: I've got a main.clj with (ns foo.bar (:genclass)), java -jar foo.jar tells me NoClassDefFoundError.

13:35 Er, (ns foo.bar.main (:genclass)) actually.

13:43 duck1123: Has anyone ever seen an issue where emacs/slime will connect to a swank server, but not open the repl?

13:44 the slime connections buffer shows a connection, but selector doesn't even give me an option for the repl

13:46 drewr: duck1123: How do you start your slime connection?

13:46 duck1123: M-x slime-connect

13:46 danlarkin: I use M-x slime

13:47 drewr: I use M-- M-x slime (so I can choose the lisp).

13:47 duck1123: I'm connectiong to an already running clojure instance

13:48 my server logs show that the swank server has started listening, and it makes the connection just fine

13:48 aking: duck1123: Doesn't seem to work with the latest slime - I had to back up a few versions to have a working repl again

13:48 duck1123: just no repl

13:48 aking: that's probably what I'm seeing. I just updated

13:51 aking: duck1123: I had to revert slime to Dec23 to have it work again

13:56 Raynes: I tried to compile the first example in http://clojure.org/compilation with slime, using "Compile file" and it gives me "Compilation finished: 0 errors 0 warnings 0 notes [0.01 secs]" yet nothing happened.

13:56 drewr: Why is this blank? http://clojure.org/repl_and_main

13:57 Raynes: Look for .class files in your cwd.

13:58 Raynes: cwd?

13:58 drewr: user.dir

13:59 Raynes: Nada.

13:59 drewr: You used (compile)?

14:00 SLIME's compile only loads the source into the jvm.

14:00 triddell: Raynes: you executed (compile 'clojure.examples.hello) or did you do M-c, M-k?

14:00 Raynes: I used the compile button on Slime.

14:00 drewr: Go to the REPL and do (compile ...).

14:01 triddell: I meant C-c, C-k I guess

14:03 duck1123: resetting slime back to the 23rd did the trick

14:03 replaca: Best thing I've recently discovered: paredit. Makes writing code in slime much more stream of consciousness.

14:04 duck1123: until it gets in your way

14:04 I love paredit, but I find I sometimes need to turn it off to do things I want to do

14:05 replaca: Yeah, ^Q ( can be your friend :-)

14:05 duck1123: that, and paredit messes up some of my navigational keystrokes in emacs over ssh

14:06 replaca: you could override maybe

14:06 * drewr couldn't live without paredit

14:06 replaca: I usually don't use emacs over ssh

14:06 but spawn a remote X window

14:07 Does anyone use redshank with clojure?

14:07 Looks like it might require some tweaking

14:07 * drewr uses the same navigational keystrokes in terminal emacs as windowed

14:07 Raynes: Where do files compile too when you compile them? I can't find it ._.

14:08 drewr: Raynes: In user.dir.

14:08 replaca: duck1123: For example?

14:08 drewr: Raynes: E.g., (System/getProperty "user.dir")

14:09 Raynes: That's weird, usually things compile to the same directory that they are in.

14:10 Er wait, it is the same directory their in.

14:10 Nothing there... The hell...

14:21 Lau_of_DK: drewr: You actually use paredit regularily ?

14:29 duck1123: replaca: paredit over ssh will take my page up/down and home/end keys and insert other sequences

14:29 it only happens when paredit is enabled.

14:33 replaca: duck1123: ahh, cause they're escape seqs on a term so they look like meta commands to paredit. Bummer.

14:33 duck1123: you could rebind paredit around that with a hook

14:35 duck1123: replaca: It might be worth it. I use my emacs at home from work to do my clojure coding & irc

14:35 drewr: Lau_of_DK: Yep.

14:36 Lau_of_DK: drewr: I was under the impression that it had bad bugs and wasnt in ver. 1.0 yet, am I mistaken ?

14:36 or more to the point: Am I missing out by not using?

14:36 drewr: I haven't had any problems with it.

14:36 Lau_of_DK: Just speed. :-)

14:37 It's like Emacs; once you use it you won't be able to go back.

14:37 Lau_of_DK: uuuh, sounds good

14:40 Raynes: It's compiling - But it's not there. This has got to be the stupidest problem I've ever had before.

14:44 billc: Lau_of_DK: the only things that I've found I didn't like with paredit was the default bindings for DEL and BS when a region was selected. I've changed those.

14:44 drewr: Raynes: find $HOME -name \*.class :-)

14:45 Raynes: I hate windows computers.

14:46 replaca: The great thing about a customizable editor: take what you want and redefine what you don't. I've grown to like the DEL/BS behavior, but it's definitely an acquired taste

14:47 Lau_of_DK: the big thing it gives you is it makes it much easier to deal with hacking around the parens. For example, you can wrap a sexp when you want to add an if or a let (and all sorts of other similar ops)

14:48 And it always adds the close delimiter when you make the open so everything stays balanced all the time

14:48 billc: replaca: yeah, for the most part, the paredit choices are logical for sexp-based structural editing; however, I couldn't get used to not being able to delete regions with DEL/BS.

14:49 Raynes: $HOME would be the user directory on windows right?

14:51 duck1123: billc: I've taken to just killing the region when I want to delete it.

14:51 drewr: I didn't love it until I got comfortable with C-k, C-M-f, C-M-b, and C-).

14:52 replaca: billc: I will certainly defer to you on SLIME/paredit issues as I'm still a bit of a noob :-). Paredit is definitely intrusive, which is good for some and bad for others - often on a command by command basis as you point out.

14:53 drewr: I had the ref card open in my browser for the first couple days I was using it, looking at all the little diagrams of what each keystroke would do

14:54 billc: duck1123: engrained "finger-memory" dies hard - I found it was better (for me) to make the DEL/BS keys work the same as in other modes rather than try to adapt to a different behaviour when editing lisp code

14:54 duck1123: M-( and M-s are my friends :)

14:54 gnuvince: Hi everyone

14:55 duck1123: billc: do you have a patch you're willing to share? I resort to killing only after first trying bs/del and then slapping myself

14:55 drewr: duck1123: Yeah, I forget about those.

14:55 * drewr has never had an issue with BS/DEL

14:56 drewr: I find it quicker to C-k and retype.

14:56 duck1123: oh yeah. DEL also has problems over ssh. Have to resort to C-d

14:56 shoover: Raynes: what's the value of *compile-path* in your REPL? that should be where compilation output goes regardless of OS

14:56 billc: lisppaste8: url

14:56 drewr: shoover: Oh, shoot, forgot that.

14:57 billc: hmm, lisppaste bot seems to be down, just a sec...

14:57 * drewr is in ant h*ll right now

14:58 shoover: Raynes: also, when in Windows, ProcMon.exe is your friend for such matters

15:00 billc: duck1123: Here's what I use to override paredit DEL/BS:

15:00 http://paste.lisp.org/display/72793

15:01 replaca: duck1123: but M-S doesn't always seem to work in clojure. I have probs when I try to split a binding form (cause I need an if in the middle of a let, for instance)

15:05 billc: lisppaste8 has been on "vacation" for a few days. I don't know if anyone knows why.

15:05 billc: replaca: does chandler maintain it or someone else?

15:05 replaca: billc: no idea

15:06 it's just always been there

15:06 billc: replaca: I'll check with chandler (he maintains the #lisp bot) and see whether he can restart it

15:07 drewr: billc: Yes, chandler. He doesn't hang out in here though. I requested lisppaste to join.

15:09 billc: drewr: do you mean you can get lisppaste to join #clojure or that you asked chandler to set it up?

15:09 drewr: billc: I asked him to set it up.

15:10 billc: drewr: ok, I'll see if I can let him know it's down

15:10 drewr: You can also email rt@common-lisp.net.

15:12 billc: drewr: thanks

15:15 duck1123: billc: thank you. That did the trick.

15:18 djjack: http://www.google.com/trends?q=clojure%2Cocaml%2C+jython%2C+jruby&ctab=0&geo=all&date=ytd&sort=0

15:18 crap, sorry about that...

15:18 was copying from earlier in the buffer

15:19 chrisn: the swedes love clojure?

15:19 along with sf, and ny

15:22 Raynes: Oh, it's compiling into clojure\classes

15:24 shoover: Raynes: are you running clojure.main as your entry point? I found a message in the group about a bug with *compile-path* in that situation. It's fixed in svn 1177

16:13 drewr: lisppaste8: Welcome back!

16:13 chandler: billc: Hi!

16:13 drewr: lisppaste8: url

16:14 chandler: billc: Generally if it goes more than an hour or so without being in the channel, you should send an email to lisppaste-requests AT common-lisp.net

16:14 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

16:14 billc: chandler: hi!

16:14 chandler: thanks, that's good to know

16:15 chandler: I don't have any automated monitoring mechanism right now. Volunteers welcome...

16:15 billc: chandler: and, thanks for the quick response!

16:15 chandler: Oh, also, I'd love for someone to volunteer to write a Clojure lexer / formatter for lisppaste...

16:16 Chouser: chandler: I suppose that would have to be written in CL?

16:16 chandler: Yes, but it's not too complicated as it's essentially a DSL

16:16 See http://paste.lisp.org/system-server/show/lisppaste/coloring-types

16:17 It would inherit from Basic Lisp and add additional lexer categories - see the Common Lisp, Emacs Lisp, and Scheme coloring types for examples of that

16:18 billc: chandler: what sort of "automated monitoring mechanism" did you have in mind? If you just want someone to receive the emails and to restart the lisppaste bot, I would be happy to do that. Alternatively, one of the more "regular" #clojure residents could do the job.

16:19 Chouser: chandler: thanks for providing lisppaste. I'm not eager to write CL code, so hopefully someone else will rise to the challenge.

16:19 chandler: billc: I'm thinking of something that connects to freenode maybe once an hour and checks the status of the bots run by that process (minion, specbot, and lisppaste([2-9]|))

16:21 billc: If at least one is missing, it would send an email - or for more advanced usage it could kick the process automatically

16:24 billc: chandler: hmm, seems like there should be something like that already available (with all the irc bots that regularly monitor channels)

16:24 chandler: I've never run across anything like that, but it's possible.

16:28 mchurch: Does anyone here have an opinion on Stuart Halloway's Programming Clojure?

16:28 I know the book is in beta and the paper form doesn't come out till 28. April, but the PDF is available online.

16:30 Chouser: I think it's quite good. The tone of the prose isn't too stuffy or silly, the examples are quite good, and it flows well from one topic to the next.

16:34 mchurch: Chouser: Good to know. Thanks.

16:36 Chouser: I'm reasonably solid (4 mos.; intermediate level) with Lisps in general, but a n00b with a capital '0' when it comes to Clojure, and lot of the concurrency stuff's brand-new to me, so the book would probably be a good investment.

16:36 Chousuke: how's your java?

16:37 Chouser: mchurch: the treatment of multimethods I think is particularly good. The macro chapter is also good, considering it's not the focus of the book.

16:37 Chousuke: you don't need to know java the language per se to use clojure, but knowledge of the class library is essential

16:38 and I guess some ability to read java is needed to read javadoc :/

16:40 mchurch: Chousuke: my Java's mediocre.

16:40 Chousuke: oddly enough, I'm much better w/ SBCL than Java, even though I have 3x as much Java exposure

16:40 Chousuke: This is why I find it hard when people complain about functional languages being "hard". I'm thinkin', "what?"

16:41 danlarkin: hard aka different

16:41 mchurch: danlarkin: I think the only reason why Java is considered "easier" than Lisp is that Java's closer to the imperative Basic model.

16:42 danlarkin: Basic is easy (for trivial things) but in order to get anything real done, you need a more powerful language. Java is less of a linguistic/conceptual leap, but you have to keep track of 30 million different library functions. Lisp is more of a mind-bender as far as the language goes, but it's load on memory (human memory) is lower because of its regularity.

16:48 Chousuke: oh nice :(

16:49 chrisn: as someone who is just learning fp, just figuring out how clojure.contrib.lazy-seqs.fib works took a lot of thinking

16:49 That is why it is hard, you program at a higher level of abstraction.

16:50 Chousuke: too bad mchurch went to the other side of the split :/

16:50 chrisn: no kidding

16:50 Chousuke: hooray

16:52 mchurch: the split interrupted me, but I'll continue: I find functional programming less of a load on memory because true functions are truly independent units; in non-functional style with side-effects, you have to know exactly what a function does to know whether it does what you want.

16:52 with a "pure" function, the knowledge that it is pure and its name and arguments may be enough to tell you what it does.

16:52 mchurch: Chousuke: Yes. Referential transparency is a huge win.

16:54 Chousuke: I guess my point is that I can't see why FP isn't more widespread. It seems to be a win both for the elite programmers who try to use FP at every opportunity, and for the more average programmers as well.

16:55 vogelrn: mchurch: I think part of the difficulties a lot of people have is that they tend to learn patterns rather than concepts. I was doing stuff with CL in school recently, and was helping a guy out and he was having a lot of trouble using cond simply because the differences in appearance made it harder for for him to keep an idea of what he was doing in his head than it would be using an if-else if with curly braces. At least at my s

16:55 Chousuke: well, the most common languages are not very well suited for FP

16:56 vogelrn: I don

16:57 I don't think you can become a programmer by learning just patterns :/

16:57 you have to have some kind of a mental model of what the text you write signifies.

16:58 kotarak: it's as with Joseki in Go: you have to *understand* them, not blindly learn them

16:58 mchurch: I'm with Chousuke and kotarak on these.

16:58 Chousuke: in the beginning they give you some help as simple patterns though.

16:58 vogelrn: well, you'd be surprised how far some people can get, but mostly what I mean is how people think. If people are just working with a single idea of how something is expressed, it's easy to have difficulty working in a different environment when their thoughts are still associated with the old one.

16:58 Chousuke: you see a situation, apply joseki, hooray.

16:59 but if you want to get stronger that is not enough :/

17:00 inertia-: FP + consistent simple syntax = lighter cognitive load for your brain to understand what you're seeing => you can go the other direction easier, to

17:00 o

17:00 vogelrn: yeah I'm not saying that that's the right thing I'm saying that I think that some of that happens and that's part of why it's hard for people to pick up a functional language, they spend a couple years on exclusively imperative programming before getting to anything else

17:03 I did java my first two semesters in college, then C, and then finally a class with Ruby, Ocaml, and Java which didn't go in depth in any language

17:03 mchurch: vogelrn: That's poor education, in my opinion.

17:03 inertia-: what do you think about mit's intro to programming course using python now, instead of scheme?

17:03 vogelrn: poor, but typical

17:03 inertia-: yeah i wouldn't learn programming through classes imo

17:03 (but i am biased since that isn't even my minor)

17:04 mchurch: vogelrn: Agreed. It seems like the curricula are stuck in '90s egalitarianism... let's churn out 10x as many mediocre programmers instead of a few good ones.

17:04 inertia-: "90s egalitarianism" haha

17:04 mchurch: inertia-: Well, you don't learn programming from CS courses. You learn CS.

17:04 inertia-: egalitarianism !=> poor average performance

17:04 vogelrn: inertia-: which course # is that? I have a friend going there, she took one class that did python but she wasn't very impressed

17:05 mchurch: inertia-: Yep. In the '90s the world was wonderful and "self-esteem" grew on trees and 60% of the country was going to go to college

17:05 inertia-: clojure is an ideology-free zone!

17:05 mchurch: interia-: Granted, I'd much rather live in the '90s than this decade (although the election of Obama is pretty awesome)

17:05 inertia-: clearly racism is over

17:05 vogelrn: dunno, whatever freshman CS course used to use SICP

17:05 mchurch: inertia-: Sadly, no. But this is a huge step in the right direction.

17:06 inertia: Anyway, let's quit the politics. Back to CS...

17:06 inertia-: on HN the other day someone criticized a hacking cooperative in europe for advocating "hacktivism"

17:06 the guy/gal wanted people "just to code"

17:06 as if a hacker without passions is something the world really needs

17:07 mchurch: interia-: Although you don't learn how to program from CS courses, you do learn a lot of CS, which is much of the "why" of programming

17:07 You pretty much have to learn the "how" on your own, but CS courses can give you a conception of the "why"

17:07 drewr: vogelrn: 6.001.

17:08 inertia-: mchurch: however, using a language with more expressive power allows one to experiment with CS concepts easier

17:08 e.g. it's fine to learn about combinatory logic but frankly it probably won't click until you start writing programs using that paradigm

17:10 mchurch: inertia-: I agree with you.

17:10 inertia-: in other news, inertia- would love a clojure specification, implementable on other VMs

17:10 llvm + clojure = yaey

17:10 mchurch: interia-: I think CS education would be improved if courses used better languages.

17:10 inertia-: my school is a java shop and all the faculty have windows on their computers

17:10 drewr: inertia-: Not sure that's possible given the JVM-specific nature of the language.

17:10 inertia-: yet a lot of them are decent researchers

17:10 mchurch: interia-: But I think that most CS departments have missed out on the PL "Renaissance" of the 2000s

17:11 "Renaissance" possibly being the wrong word, since a lot of these langs. are brand new

17:11 inertia-: no that would be the right word

17:11 just without the capital R

17:12 mchurch: inertia-: I guess it's the "re" I'm arguing against... Clojure is in "naissance" (birth) rather than "renaissance"

17:12 inertia-: FP is undergoing a renaissance then

17:12 :)

17:12 has anyone here used the hemlock editor?

17:13 mchurch: inertia-: I agree with this. Good languages and PL design concepts are being rediscovered, reborn... so "renaissance" is apropos.

17:14 Chousuke: inertia-: do you need a spec? use the current implementation and rhickey as your reference :D

17:15 inertia-: Chousuke: ah well i am not in a position to, say, port clojure to llvm right now

17:16 billc: chandler: you still around?

17:16 chandler: billc: Yes

17:16 billc: chandler: you might want to consider using something like what eggdrop does for restarting bots

17:16 Chousuke: inertia-: non-jvm versions of clojure will have problems finding a proper standard library though.

17:17 billc: chandler: it has a script that runs periodically to test if the bot is active and (if not) restarts it

17:17 chandler: How does the script work? Does it connect to the network and do a WHOIS?

17:17 billc: eggdrop: http://www.egghelp.org/files.htm (autobotchk and botchk scripts)

17:18 chandler: no, it just checks to see if the bot is active

17:18 chandler: define "active" then?

17:18 billc: on the server where it's initiated from

17:18 tayssir: Hi! Given a var, how do I get the underlying symbol? (I guess I want the inverse of "find-var" or "resolve" or someting.)

17:19 chandler: billc: let me explain. The situation seems to be that freenode will occasionally drop one of the 12 connections that the lisppaste SBCL process has open

17:19 billc: ah, so thedo the cl-irc bots automatically try to reconnect if they lose irc access

17:19 chandler: for some reason, I don't actually get a signal about that - I'm not sure why; maybe SBCL is eating it

17:20 Chousuke: billc: the metadata of a var contains its namespace and name

17:20 oops

17:20 tayssir: you

17:20 billc: oops, meant to say "the cl-irc bots don't automatically try to reconnect"

17:20 chandler: No, they don't, and I'm not sure how to fix that

17:21 tayssir: Chousuke: Ahh, cool, thanks!

17:21 billc: chandler: can the bot tell if it's still connected in some other manner?

17:21 chandler: I could PING the server, I guess.

17:22 billc: chandler: and, if it isn't, terminate (then a cron job could periodically test to see if the bot was running and, if not, restart it)

17:22 Chousuke: tayssir: so (let [md (meta yourvar)] (symbol (.getName (:ns md)) (:name md)))

17:23 chandler: billc: the latter part is already done - it's run in a loop which restarts it automatically if for some reason it dies

17:24 billc: The biggest problem is that I don't have much time at all to work on things like this these days.

17:24 StartsWithK_: lisppaste8: help

17:24 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

17:24 billc: chandler: yes, common problem :-(

17:26 tayssir: Chousuke: Interesting, that code throws "java.lang.ClassCastException: clojure.lang.Symbol" for me, but perhaps I can figure this out...

17:27 lisppaste8: StartsWitkK pasted "Strange struct/macro behaviour" at http://paste.lisp.org/display/72804

17:27 StartsWithK_: am i doing something wrong with struct in that snippet?

17:28 kabny: There is a famous Einstein quote: "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." That's how I feel about Clojure, it is amazing how such a small language is so much more powerful and expressive than a big monster like Java.

17:29 tayssir: Chousuke: Weird, I must have a b0rken build of Clojure...

17:31 kabny: and I kind of gravitated towards functional programming in Python naturally, but that doesn't seem to happen to everyone.

17:31 Chouser: tayssir: you're sure you're starting with a Var and trying to get its name? That strikes me as a rather unusual use case.

17:31 Chousuke: tayssir: hm, maybe I typoed then

17:33 Chouser: StartsWithK_: The code you posted is incomplete, so I can't actually test it.

17:33 tayssir: Yeah, I don't exactly know /why/ I'm doing this, except that I was experimenting; one thing led to another, and I found myself wondering about this... ;)

17:34 Chouser: StartsWithK_: So without that it's hard to say anything terribly helpful, but I would recommend avoiding the use of 'name' as a local, since its the name of a builtin function.

17:34 Chousuke: tayssir: ah, the symbol function takes strings, but the name metadata is an actual symbol

17:35 lisppaste8: StartsWitkK pasted "Smapler example" at http://paste.lisp.org/display/72805

17:35 tayssir: Chousuke: Aahhh, so using "str" around the params to "symbol" works! Thanks!

17:36 Chousuke: (let [md (meta myvar)] (symbol (str (.getName (:ns md))) (str (:name md)))) ; not very nice though :P

17:36 Chouser: another way: (symbol (str (.ns #'map)) (str (.sym #'map)))

17:37 well, largely the same. :-)

17:37 tayssir: Chousuke: Yeah, that's not really obvious from the documentation of "symbol".

17:37 StartsWithK_: Chouser: this is smaller example of code that will fail, if i change it to (let [r {:x 'a :y 'b}] ...) it works just fine

17:37 Chousuke: how about (ns-resolve (.ns thevar) (.sym thevar))

17:38 no wait that returns the var /:

17:38 Chouser: heh

17:39 Chousuke: was there a function to qualify symbols with namespaces?

17:41 Chouser: StartsWithK_: odd -- I can also evaluate what macroexpand produces, without a problem.

17:41 StartsWithK_: i'm at revision 1132 if that helps :)

17:42 Chouser: ah, but if I have print-dup on, I can see what macroexpand is really doing.

17:42 tayssir: Chousuke: Maybe "resolve"?

17:42 Chousuke: tayssir: that returns a var

17:42 tayssir: No wait, that gives a var..

17:44 kotarak: Chousuke: `symbol

17:45 Chousuke: kotarak: that's read-time only though :/

17:46 inertia-: Chousuke: what is the proper standard library?

17:46 Chousuke: for clojure?

17:46 inertia-: implementations of all the java classes/whatnot already used in clojure?

17:46 yes

17:46 tayssir: I wonder if the recent "quasiquote" does ` at eval-time now...

17:46 inertia-: i am responding to your comment above

17:46 mchurch: Quick question: Is there any find/member function in Clojure? (Not an important question, since it'd be trivial to write one on top of some.)

17:46 Chousuke: the clojure api + the java class library

17:46 Chouser: StartsWithK_: I think you've found a bug

17:47 mchurch: find is a map function, and there's no member?

17:48 Chouser: mchurch: you want to search a sequence for a particular value? or look through the members of a Java class?

17:48 Chousuke: inertia-: if you look closely, you'll notice the clojure api lacks many "basic" things. That's because they're already provided by java :)

17:49 mchurch: mchurch: just wondering if there's an analogue of (find 5 lst) that's shorter than (some #(= % 5) lst).

17:49 Chouser: I meant that to you, not me. My 2d embarrassing mistake here today.

17:49 rhickey: Chouser: struct literals are not supported in code - they don't have print-dup persistence

17:50 inertia-: Chousuke: what i'm really wondering, then, is how much of that functionality is only implemented on the jvm

17:50 rhickey: StartsWithK_: struct literals are not supported in code - they don't have print-dup persistence

17:51 Chouser: mchurch: (some #{5} lst) is an appropriate idiom.

17:51 rhickey: is that a "not yet supported" or "no support planned"?

17:52 or a "patch welcome" :-)

17:52 Chousuke: inertia-: I don't know how to answer your question. what do you mean "how much"?

17:53 inertia-: .NET for example probably has equivalent APIs for most things, but they're of course incompatible.

17:53 rhickey: Chouser: still thinking about structs in the context of AOT compilation - you'd need independent instances of a struct to bind to the same basis, without redundantly storing the basis

17:54 Chousuke: inertia-: so using host interop directly would render clojure code unportable between two clojure implementations.

17:54 on different hosts that is.

17:54 rhickey: one idea is to use a real class for the struct basis, a la the way proxies are now done

17:54 knabb: I'm thinking about starting to write a 3D and or 2D gameengine in Clojure or Clojure/Java, would anyone be interested in helping? I'll put it on Github anyway.

17:55 vogelrn: Chouser: Is that usage of anonymous function literals documented somewhere? I didn't know that worked.

17:55 Chousuke: vogelrn: it's a set

17:55 vogelrn: oh, whoops

17:56 Chousuke: using it as a function may be surprising but it's probably the most clojurey code possible :P

17:56 mchurch: Chouser: Ah, because sets are functions! Beautiful.

17:56 chrisn: knapp: I am writing an opengl graphics backend.

17:56 you could use it for anything

17:56 mchurch: Chouser: That's really cool.

17:56 chrisn: working on multisample fbo support

17:56 Chousuke: mchurch: it also support searching for multiple alternative values :)

17:56 vogelrn: yeah I got it I just misread it because it was replacing mchurch's use of an anonymous function literal :P

17:56 Chousuke: supports*

18:00 Nafai: Here's the code I'm working on to try to write an Android application in Clojure: http://github.com/Nafai77/helloandroid/tree/master

18:01 rhickey: Nafai: does it work?

18:01 Nafai: It includes instructions on how to run it

18:01 Nope

18:02 Still have the classloader issue, but at least my code is up so I can collaborate with others to figure out what needs to be fixed in Clojure (or otherwise) to get this working

18:02 hoeck: knabb: did some physics simulation a while ago in clojure, not usable but i gained initial knowledge in the field

18:03 Chouser: mchurch: I can't take any credit for that use of a literal set.

18:03 inertia-: Chousuke: it seems to me a clojure spec, a la rnrs, would be useful for porting to other VMs

18:05 mchurch: I have a Git emergency question. I was planning to head out the door and accidentally deleted a file.

18:06 What command do I use to reset that file to pre-commit state without reseting the rest of the files?

18:06 err, not pre-commit

18:06 most recent commit

18:06 Chouser: git checkout

18:07 mchurch: Chouser: Thanks. Worked beautifully

18:07 Chouser: I'm also a git noob. :)

18:08 Chouser: me too, pretty much, but it seems recovering from my own clumsiness is something I get plenty of practice with.

18:08 Chousuke: I wonder if there's a way to get the most recent in-index version of a file after deletion

18:08 duck1123: git takes a while to get used to

18:08 Chousuke: maybe git reset --soft?

18:09 * Chousuke tries

18:11 Chousuke: nah

18:16 hmm

18:17 it seems even uncommitted changes are recoverable as long as they are in the index, but it requires manual searching

18:18 you need to do git fsck --lost-found and look in .git/lost-found/ if any of the files there match the one you deleted

18:56 aking: Nafai: thanks for the android build instructions - I got your test app to build and install in a few minutes

18:57 Nafai: aking: Cool. Note that it isn't yet working :)

18:57 aking: rhickey: it seems that 1189 broke the android dx compiler - I had to revert to 1188

18:58 Nafai: aye - I noticed that :) But I did see the same stack trace exception you've been seeing

18:58 Nafai: Good

18:59 I was planning on writing some code tomorrow to figure out the ClassLoader behavior on Android

18:59 I'm about to board a plane here in 10-15 minutes

18:59 Though I might try it out tonight

18:59 aking: Cool - don't update clojure though - it seems to break dx

19:00 Nafai: K

19:00 With a few of us working together, we can get this working! :)

19:02 aking: yes- I hope so. I want to port my current clojure gles2.0 code to work under Android\'s gles1.1 implementation

19:02 Nafai: That would be nice

19:04 * Nafai wishes planes had power outlets

19:09 aking: rhickey: svn 1189 causes dx to generate the following exception: java.lang.IllegalAccessException: Class org.apache.tools.ant.taskdefs.ExecuteJava can not access a member of class clojure.lang.Script with modifiers "public static"

19:10 looks like 1189 changed "public class Script" to "class Script" for some reason.

19:37 replaca: nafai: on virgin atlantic they do. i've been flying them sfo-dc and writing clojure almost all the way :-)

20:06 rhickey: aking: fixed in 1191

20:10 duck1123: would the inability to access protected variables in a constructor be due to a limitation in reflection?

20:11 aking: rhickey: Thanks - works now - though still seems to have issues with DynamicClassLoader when starting up in the emulator.

20:11 duck1123: I'm asking w.r.t. the 'accessing "this" in gen-class constructor' thread

20:13 also, should it be considered good style that any scripts should define and use a namespace?

20:16 Chouser: duck1123: the :init function for gen-class is not actually a constructor. It must return values that are passed to the constructor.

20:17 duck1123: I just remember hearing that reflection couldn't see protected variables. (or was it only private?)

20:18 Chouser: libs must define a namespace, and anything that gets compiled must define a namespace, I believe. I suppose if you're pretty sure your script will never be used as a lib, never compiled, and never composed with any other default-namespace-script, there's no need to define a namespace

20:19 duck1123: I'm saying that the :init function is run before any instance exists, so at that point there are no members of any sort to access, protected or otherwise.

20:19 duck1123: I asked that question because snake didn't have a namespace

20:19 Chouser: duck1123: there is an :exposes option to provide access to protected members

20:20 duck1123: ok

20:24 tayssir: Is this supposed to throw an exception?

20:24 (if false *unbound-symbol* false)

20:25 Chouser: tayssir: yes, at compile time

20:26 tayssir: Chouser: Duh, of course that makes sense...

20:26 Chouser: if you intend to def that symbol later, prior to running that line of code, it would be appropriate to forward-declare with 'declare'

20:28 tayssir: Chouser: Actually, that's an interesting difference between Clojure and Common Lisp -- I was surprised when testing: (and (resolve '*timer*) *timer*)

20:28 When I was trying to see whether *timer* was bound, so as not to kill the timer if it hadn't yet been initialized.

20:32 Chouser: tayssir: You probably just want to def it to nil, and check it's value. but if not, you might be interested in defonce and perhaps find-var

20:33 tayssir: Chouser: Thanks, I'll check those out!

21:01 dmiles_afk: DotLisp is missing dotted conses is clojure?

21:02 we are thinking about processing CycL returns from Clojure.. we are doing this in DotLisp.. but maybe we might also use clojure

21:02 rhickey: dmiles_afk: you're using DotLisp?

21:02 dmiles_afk: DotLisp has been a problem becasue it doesnt implement dotted cones too nicely

21:03 yes

21:03 but at least DotLisp alows dotted conses to be faked

21:03 tooks us a whiole to see (? . HI) was 3 lenght ;P

21:03 a while

21:03 rhickey: no dotted conses in Clojure

21:05 dmiles_afk: why is that? should a user make themselves a class like LispCOnses maybe?

21:05 called LispCons.. one that has that dotted behavour

21:06 rhickey: dmiles_afk: do you just want a pair? why not [x y] ?

21:08 dmiles_afk: we could (and should )do it that way for our own use.. mainly its we are ussing an existing lispish library .. and probly should do that in our cycl2CLojure dataforms

21:09 existing .jar

21:09 rhickey: I rarely hear from DotLisp users

21:09 dmiles_afk: we just want to make sure we dont get *too* lossy

21:10 cycl2ClojureForm -> clojureForm2CycL

21:11 well you wern't on irc .. but now glad you are!

21:11 we been using it off/on for several years

21:14 aking: rhickey: after tweaking the classloader in RT.java, it can now load clojure.core__init but dalvikvm now throws a VerifyError for cloure/core$str__3015$fn__3019

21:14 rhickey: aking: tweaking how?

21:17 dmiles_afk: rhickey, here is a cool screenshot of it's use:

21:17 aking: basically, if baseLoader() fails to load a class in RT.classForName(), try the default classloader

21:18 dmiles_afk: if my DMZ is passing it correctly

21:19 rhickey: dmiles_afk: neat!

21:19 lisppaste8: aking pasted "Dalvikvm verify error " at http://paste.lisp.org/display/72811

21:19 rhickey: DotLisp was a while ago...

21:20 dmiles_afk: our new project using it is http://code.google.com/p/opensim4opencog/

21:20 we are probly going to use CLojure over IKVM since our configs are dotlisp

21:20 and clojure is so simular

21:21 rhickey: dmiles_afk: I guess that makes you a repeat customer :)

21:24 dmiles_afk: indeed.. we can live w/o dotted conses anyways .. the lisp API we also talk to can stay the way it is and just make sure provaide the List interface to our CycList.java

21:24 or whatever it takes to give clojure interative access

21:24 iterative

21:27 rhickey: aking: is there a specific version of the JVM supported by Dalvik? StringBuilder is one of those classes whose sigs changed radically between Java 5 and 6

21:27 aking: rhickey: I'm not sure. I'll do some googling..

21:29 javap doesn't seem to show any problem with StringBuilder.append.. just does a checkcast then a invokevirtual for that 'bad' class

21:30 rhickey: aking: it's a runtime resolution problem - will statically verify fine but fail to find method at runtime due to signature difference

21:31 i.e. the jdk you build with differs from the one you run with

21:34 aking: rhickey: the decompiled bytecode does refer to AbstractStringBuilder in it's sig, but I can't find any docs on it. Could that be it?

21:34 rhickey: aking: it's a bridge method

21:37 aking: Guess I should try with Java5 then?

21:37 I'm using 1.6.0_11 atm

21:37 rhickey: aking: you might get lucky, I think the first method found is being used, will check on this end

21:40 aking: thanks - would rather not downgrade to Java 5

21:44 dmiles_afk: sanity check.. rhickey.. (def-macro cloj (&rest args) args)

21:44 i want (cloj foo bar) -> (foo bar)

21:44 (this is dotlisp tech support)

21:45 i am just wanting to mark my forms like (set p 1) with (cloj set p 1)

21:46 but i am getting error occured: Unable to cast object of type 'DotLisp.Symbol' to type 'DotLisp.Cons'.

21:46 i dont think this is a dotted issue... i think its my macro

21:47 (def-macro cloj (&rest args) `(~@args)) ?

21:48 rhickey: iirc (def-macro (cloj &rest args) args)

21:49 dmiles_afk: ok good, yeah it must be something else that i did wrong somewhere

21:53 oh i see the (cloj ..)

21:55 aking: rhickey: yup - I just checked the method sigs in for both android's StringBuilder and java6 - and the return type is different

21:55 knabb: i thought O(N log N) was slower than O(N) but it is faster right?

21:56 vogelrn: knabb: no it's slower

21:56 danlarkin: slower is the wrong word

21:56 vogelrn: yeah

21:56 danlarkin: more complex is what you mean

21:57 knabb: hmm 5 log 5 is faster, 12 log 12 is slower

21:57 yes

21:57 vogelrn: well

21:57 if the log results in a value less than one it's going to take last time :P

21:57 weee

21:57 err

21:58 *

21:58 knabb: lol

21:58 vogelrn: yeah I need to stop talking in terms of time because it's not working

21:58 danlarkin: Big-O notation is for algorithmic complexity, there's an unknown coefficient k that invalidates claims of "faster"

21:59 since k for an O(n^2) might be much lower than for an O(nlogn) algorithm it'll execute faster... until a point

22:00 knabb: yes

22:00 but when doing big O-analysis do you ever count ifs and such? or it is basically the number of loops ineach loop kind of?

22:00 or depends on what level?

22:01 like low-level C you might optimize an inner loop

22:01 danlarkin: whole courses are taught on this very topic

22:01 I should know, I took one!

22:01 knabb: I should take one :) , netx year I can learn Basic in school...

22:01 but i know clojure,python, some C and Java already...

22:01 vogelrn: well, it kind of depends on what you're measuring

22:02 knabb: but if you know HS-math then it is easy right? I don't need any fancy uni-math for it so I could just buy a book?

22:03 danlarkin: there's a lot (_a lot_) of theory that goes behind Big-O notation

22:03 but if you just want the basics I'm sure the internet can teach you

22:03 rhickey: aking: I see here that a tie for arg types goes to first found - I'll need to change that to look at the modifiers - will have to wait until tomorrow

22:04 vogelrn: danlarkin: yeah, but you don't need to know a -huge- amount for most situations, what you do need to know is the order that they go in and have some grasp of how various data structures perform operations

22:04 aking: rhickey: cool - thanks! I'll clean up the couple of small changes to RT and send them to the list

22:05 vogelrn: oops, missed your second message

22:05 danlarkin: we're OT and rich can't take it! :'(

22:10 vogelrn: ugh, it does get nasty when dealing with trees though

22:10 sqrt(n)-ary trees, woohoo

22:21 achim_p: knabb: you basically count just the nested loops. O doesn't care about how many (simple) ops occur within a loop, that's just a constant factor. O(n) = O(1000 n). so O is the wrong tool for talking about inner-loop-optimization

22:22 nice introduction to analysis of algorithms: http://www.aw-bc.com/info/kleinberg/

22:37 knabb: how funny that it is much easier to get Clojure and new javalibs to work than to have new javalibs to work with java

22:38 vogelrn/achim_p/danlarkin: thanks

22:56 durka: what is clojure-slim.jar?

22:56 knabb: does ant need a specific build.xml for each project? or I can write a genral build.xml?

22:59 Chouser: durka: never heard of it. where did you find it?

23:00 durka: in svn 1190

23:00 or before

23:00 i just noticed it scroll by from ant

23:01 Chouser: huh. "clojure-slim jar file (omits compiled Clojure code)"

23:04 durka: foo

23:04 gorilla broke

23:20 knabb: does ant need a specific build.xml for each project? or I can write a genral build.xml?

23:45 Chouser: knabb: sorry, I don't use ant (except to build clojure itself).

Logging service provided by n01se.net