#clojure logs

2008-12-29

00:01ericlavignegnuvince: I used "Head First Java" as a Java intro book. It is easy to read quickly and does a good job covering the basics.
00:02ericlavignegnuvince: Java in a Nutshell is another good option.
00:04kabnyThinking in Java
00:05kabnythats what ill start reading tomorrow
00:05kabnydont know who it targets though
00:18gnuvinceI heard good things about Head First Java
00:18gnuvinceI just might check it out
00:23rhickeyachim_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
00:27Nafairhickey: Awesome!
00:27NafaiI was having problems last week when I tried it :)
00:28Nafairhickey: Is there still the dynamic classloader issue though?
00:28rhickeyNafai: there may still be others, including missing runtime library support etc, but at least this gets past the bytecode translation issues
00:28NafaiCool
00:28NafaiI'll give it a try
00:28NafaiI just need to figure out how to call a superclass method in an overriden method
00:29NafaiIs 1186 in trunk?
00:30rhickeydepends. 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
00:30rhickeyyes
00:31rhickeyNafai: check out the new :exposes-methods section of gen-class
00:31Nafairhickey: Thanks
00:35NafaiNow I need to write a ant task to compile clojure code
00:40kabnyrhickey: If one would want to rewrite the compile-function, what exact stuff would one need to change?
00:41rhickeykabny: rewrite for what purpose?
00:42kabnyfun
00:42kabnyspeed
00:43kabnyim thinking for Android
00:43kabnyhmm if it is efficient enough we should get an Android lib for contrib
00:44rhickeyI don't understand - Android translates JVM bytecode, which is what Clojure generates
00:46NafaiYeah
00:46NafaiClojure generates JVM bytecode
00:46NafaiAnd then you use the Android tools to compile JVM bytecode into dalvik bytecode
00:46NafaiAnd then that is packaged in an apk
00:48NafaiHas anyone written any ant code to compile clj code?
00:49ChouserNafai: I think so. have you searched the google group?
00:50kabnyapk is rougly a .jar for Android?
00:50NafaiFrom what I understand, I believe so
01:05replacarhickey: I added an issue to the google code issues list. Was that OK? I only noticed later that it was still your private sandbox.
01:11NafaiAnyone help me? http://paste.lisp.org/display/72771
01:12NafaiI'm trying to figure out how to use :exposes-methods correctly
01:13ChouserNafai: just a stab in the dark, but you might try moving your import block into the ns macro call.
01:14Chouser(ns ...hello (:import (android...)) (:gen-clas ...))
01:14NafaiHrm
01:14Chouser:gel-class with two s's of course
01:15inertia-what is the ETA for 1.0?
01:17NafaiChouser: No luck: http://paste.lisp.org/display/72771#3
01:19Nafain/m
01:19NafaiI'm silly :)
01:19Chouseroh?
01:19Chouseroh
01:21NafaiHow about this one? http://paste.lisp.org/display/72771#5
01:21NafaiThe code is right above that annotation
01:22NafaiI'm not sure what to make of that error message
01:28Chouserhah, sweet. I just fixed the implementation of a method on an existing instance.
01:28gnuvinceJust caught a message on the mailing list from a gentleman who wondered why there was no mod in Clojure (and I guess div too)
01:28Chouserknew it was possible, just hadn't ever done it yet.
01:29gnuvinceDo you think this sort of change is minor enough that Rich wouldn't mind integrating them?
01:29NafaiAny idea on my last error message?
01:29Chousergnuvince: he said a patch to add 'mod' is welcome.
01:30Chousergnuvince: http://groups.google.com/group/clojure/browse_thread/thread/f5d20852622430bd
01:31ChouserNafai: you're getting the error when you run (compile ...)?
01:31NafaiChouser: Yessir
01:31gnuvinceChouser: I'm not a registered contributor
01:32kabnyhow big is the cache ina modern desktop computer?
01:32gnuvincekabny: CPU cache?
01:33Chousergnuvince: it's easy to register, just send in your CA
01:33ChouserNafai: I've got a working example of :exposes-methods on a subclass of Thread now
01:33ChouserNafai: not seeing that error yet
01:34kabnyyes
01:34NafaiChouser: Am I using it the same as you?
01:34replacaNafai: try :name HelloWorld ... :extends android.app.Activity
01:34replacait shouldn't be strings
01:34ChouserNafai: yes, but of course I don't have to import anything. I'm still suspicious about that part.
01:34gnuvincekabny: can't find the info for L1, but L2 is about 4MB according to Intel specs
01:35gnuvinceL1 is probably in the KB range
01:36gnuvince32-64 KB is probably a good guess
01:36Nafaireplaca: Still the same error
01:36ChouserNafai: your code's messed up. you've got the 'defn' inside the 'ns' call now.
01:37NafaiYeah, noticed that now :)
01:38NafaiOkay, now it is complaining it can't find onCreateSuper
01:38kabnyL1 and L2 are what? dualcore?
01:38kabnyit is the data cache im wonmdering about whatever that is
01:38ChouserNafai: good. Try (.onCreateSuper ...) instead (note leading dot)
01:38NafaiAm I using :exposes-methods right?
01:39NafaiSweet
01:39NafaiSo when I import something
01:40NafaiDo I still have to refer to it's fully-qualified name?
01:40Chousernope, that's the point of importing it.
01:40ChouserI don't think it's right to have your namespace named differently from your gen-class
01:41NafaiWhat should it be?
01:41ChouserNafai: what is (. setContentView tv) -- does that work?
01:43NafaiWell, it's not getting that far because it is complaining about TextView
01:43NafaisetContentView is a superclassmethod
01:44Chouserok, here's my best guess: http://paste.lisp.org/display/72771#6
01:45Chouserthat's got the namespace/classname/filename matching, the correct usage of :import in 'ns', and what may be the correct call to setContentView
01:45kabnyis there no way to import a whole packaghe?
01:45Chouserkabny: correct
01:47kabnywhy not?
01:48NafaiChouser: Okay, I had to use the fully-qualified name for Activity in :extends, because it thinks I'm wanting java.lang.Activity
01:48NafaiAnd then I get this error:
01:48kabnyit is fairly annoying if it is huge and you need most of them?
01:48Nafaihttp://paste.lisp.org/display/72771#7
01:48Nafai(Thanks for all the help, btw)
01:50Chouserkabny: I believe importing all classes from a package has been described as a mis-feature.
01:50Chouserkabny: personally, I dislike trying to make sense of code that include names brought in from unknown sources.
01:50ChouserClojure has this problem also (IMO) with the 'use' function.
01:51ChouserNafai: where's the extra ".hello." coming from?
01:51NafaiChouser: I also added that, because that's the full package name
01:52ChouserNafai: ok, and you've got it in the file path and the namespace name as well?
01:52ChouserNafai: and you have the value of *compile-path* in your classpath?
01:53NafaiYes, I believe so
01:54ChouserNafai: 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.
01:54NafaiOk
01:55Chouseryou might also check that directory -- it seems likely you've got a buch of class files in there now.
01:57NafaiI didn't correctly, so I've fixed that now
01:57NafaiNow I get this exception:
01:57Nafai java.lang.Exception: namespace 'net.travishartwell.android.hello.HelloAndroid' not found after loading '/net/travishartwell/android/hello/HelloAndroid' (precompile.clj:0)
01:58kabnyis there any need for use at all? why not take it away?
01:59Chouserkabny: 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.
01:59ChouserNafai: you changed the name from HelloWorld, or is that some other class?
02:00NafaiAh :)
02:00NafaiFixed that now
02:01NafaiSweet, it built!
02:01Chousernice
02:01Chouserwell, I'm off to bed. Happy androiding.
02:01kabnycongrats Nafai, post how you did on the google group ok?
02:02kabnyIm gonna try to get it going tomorrow
02:02Nafaikabny: Sure will, in the morning :)
02:02kabnyrhickey: would refs and agents work to translate to dex ?
02:02kabnyie if some of clojure works on android, do all then?
02:03Chouserkabny: I don't think refs and agents are likely to be a problem. Inside they're not using particularly unusual features of Java.
02:04ChouserNafai: "built" as in .class files, not all the way to android files (whatever they're called) right?
02:07NafaiChouser: Nope, all the way :)
02:08Chouseroh, beautiful.
02:08kabnyChouser .dex
02:08NafaiDarn
02:08NafaiDidn't quite work
02:09NafaiWhen I run it in the emulator, I get a force close dialog
02:10kabnyhappens to me with java too though sometimes
02:10kabnydont quite know why yet
02:11NafaiCode that compiles: http://paste.lisp.org/display/72771#8
02:11kabnyis a namespace in clojure the same as package in java?
02:11NafaiError from Android:
02:11Nafaihttp://paste.lisp.org/display/72771#9
02:12ChouserNafai: you need the square-brackets in :exposes-methods?
02:12NafaiIt compiled with them
02:12NafaiI guess it's fine without them too
02:13Chouserdon't use them -- it'll give you a runtime error, I think.
02:14NafaiOk, trying again
02:15Chouserkabny: not quite -- every Clojure function is a Java class, and every Clojure namespace compiles to one or more Java classes.
02:15Chouserkabny: a namespace foo.bar.baz will compile to a bunch of classes in a foo.bar Java package
02:16Chouserok, bed now, really. g'night!
02:31fffejI'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?
02:37replacafffej: 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?)
02:39fffejreplaca: 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
02:41replacayeah, you can also use "sorted-map" here:
02:41replaca(into (sorted-map) (zip-map ...))
02:42replacaif you want to keep it in a map
02:42replaca*zip-map = zipmap
02:42fffejreplaca: thanks, I didn't know about into - that looks the more "idiomatic" way to do things, so I'll use that, thanks
02:45replacacool, enjoy
02:45replacaof 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.
02:46fffejnot sure what you mean there? could you give an example?
02:46replaca(into (sorted-map) (map #(vector %1 %2) (range 1 100) foo))
02:47replaca... I think that does it ...
02:47Lau_of_DKMorning guys
02:48replacaIt's Lau! That's my signal that it's bedtime!
02:48fffejlooks like it does - is %1 and %2 shorthand for the two args? I've never seen the #(vector %1 %2) syntax before
02:48replacaMorning, Lau.
02:49replacafffeg: yeah, that's shorthand for (fn [a b] (vector a b)), very nice for use with map and other quick lambdas
02:50fffejthanks replaca, I always seem to learn more here in 5 minutes than I do spending an hour just tottering around
02:51Lau_of_DK:)
02:51replacano prob. I'm on the same road. :-)
02:53eldokwhat is the timecomplexity for insert/lookup in a sorted-map?
02:53eldokO(1) still?
02:53replacaAre clojure maps really O(1)? I think they're O(logN)
02:54replacabased on a functional implementation of red-black trees
02:55replacaoh no, that's just sorted maps
02:55replacaso, sorted maps are O(logN)
02:57replacaregular maps are O(1)
03:33yangsxWould it be reasonable to request re-pattern automatically escape the string?
03:46Lau_of_DKyangsx: Does it add/remove any options?
04:06yangsxLau_of_DK: I ask because that would be easier for me to str some strings to be used in re-matches
04:07yangsxor I'm forced to call Pattern.quote in my code
04:13Lau_of_DKok, I guess you would want to talk with RSchulz when he gets in, he has good insights on regex/clojure
06:03bOR_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.
06:03bOR_thought we had this as a function already.
06:03bOR_and good afternoon everyone :)
06:08bOR_nevermind, I'll write something =)
06:10kotarak(condp instance? s Number (list s) IPersistentList s) (Not tested)
06:11bOR_ah. that brings me to a bigger problem. Not all functions are in the api.
06:11bOR_I kept thinking I was missing functions in the clojure.org api page.
06:11bOR_thanks for the help.
06:11kotarakcondp is relatively recent...
06:13bOR_thought the api was auto-generated.
06:13bOR_but good to remember.
06:14kotarakHmm... maybe Rich has to push the "automatic generation" button manually? ;)
06:24bOR_ok. done for today with the clojure project, back to the previous one :)
08:45achim_prhickey: thanks a lot for looking into the dx/bytecode issue!
08:46rhickeyachim_p: sure - anyone have any luck so far?
10:42mchurchI 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:42mchurchWhy is this, and is there any way to truly catch all error conditions (except possibly for OOM type stuff that nothing can catch)?
10:43mchurchIt seems like stack-blowing should not fall through a try-catch.
10:44Chousermchurch: try catching Throwable instead of Exception
10:44mchurchChouser: Works beautifully.
10:45mchurchChouser: So shall I assume Throwable is a superclass? What's the semantic distinction between Throwable and Exception?
10:45ChousukeThere are two kinds of Throwables
10:45ChousukeErrors and Exceptions
10:46Chouseryes, Throwable is the base class of all things that are, well, throwable, including Exceptions.
10:46Chousukeor hm, was UncheckedException separate from Exception?
10:46mchurchChouser: 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:46Chouseryour question about the distinction is a Java question, and one I'm not really equipped to answer.
10:47Chousukemchurch: something like that
10:47ChouserI think a major part of the distinction is between checked and un-checked exceptions.
10:47kotarakmchurch: I would think so.
10:47markaddlemanan Error is a throwable which occurs when there is some kind of unrecoverable JVM error that prevents further computation
10:48markaddlemanfor example, division by zero, stack overflow or internal JVM bug
10:48Chousukecatching Throwable is considered bad style I believe.
10:48markaddlemanexceptions are intended for programmatic or environmental problems
10:49markaddlemanyes, it's very rare to have a legitimate reason to catch Throwable
10:49mchurchChousuke: This makes sense
10:49mchurchChousuke: "Catch-all-error" constructions tend to indicate poor forethought and bad field performance
10:52Chousukemchurch: I believe clojure makes use of a catch-all though.
10:52Chousuketo work around java's checked exception stuff.
10:53bOR_catch-all-errors and return nil.
10:53bOR_that sounds horrible ;)
10:56markaddlemani'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:56markaddlemanthe following code does not work:
10:56markaddleman(defmacro m1 [l]
10:56markaddlemanwhoops... try again: (defmacro m1 [l] `(take-while #(true? %) l))
10:57markaddlemanbut this does: (defmacro m2 [l] `(take-while (fn [p#] (true? p#)) ~l))
10:57Chousukewhy do you need the anonymous function?
10:57markaddlemanit has something to do with clojure's scoping rules, i think.
10:57Chousukemchurch: the #() reader macro expands into something that breaks macro rules.
10:57markaddlemanthe anonymous function is just a syntactic convenience
10:58Chousukemarkaddleman: just use fn in macros
10:58Chousukeinstead of #()
10:58kotarak"#() is not a replacement for fn" (from the docs)
10:59Chousukebut in that particular case, couldn't you just use `(take-while true? ~l)
10:59markaddlemansure, but my real code needs a function
11:00Chousukeuse fn then
11:00kotarakclojurebot: macro
11:00clojurebothttp://groups.google.com/group/clojure/browse_thread/thread/bba604cee3b232d9/28837d55525306d8?lnk=gst&amp;q=recursive+macroexpand#28837d55525306d8
11:00kotarakclojurebot: macro help
11:00clojurebotmacro help is http://clojure-log.n01se.net/macro.html
11:01markaddlemankotorak: thanks for the pointers
11:01kotarakThe first was actually no pointer. ;)
11:01kotarakI suspected the second.
11:01markaddlemanheh
11:01Chousukethat form will not work since lisppaste8 is gone
11:01kotarakThis is gives some help which information is helpful when debugging macros.
11:02kotarakYes. Unfortunately the lisppaste bot has holidays.
11:04rhickeymchurch: catching Throwable is not advised, at least not without great care
11:08Nafairhickey: 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:08Nafaihttp://paste.lisp.org/display/72771#9
11:08NafaiIt's a problem in Clojure itself
11:09NafaiSince there are not .class files in Dalvik
11:11NafaiI'm getting ready to fly back home from visiting my in-laws, but I'll get my code available sometime soon
11:14rhickeyNafai: I see and understand - will look into it
11:15NafaiThanks!
11:21mchurchrhickey: 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:22mchurchI 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:22rhickeymchurch: you can use a Java debugger like JSwat, which will let you set breakpoints and step-debug Clojure code, see locals etc
11:23rhickeyIf you haven't tried that you can't judge Clojure's debugability
11:23mchurchrhickey: Ok, thanks. I'll look into JSwat. Do I need to be knowledgeable about Java to use it?
11:24rhickeymchurch: not really, people here can help
11:31mchurch(take 3 [1 2])
11:31mchurchWhoops. Sorry.
11:31grosourshi clojurians
11:31mchurchI was testing what error Clojure throws on an overreaching take from a vector; wrong buffer.
11:31kotarakmchurch: it returns nil
11:33mchurchkotarak: It returns (1 2).
11:33kotarakyep.
11:33kotarakwas thinking drop
11:33mchurchAnyway, it was not my intention to use IRC as a Repl, and I apologize. :)
11:45Chousukemchurch: nah, you can do that
11:45Chousuke,(println "hello!")
11:45clojurebothello!
11:47mchurch,(+ 1 2 3)
11:47clojurebot6
11:47mchurchChousuke: Very cool
11:47mchurchChousuke: But is that not dangerous?
11:47kotarak,(take-over-the-world)
11:47clojurebotjava.lang.Exception: Unable to resolve symbol: take-over-the-world in this context (NO_SOURCE_FILE:0)
11:48Chousukemchurch: only if the sandbox has holes.
11:48mchurchChousuke: "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:48mchurchChousuke: Ok. What if someone set off an infinite loop? (I don't intend on trying it.)
11:49Chousuke,(loop [] recur)
11:49clojurebotjava.lang.Exception: Unable to resolve symbol: recur in this context (NO_SOURCE_FILE:0)
11:49Chousukeeh, blah
11:49Chousuke,(loop [] (recur))
11:49Chousukeshould timeout
11:49Chousukein about 10 seconds
11:49clojurebotExecution Timed Out
11:49Chousukeyay
11:49mchurchChousuke: Ok. I just don't want to put one in the failbox and end up a celebrity before my time.
11:50Chousukeheh
11:50mchurchChousuke: At my current level of competence, being well-known in any context is undesirable.
11:50Chousukethe timeout functionality was added after clojurebot was once sent into an infinite loop :P
11:50ChousukeI think it's still possible though.
11:50achim_pmmm, 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:50Chousukeby spawning a thread.
11:51Nafaiachim_p: rhickey is looking at it
11:51achim_pNafai: cool!
11:52Nafaiachim_p: I got this last night: http://paste.lisp.org/display/72771#9
11:52rhickeyachim_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:52Nafaiachim_p: From the way I'm interpreting it, it's not that getResource() isn't supported
11:52Nafaiachim_p: It seems that it is that there are no .class files
11:53NafaiBecause of the compiling down to dalvik
11:53NafaiI was going to write an experiment when I get a chance to see what can be loaded from the classpath
11:54mchurchChousuke: Has anyone accidentally set off the Clojure Repl?
11:55achim_prhickey: 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:56achim_pURLClassLoader isn't documented to behave differently
11:57Chousukemchurch: you mean, running repl?
11:57Chousukehmm
11:57Nafaiachim_p: I should probably look at the docs closer :)
11:58mchurchChousuke: Not necessarily an infinite loop. I'm just wondering if anyone ever typed something that set off the Clojure bot.
11:58mchurchChousuke: Someone was typing carelessly with examples ,(+ 18 23)
11:58mchurchI guess that *didn't* set it off.
11:59mchurchChousuke: It would be a cool surprise if unexpected.
11:59achim_pbut i don't really know - just started playing with android yesterday
11:59Chousukeit only accepts lines that start with ,(
11:59mchurchChousuke: Got it. So an inline ,(form) wouldn't have that effect.
12:00Chousukeyeah
12:00Chousukethough clojurebot has a bug in its "bad-forms" function
12:00mchurchChousuke: 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:01mchurchChousuke: On Fark back in 2002.
12:01mchurchChousuke: What's the bug?
12:02rhickeyNafai: ok, svn 1188 added speculative load when no .clj or .class resource found, for Dalvik VM
12:02Chousukeit considers for example "defn" a bad form
12:02Chousukebut clojure.core/defn is fine
12:02Chousuke:P
12:02Chousukemoral of the story: blacklists are not secure
12:03danm_heh
12:03mchurchChousuke: This makes sense. You don't wnat the namespace to get cluttered up.
12:03mchurchThis should also fail (hopefully):
12:03mchurch,(def x 4)
12:03clojurebotDENIED
12:04Chousukewell it's also easy to clean up
12:04mchurch,(let [x 1 y 2] (+ x y))
12:04clojurebot3
12:04mchurch,(let [f (fn [x] (* x 2))] (f 13))
12:04clojurebot26
12:05mchurchChousuke: True.
12:07Chousuke,(clojure.core/defmacro mydef [& rest] (concat (list (symbol "def")) rest))
12:07Chousukehmm
12:07Nafairhickey: I'll give it a try
12:08Chousuke,(mydef x 1)
12:08clojurebot#'foo/x
12:08mchurch,(+ x 1)
12:08clojurebot2
12:08mchurchChousuke: Uh oh.
12:08Chousuke:)
12:09mchurchChousuke: So it lets you do defmacro but not defn?
12:09mchurch,(defmacro m [] `(+ 1 2))
12:09clojurebotDENIED
12:09mchurch,(clojure.core/defmacro m [] `(+ 1 2))
12:09Chousukethat works.
12:09mchurch,(m)
12:09clojurebot3
12:10mchurch,(clojure.core/defn f [] (rand))
12:10ChousukeI think defn is useful for it though.
12:10clojurebot#'foo/f
12:10mchurch(f)
12:10mchurch,(f)
12:10clojurebot0.6791550154947764
12:10Chousukewhat's wrong with clojurebot's svn report functionality though
12:10Chousukemy bot is reporting stuff just fine
12:11mchurchChousuke: I guess it makes you package-qualify defn/defmacro to keep the script kiddies out. :)
12:13Nafairhickey: http://paste.lisp.org/display/72771#10
12:13Chousuke,(dorun (map #(ns-unmap *ns* %) (keys (ns-interns *ns*))))
12:13Chousuke,(f)
12:13clojurebotjava.lang.Exception: Unable to resolve symbol: f in this context (NO_SOURCE_FILE:0)
12:18rhickeyNafai: have you got your classpath setup correctly?
12:19rhickeyNafai: findClass shouldn't be called unless parent loader can't find it, and it should
12:19Nafairhickey: Good question. Let me check my manifest
12:20NafaiHrm. The manifest isn't setting the classpath, that's probably the issue now
12:29ChouserWhy doesn't AFn support withMeta, even though it's an Obj and therefore has a _meta member?
12:32rhickeyChouser: I've been on the fence about it - two values of the same fn, also would need to gen code for it
12:33rhickeyI'm going to try to standardize metadata for ref types soon.
12:33rhickeyref/atom/var/agent/namespaces
12:34Chouserwhat do you mean by standardize?
12:34rhickeyuniform support
12:34dreishAlmost there: http://www.google.com/trends?q=clojure%2Cocaml&amp;ctab=0&amp;geo=all&amp;date=ytd&amp;sort=0
12:35rhickeyhttp://www.google.com/trends?q=clojure%2Cocaml%2C+jython%2C+jruby&amp;ctab=0&amp;geo=all&amp;date=ytd&amp;sort=0
12:35dreishNice.
12:36dreishThose are better comparisons.
12:37Chouseryet plenty of room to grow: http://www.google.com/trends?q=clojure%2C+python%2C+ruby&amp;date=ytd
12:37dreishThe problem with those is they have so many other widely-used meanings.
12:37Chousergood point!
12:37rhickeyOregon cop battles 12-foot python to save pet store owner
12:38rhickeyPython eats Australian family dog
12:38vogelrnyeah but the programming uses probably dwarf the other ones
12:38rhickeyWoman Finds Python In Washing Machine
12:38dreishlol
12:38dreishMaybe it was the language!
12:38ericlavigneRegarding popularity, I'd be more concerned about this one: http://www.google.com/trends?q=clojure%2Cejb&amp;ctab=0&amp;geo=all&amp;date=ytd&amp;sort=0
12:40ericlavigneIt'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:41rhickeyClojure does have plenty of room to grow
12:42dreishIt 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:43ericlavignedreish: 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:00drewrIn clojure.main, what gets triggered as the result of it being the Main-Class in the jar?
13:32Chousukehmm
13:34drewrI've got a main.clj with (ns foo.bar (:genclass)), java -jar foo.jar tells me NoClassDefFoundError.
13:35drewrEr, (ns foo.bar.main (:genclass)) actually.
13:43duck1123Has anyone ever seen an issue where emacs/slime will connect to a swank server, but not open the repl?
13:44duck1123the slime connections buffer shows a connection, but selector doesn't even give me an option for the repl
13:46drewrduck1123: How do you start your slime connection?
13:46duck1123M-x slime-connect
13:46danlarkinI use M-x slime
13:47drewrI use M-- M-x slime (so I can choose the lisp).
13:47duck1123I'm connectiong to an already running clojure instance
13:48duck1123my server logs show that the swank server has started listening, and it makes the connection just fine
13:48akingduck1123: Doesn't seem to work with the latest slime - I had to back up a few versions to have a working repl again
13:48duck1123just no repl
13:48duck1123aking: that's probably what I'm seeing. I just updated
13:51akingduck1123: I had to revert slime to Dec23 to have it work again
13:56RaynesI 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:56drewrWhy is this blank? http://clojure.org/repl_and_main
13:57drewrRaynes: Look for .class files in your cwd.
13:58Raynescwd?
13:58drewruser.dir
13:59RaynesNada.
13:59drewrYou used (compile)?
14:00drewrSLIME's compile only loads the source into the jvm.
14:00triddellRaynes: you executed (compile 'clojure.examples.hello) or did you do M-c, M-k?
14:00RaynesI used the compile button on Slime.
14:00drewrGo to the REPL and do (compile ...).
14:01triddellI meant C-c, C-k I guess
14:03duck1123resetting slime back to the 23rd did the trick
14:03replacaBest thing I've recently discovered: paredit. Makes writing code in slime much more stream of consciousness.
14:04duck1123until it gets in your way
14:04duck1123I love paredit, but I find I sometimes need to turn it off to do things I want to do
14:05replacaYeah, ^Q ( can be your friend :-)
14:05duck1123that, and paredit messes up some of my navigational keystrokes in emacs over ssh
14:06replacayou could override maybe
14:06replacaI usually don't use emacs over ssh
14:06replacabut spawn a remote X window
14:07replacaDoes anyone use redshank with clojure?
14:07replacaLooks like it might require some tweaking
14:07RaynesWhere do files compile too when you compile them? I can't find it ._.
14:08drewrRaynes: In user.dir.
14:08replacaduck1123: For example?
14:08drewrRaynes: E.g., (System/getProperty "user.dir")
14:09RaynesThat's weird, usually things compile to the same directory that they are in.
14:10RaynesEr wait, it is the same directory their in.
14:10RaynesNothing there... The hell...
14:21Lau_of_DKdrewr: You actually use paredit regularily ?
14:29duck1123replaca: paredit over ssh will take my page up/down and home/end keys and insert other sequences
14:29duck1123it only happens when paredit is enabled.
14:33replacaduck1123: ahh, cause they're escape seqs on a term so they look like meta commands to paredit. Bummer.
14:33replacaduck1123: you could rebind paredit around that with a hook
14:35duck1123replaca: It might be worth it. I use my emacs at home from work to do my clojure coding & irc
14:35drewrLau_of_DK: Yep.
14:36Lau_of_DKdrewr: I was under the impression that it had bad bugs and wasnt in ver. 1.0 yet, am I mistaken ?
14:36Lau_of_DKor more to the point: Am I missing out by not using?
14:36drewrI haven't had any problems with it.
14:36drewrLau_of_DK: Just speed. :-)
14:37drewrIt's like Emacs; once you use it you won't be able to go back.
14:37Lau_of_DKuuuh, sounds good
14:40RaynesIt's compiling - But it's not there. This has got to be the stupidest problem I've ever had before.
14:44billcLau_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:44drewrRaynes: find $HOME -name \*.class :-)
14:45RaynesI hate windows computers.
14:46replacaThe 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:47replacaLau_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:48replacaAnd it always adds the close delimiter when you make the open so everything stays balanced all the time
14:48billcreplaca: 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:49Raynes$HOME would be the user directory on windows right?
14:51duck1123billc: I've taken to just killing the region when I want to delete it.
14:51drewrI didn't love it until I got comfortable with C-k, C-M-f, C-M-b, and C-).
14:52replacabillc: 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:53replacadrewr: 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:54billcduck1123: 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:54duck1123M-( and M-s are my friends :)
14:54gnuvinceHi everyone
14:55duck1123billc: 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:55drewrduck1123: Yeah, I forget about those.
14:56drewrI find it quicker to C-k and retype.
14:56duck1123oh yeah. DEL also has problems over ssh. Have to resort to C-d
14:56shooverRaynes: what's the value of *compile-path* in your REPL? that should be where compilation output goes regardless of OS
14:56billclisppaste8: url
14:56drewrshoover: Oh, shoot, forgot that.
14:57billchmm, lisppaste bot seems to be down, just a sec...
14:58shooverRaynes: also, when in Windows, ProcMon.exe is your friend for such matters
15:00billcduck1123: Here's what I use to override paredit DEL/BS:
15:00billchttp://paste.lisp.org/display/72793
15:01replacaduck1123: 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:05replacabillc: lisppaste8 has been on "vacation" for a few days. I don't know if anyone knows why.
15:05billcreplaca: does chandler maintain it or someone else?
15:05replacabillc: no idea
15:06replacait's just always been there
15:06billcreplaca: I'll check with chandler (he maintains the #lisp bot) and see whether he can restart it
15:07drewrbillc: Yes, chandler. He doesn't hang out in here though. I requested lisppaste to join.
15:09billcdrewr: do you mean you can get lisppaste to join #clojure or that you asked chandler to set it up?
15:09drewrbillc: I asked him to set it up.
15:10billcdrewr: ok, I'll see if I can let him know it's down
15:10drewrYou can also email rt@common-lisp.net.
15:12billcdrewr: thanks
15:15duck1123billc: thank you. That did the trick.
15:18djjackhttp://www.google.com/trends?q=clojure%2Cocaml%2C+jython%2C+jruby&amp;ctab=0&amp;geo=all&amp;date=ytd&amp;sort=0
15:18djjackcrap, sorry about that...
15:18djjackwas copying from earlier in the buffer
15:19chrisnthe swedes love clojure?
15:19chrisnalong with sf, and ny
15:22RaynesOh, it's compiling into clojure\classes
15:24shooverRaynes: 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:13drewrlisppaste8: Welcome back!
16:13chandlerbillc: Hi!
16:13drewrlisppaste8: url
16:14chandlerbillc: 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:14lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
16:14billcchandler: hi!
16:14billcchandler: thanks, that's good to know
16:15chandlerI don't have any automated monitoring mechanism right now. Volunteers welcome...
16:15billcchandler: and, thanks for the quick response!
16:15chandlerOh, also, I'd love for someone to volunteer to write a Clojure lexer / formatter for lisppaste...
16:16Chouserchandler: I suppose that would have to be written in CL?
16:16chandlerYes, but it's not too complicated as it's essentially a DSL
16:16chandlerSee http://paste.lisp.org/system-server/show/lisppaste/coloring-types
16:17chandlerIt 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:18billcchandler: 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:19Chouserchandler: thanks for providing lisppaste. I'm not eager to write CL code, so hopefully someone else will rise to the challenge.
16:19chandlerbillc: 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:21chandlerbillc: If at least one is missing, it would send an email - or for more advanced usage it could kick the process automatically
16:24billcchandler: hmm, seems like there should be something like that already available (with all the irc bots that regularly monitor channels)
16:24chandlerI've never run across anything like that, but it's possible.
16:28mchurchDoes anyone here have an opinion on Stuart Halloway's Programming Clojure?
16:28mchurchI know the book is in beta and the paper form doesn't come out till 28. April, but the PDF is available online.
16:30ChouserI 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:34mchurchChouser: Good to know. Thanks.
16:36mchurchChouser: 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:36Chousukehow's your java?
16:37Chousermchurch: 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:37Chousukeyou don't need to know java the language per se to use clojure, but knowledge of the class library is essential
16:38Chousukeand I guess some ability to read java is needed to read javadoc :/
16:40mchurchChousuke: my Java's mediocre.
16:40mchurchChousuke: oddly enough, I'm much better w/ SBCL than Java, even though I have 3x as much Java exposure
16:40mchurchChousuke: This is why I find it hard when people complain about functional languages being "hard". I'm thinkin', "what?"
16:41danlarkinhard aka different
16:41mchurchdanlarkin: I think the only reason why Java is considered "easier" than Lisp is that Java's closer to the imperative Basic model.
16:42mchurchdanlarkin: 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:48Chousukeoh nice :(
16:49chrisnas someone who is just learning fp, just figuring out how clojure.contrib.lazy-seqs.fib works took a lot of thinking
16:49chrisnThat is why it is hard, you program at a higher level of abstraction.
16:50Chousuketoo bad mchurch went to the other side of the split :/
16:50chrisnno kidding
16:50Chousukehooray
16:52Chousukemchurch: 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:52Chousukewith a "pure" function, the knowledge that it is pure and its name and arguments may be enough to tell you what it does.
16:52mchurchChousuke: Yes. Referential transparency is a huge win.
16:54mchurchChousuke: 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:55vogelrnmchurch: 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:55Chousukewell, the most common languages are not very well suited for FP
16:56Chousukevogelrn: I don
16:57ChousukeI don't think you can become a programmer by learning just patterns :/
16:57Chousukeyou have to have some kind of a mental model of what the text you write signifies.
16:58kotarakit's as with Joseki in Go: you have to *understand* them, not blindly learn them
16:58mchurchI'm with Chousuke and kotarak on these.
16:58Chousukein the beginning they give you some help as simple patterns though.
16:58vogelrnwell, 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:58Chousukeyou see a situation, apply joseki, hooray.
16:59Chousukebut if you want to get stronger that is not enough :/
17:00inertia-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:00inertia-o
17:00vogelrnyeah 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:03vogelrnI 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:03mchurchvogelrn: That's poor education, in my opinion.
17:03inertia-what do you think about mit's intro to programming course using python now, instead of scheme?
17:03vogelrnpoor, but typical
17:03inertia-yeah i wouldn't learn programming through classes imo
17:03inertia-(but i am biased since that isn't even my minor)
17:04mchurchvogelrn: 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:04inertia-"90s egalitarianism" haha
17:04mchurchinertia-: Well, you don't learn programming from CS courses. You learn CS.
17:04inertia-egalitarianism !=> poor average performance
17:04vogelrninertia-: which course # is that? I have a friend going there, she took one class that did python but she wasn't very impressed
17:05mchurchinertia-: 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:05inertia-clojure is an ideology-free zone!
17:05mchurchinteria-: Granted, I'd much rather live in the '90s than this decade (although the election of Obama is pretty awesome)
17:05inertia-clearly racism is over
17:05inertia-vogelrn: dunno, whatever freshman CS course used to use SICP
17:05mchurchinertia-: Sadly, no. But this is a huge step in the right direction.
17:06mchurchinertia: Anyway, let's quit the politics. Back to CS...
17:06inertia-on HN the other day someone criticized a hacking cooperative in europe for advocating "hacktivism"
17:06inertia-the guy/gal wanted people "just to code"
17:06inertia-as if a hacker without passions is something the world really needs
17:07mchurchinteria-: 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:07mchurchYou pretty much have to learn the "how" on your own, but CS courses can give you a conception of the "why"
17:07drewrvogelrn: 6.001.
17:08inertia-mchurch: however, using a language with more expressive power allows one to experiment with CS concepts easier
17:08inertia-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:10mchurchinertia-: I agree with you.
17:10inertia-in other news, inertia- would love a clojure specification, implementable on other VMs
17:10inertia-llvm + clojure = yaey
17:10mchurchinteria-: I think CS education would be improved if courses used better languages.
17:10inertia-my school is a java shop and all the faculty have windows on their computers
17:10drewrinertia-: Not sure that's possible given the JVM-specific nature of the language.
17:10inertia-yet a lot of them are decent researchers
17:10mchurchinteria-: But I think that most CS departments have missed out on the PL "Renaissance" of the 2000s
17:11mchurch"Renaissance" possibly being the wrong word, since a lot of these langs. are brand new
17:11inertia-no that would be the right word
17:11inertia-just without the capital R
17:12mchurchinertia-: I guess it's the "re" I'm arguing against... Clojure is in "naissance" (birth) rather than "renaissance"
17:12inertia-FP is undergoing a renaissance then
17:12inertia-:)
17:12inertia-has anyone here used the hemlock editor?
17:13mchurchinertia-: I agree with this. Good languages and PL design concepts are being rediscovered, reborn... so "renaissance" is apropos.
17:14Chousukeinertia-: do you need a spec? use the current implementation and rhickey as your reference :D
17:15inertia-Chousuke: ah well i am not in a position to, say, port clojure to llvm right now
17:16billcchandler: you still around?
17:16chandlerbillc: Yes
17:16billcchandler: you might want to consider using something like what eggdrop does for restarting bots
17:16Chousukeinertia-: non-jvm versions of clojure will have problems finding a proper standard library though.
17:17billcchandler: it has a script that runs periodically to test if the bot is active and (if not) restarts it
17:17chandlerHow does the script work? Does it connect to the network and do a WHOIS?
17:17billceggdrop: http://www.egghelp.org/files.htm (autobotchk and botchk scripts)
17:18billcchandler: no, it just checks to see if the bot is active
17:18chandlerdefine "active" then?
17:18billcon the server where it's initiated from
17:18tayssirHi! Given a var, how do I get the underlying symbol? (I guess I want the inverse of "find-var" or "resolve" or someting.)
17:19chandlerbillc: 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:19billcah, so thedo the cl-irc bots automatically try to reconnect if they lose irc access
17:19chandlerfor some reason, I don't actually get a signal about that - I'm not sure why; maybe SBCL is eating it
17:20Chousukebillc: the metadata of a var contains its namespace and name
17:20Chousukeoops
17:20Chousuketayssir: you
17:20billcoops, meant to say "the cl-irc bots don't automatically try to reconnect"
17:20chandlerNo, they don't, and I'm not sure how to fix that
17:21tayssirChousuke: Ahh, cool, thanks!
17:21billcchandler: can the bot tell if it's still connected in some other manner?
17:21chandlerI could PING the server, I guess.
17:22billcchandler: 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:22Chousuketayssir: so (let [md (meta yourvar)] (symbol (.getName (:ns md)) (:name md)))
17:23chandlerbillc: the latter part is already done - it's run in a loop which restarts it automatically if for some reason it dies
17:24chandlerbillc: The biggest problem is that I don't have much time at all to work on things like this these days.
17:24StartsWithK_lisppaste8: help
17:24lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
17:24billcchandler: yes, common problem :-(
17:26tayssirChousuke: Interesting, that code throws "java.lang.ClassCastException: clojure.lang.Symbol" for me, but perhaps I can figure this out...
17:27lisppaste8StartsWitkK pasted "Strange struct/macro behaviour" at http://paste.lisp.org/display/72804
17:27StartsWithK_am i doing something wrong with struct in that snippet?
17:28kabnyThere 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:29tayssirChousuke: Weird, I must have a b0rken build of Clojure...
17:31kabnyand I kind of gravitated towards functional programming in Python naturally, but that doesn't seem to happen to everyone.
17:31Chousertayssir: 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:31Chousuketayssir: hm, maybe I typoed then
17:33ChouserStartsWithK_: The code you posted is incomplete, so I can't actually test it.
17:33tayssirYeah, 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:34ChouserStartsWithK_: 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:34Chousuketayssir: ah, the symbol function takes strings, but the name metadata is an actual symbol
17:35lisppaste8StartsWitkK pasted "Smapler example" at http://paste.lisp.org/display/72805
17:35tayssirChousuke: Aahhh, so using "str" around the params to "symbol" works! Thanks!
17:36Chousuke(let [md (meta myvar)] (symbol (str (.getName (:ns md))) (str (:name md)))) ; not very nice though :P
17:36Chouseranother way: (symbol (str (.ns #'map)) (str (.sym #'map)))
17:37Chouserwell, largely the same. :-)
17:37tayssirChousuke: Yeah, that's not really obvious from the documentation of "symbol".
17:37StartsWithK_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:37Chousukehow about (ns-resolve (.ns thevar) (.sym thevar))
17:38Chousukeno wait that returns the var /:
17:38Chouserheh
17:39Chousukewas there a function to qualify symbols with namespaces?
17:41ChouserStartsWithK_: odd -- I can also evaluate what macroexpand produces, without a problem.
17:41StartsWithK_i'm at revision 1132 if that helps :)
17:42Chouserah, but if I have print-dup on, I can see what macroexpand is really doing.
17:42tayssirChousuke: Maybe "resolve"?
17:42Chousuketayssir: that returns a var
17:42tayssirNo wait, that gives a var..
17:44kotarakChousuke: `symbol
17:45Chousukekotarak: that's read-time only though :/
17:46inertia-Chousuke: what is the proper standard library?
17:46Chousukefor clojure?
17:46inertia-implementations of all the java classes/whatnot already used in clojure?
17:46inertia-yes
17:46tayssirI wonder if the recent "quasiquote" does ` at eval-time now...
17:46inertia-i am responding to your comment above
17:46mchurchQuick 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:46Chousukethe clojure api + the java class library
17:46ChouserStartsWithK_: I think you've found a bug
17:47mchurchfind is a map function, and there's no member?
17:48Chousermchurch: you want to search a sequence for a particular value? or look through the members of a Java class?
17:48Chousukeinertia-: if you look closely, you'll notice the clojure api lacks many "basic" things. That's because they're already provided by java :)
17:49mchurchmchurch: just wondering if there's an analogue of (find 5 lst) that's shorter than (some #(= % 5) lst).
17:49mchurchChouser: I meant that to you, not me. My 2d embarrassing mistake here today.
17:49rhickeyChouser: struct literals are not supported in code - they don't have print-dup persistence
17:50inertia-Chousuke: what i'm really wondering, then, is how much of that functionality is only implemented on the jvm
17:50rhickeyStartsWithK_: struct literals are not supported in code - they don't have print-dup persistence
17:51Chousermchurch: (some #{5} lst) is an appropriate idiom.
17:51Chouserrhickey: is that a "not yet supported" or "no support planned"?
17:52Chouseror a "patch welcome" :-)
17:52Chousukeinertia-: I don't know how to answer your question. what do you mean "how much"?
17:53Chousukeinertia-: .NET for example probably has equivalent APIs for most things, but they're of course incompatible.
17:53rhickeyChouser: 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:54Chousukeinertia-: so using host interop directly would render clojure code unportable between two clojure implementations.
17:54Chousukeon different hosts that is.
17:54rhickeyone idea is to use a real class for the struct basis, a la the way proxies are now done
17:54knabbI'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:55vogelrnChouser: Is that usage of anonymous function literals documented somewhere? I didn't know that worked.
17:55Chousukevogelrn: it's a set
17:55vogelrnoh, whoops
17:56Chousukeusing it as a function may be surprising but it's probably the most clojurey code possible :P
17:56mchurchChouser: Ah, because sets are functions! Beautiful.
17:56chrisnknapp: I am writing an opengl graphics backend.
17:56chrisnyou could use it for anything
17:56mchurchChouser: That's really cool.
17:56chrisnworking on multisample fbo support
17:56Chousukemchurch: it also support searching for multiple alternative values :)
17:56vogelrnyeah I got it I just misread it because it was replacing mchurch's use of an anonymous function literal :P
17:56Chousukesupports*
18:00NafaiHere's the code I'm working on to try to write an Android application in Clojure: http://github.com/Nafai77/helloandroid/tree/master
18:01rhickeyNafai: does it work?
18:01NafaiIt includes instructions on how to run it
18:01NafaiNope
18:02NafaiStill 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:02hoeckknabb: did some physics simulation a while ago in clojure, not usable but i gained initial knowledge in the field
18:03Chousermchurch: I can't take any credit for that use of a literal set.
18:03inertia-Chousuke: it seems to me a clojure spec, a la rnrs, would be useful for porting to other VMs
18:05mchurchI have a Git emergency question. I was planning to head out the door and accidentally deleted a file.
18:06mchurchWhat command do I use to reset that file to pre-commit state without reseting the rest of the files?
18:06mchurcherr, not pre-commit
18:06mchurchmost recent commit
18:06Chousergit checkout
18:07mchurchChouser: Thanks. Worked beautifully
18:07mchurchChouser: I'm also a git noob. :)
18:08Chouserme too, pretty much, but it seems recovering from my own clumsiness is something I get plenty of practice with.
18:08ChousukeI wonder if there's a way to get the most recent in-index version of a file after deletion
18:08duck1123git takes a while to get used to
18:08Chousukemaybe git reset --soft?
18:11Chousukenah
18:16Chousukehmm
18:17Chousukeit seems even uncommitted changes are recoverable as long as they are in the index, but it requires manual searching
18:18Chousukeyou 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:56akingNafai: thanks for the android build instructions - I got your test app to build and install in a few minutes
18:57Nafaiaking: Cool. Note that it isn't yet working :)
18:57akingrhickey: it seems that 1189 broke the android dx compiler - I had to revert to 1188
18:58akingNafai: aye - I noticed that :) But I did see the same stack trace exception you've been seeing
18:58NafaiGood
18:59NafaiI was planning on writing some code tomorrow to figure out the ClassLoader behavior on Android
18:59NafaiI'm about to board a plane here in 10-15 minutes
18:59NafaiThough I might try it out tonight
18:59akingCool - don't update clojure though - it seems to break dx
19:00NafaiK
19:00NafaiWith a few of us working together, we can get this working! :)
19:02akingyes- I hope so. I want to port my current clojure gles2.0 code to work under Android\'s gles1.1 implementation
19:02NafaiThat would be nice
19:09akingrhickey: 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:10akinglooks like 1189 changed "public class Script" to "class Script" for some reason.
19:37replacanafai: on virgin atlantic they do. i've been flying them sfo-dc and writing clojure almost all the way :-)
20:06rhickeyaking: fixed in 1191
20:10duck1123would the inability to access protected variables in a constructor be due to a limitation in reflection?
20:11akingrhickey: Thanks - works now - though still seems to have issues with DynamicClassLoader when starting up in the emulator.
20:11duck1123I'm asking w.r.t. the 'accessing "this" in gen-class constructor' thread
20:13duck1123also, should it be considered good style that any scripts should define and use a namespace?
20:16Chouserduck1123: the :init function for gen-class is not actually a constructor. It must return values that are passed to the constructor.
20:17duck1123I just remember hearing that reflection couldn't see protected variables. (or was it only private?)
20:18Chouserlibs 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:19Chouserduck1123: 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:19duck1123I asked that question because snake didn't have a namespace
20:19Chouserduck1123: there is an :exposes option to provide access to protected members
20:20duck1123ok
20:24tayssirIs this supposed to throw an exception?
20:24tayssir (if false *unbound-symbol* false)
20:25Chousertayssir: yes, at compile time
20:26tayssirChouser: Duh, of course that makes sense...
20:26Chouserif you intend to def that symbol later, prior to running that line of code, it would be appropriate to forward-declare with 'declare'
20:28tayssirChouser: Actually, that's an interesting difference between Clojure and Common Lisp -- I was surprised when testing: (and (resolve '*timer*) *timer*)
20:28tayssirWhen I was trying to see whether *timer* was bound, so as not to kill the timer if it hadn't yet been initialized.
20:32Chousertayssir: 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:33tayssirChouser: Thanks, I'll check those out!
21:01dmiles_afkDotLisp is missing dotted conses is clojure?
21:02dmiles_afkwe are thinking about processing CycL returns from Clojure.. we are doing this in DotLisp.. but maybe we might also use clojure
21:02rhickeydmiles_afk: you're using DotLisp?
21:02dmiles_afkDotLisp has been a problem becasue it doesnt implement dotted cones too nicely
21:03dmiles_afkyes
21:03dmiles_afkbut at least DotLisp alows dotted conses to be faked
21:03dmiles_afktooks us a whiole to see (? . HI) was 3 lenght ;P
21:03dmiles_afka while
21:03rhickeyno dotted conses in Clojure
21:05dmiles_afkwhy is that? should a user make themselves a class like LispCOnses maybe?
21:05dmiles_afkcalled LispCons.. one that has that dotted behavour
21:06rhickeydmiles_afk: do you just want a pair? why not [x y] ?
21:08dmiles_afkwe 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:09dmiles_afkexisting .jar
21:09rhickeyI rarely hear from DotLisp users
21:09dmiles_afkwe just want to make sure we dont get *too* lossy
21:10dmiles_afk cycl2ClojureForm -> clojureForm2CycL
21:11dmiles_afkwell you wern't on irc .. but now glad you are!
21:11dmiles_afkwe been using it off/on for several years
21:14akingrhickey: 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:14rhickeyaking: tweaking how?
21:17dmiles_afkrhickey, here is a cool screenshot of it's use: http://24.16.246.158/manual/root/opt/CycD/dotdoom.jpg
21:17akingbasically, if baseLoader() fails to load a class in RT.classForName(), try the default classloader
21:18dmiles_afkif my DMZ is passing it correctly
21:19rhickeydmiles_afk: neat!
21:19lisppaste8aking pasted "Dalvikvm verify error " at http://paste.lisp.org/display/72811
21:19rhickeyDotLisp was a while ago...
21:20dmiles_afkour new project using it is http://code.google.com/p/opensim4opencog/
21:20dmiles_afkwe are probly going to use CLojure over IKVM since our configs are dotlisp
21:20dmiles_afkand clojure is so simular
21:21rhickeydmiles_afk: I guess that makes you a repeat customer :)
21:24dmiles_afkindeed.. 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:24dmiles_afkor whatever it takes to give clojure interative access
21:24dmiles_afkiterative
21:27rhickeyaking: 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:27akingrhickey: I'm not sure. I'll do some googling..
21:29akingjavap doesn't seem to show any problem with StringBuilder.append.. just does a checkcast then a invokevirtual for that 'bad' class
21:30rhickeyaking: it's a runtime resolution problem - will statically verify fine but fail to find method at runtime due to signature difference
21:31rhickeyi.e. the jdk you build with differs from the one you run with
21:34akingrhickey: 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:34rhickeyaking: it's a bridge method
21:37akingGuess I should try with Java5 then?
21:37akingI'm using 1.6.0_11 atm
21:37rhickeyaking: you might get lucky, I think the first method found is being used, will check on this end
21:40akingthanks - would rather not downgrade to Java 5
21:44dmiles_afksanity check.. rhickey.. (def-macro cloj (&rest args) args)
21:44dmiles_afki want (cloj foo bar) -> (foo bar)
21:44dmiles_afk(this is dotlisp tech support)
21:45dmiles_afki am just wanting to mark my forms like (set p 1) with (cloj set p 1)
21:46dmiles_afkbut i am getting error occured: Unable to cast object of type 'DotLisp.Symbol' to type 'DotLisp.Cons'.
21:46dmiles_afki dont think this is a dotted issue... i think its my macro
21:47dmiles_afk(def-macro cloj (&rest args) `(~@args)) ?
21:48rhickeyiirc (def-macro (cloj &rest args) args)
21:49dmiles_afkok good, yeah it must be something else that i did wrong somewhere
21:53dmiles_afkoh i see the (cloj ..)
21:55akingrhickey: yup - I just checked the method sigs in for both android's StringBuilder and java6 - and the return type is different
21:55knabbi thought O(N log N) was slower than O(N) but it is faster right?
21:56vogelrnknabb: no it's slower
21:56danlarkinslower is the wrong word
21:56vogelrnyeah
21:56danlarkinmore complex is what you mean
21:57knabbhmm 5 log 5 is faster, 12 log 12 is slower
21:57knabbyes
21:57vogelrnwell
21:57vogelrnif the log results in a value less than one it's going to take last time :P
21:57vogelrnweee
21:57vogelrnerr
21:58vogelrn*
21:58knabblol
21:58vogelrnyeah I need to stop talking in terms of time because it's not working
21:58danlarkinBig-O notation is for algorithmic complexity, there's an unknown coefficient k that invalidates claims of "faster"
21:59danlarkinsince k for an O(n^2) might be much lower than for an O(nlogn) algorithm it'll execute faster... until a point
22:00knabbyes
22:00knabbbut 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:00knabbor depends on what level?
22:01knabblike low-level C you might optimize an inner loop
22:01danlarkinwhole courses are taught on this very topic
22:01danlarkinI should know, I took one!
22:01knabbI should take one :) , netx year I can learn Basic in school...
22:01knabbbut i know clojure,python, some C and Java already...
22:01vogelrnwell, it kind of depends on what you're measuring
22:02knabbbut 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:03danlarkinthere's a lot (_a lot_) of theory that goes behind Big-O notation
22:03danlarkinbut if you just want the basics I'm sure the internet can teach you
22:03rhickeyaking: 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:04vogelrndanlarkin: 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:04akingrhickey: cool - thanks! I'll clean up the couple of small changes to RT and send them to the list
22:05vogelrnoops, missed your second message
22:05danlarkinwe're OT and rich can't take it! :'(
22:10vogelrnugh, it does get nasty when dealing with trees though
22:10vogelrnsqrt(n)-ary trees, woohoo
22:21achim_pknabb: 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:22achim_pnice introduction to analysis of algorithms: http://www.aw-bc.com/info/kleinberg/
22:37knabbhow funny that it is much easier to get Clojure and new javalibs to work than to have new javalibs to work with java
22:38knabbvogelrn/achim_p/danlarkin: thanks
22:56durkawhat is clojure-slim.jar?
22:56knabbdoes ant need a specific build.xml for each project? or I can write a genral build.xml?
22:59Chouserdurka: never heard of it. where did you find it?
23:00durkain svn 1190
23:00durkaor before
23:00durkai just noticed it scroll by from ant
23:01Chouserhuh. "clojure-slim jar file (omits compiled Clojure code)"
23:04durkafoo
23:04durkagorilla broke
23:20knabbdoes ant need a specific build.xml for each project? or I can write a genral build.xml?
23:45Chouserknabb: sorry, I don't use ant (except to build clojure itself).