2009-11-14
| 00:01 | G0SUB | hmm, after calling (shutdown-agents) I can't send functions to any agent, even the ones created after calling shutdown-agents. Is there any way to restart the agent system? |
| 00:01 | G0SUB | what's the rationale behind using that function? |
| 00:03 | _ato | G0SUB: it's so that you can kill the agent threads on exit. If you've been using agents and exit without shutting down their threads the JVM can hang |
| 00:05 | G0SUB | _ato: so that's only when I want to shutdown the whole jvm after doing some task? |
| 00:05 | _ato | yes |
| 00:05 | G0SUB | _ato: makes sense. thanks. |
| 00:11 | shoover | GoSUB: why did you want to call it? |
| 00:26 | _ato | http://www.google.com/trends?q=clojure%2C+jruby&ctab=0&geo=all&date=all&sort=0 |
| 00:26 | _ato | interesting |
| 00:26 | _ato | according to that Clojure just surpassed jruby in google searches |
| 00:44 | tomoj | I so wish google gadgets were in clojure |
| 00:45 | tomoj | with the STM |
| 00:45 | tomoj | I don't have a clue what the fuck the concurrency semantics are for wave gadgets |
| 00:45 | tomoj | the land of refs, atoms, and agents is so simple and easy... |
| 00:46 | maravillas | making anything in particular, or just fiddling? |
| 00:46 | tomoj | well, both I suppose |
| 00:46 | tomoj | I'm working on a wave implementation of the game "springfield" |
| 00:47 | tomoj | which is, everyone takes turns saying state capitals, and the first person to say "springfield" wins |
| 00:47 | maravillas | heh, i see :) |
| 00:47 | tomoj | but I realized turn-based was un-wave-y, and now that it's not turn-based, concurrency issues are much more likely I think |
| 00:48 | tomoj | and I have no idea what's going to happen if two people make a guess at the same time |
| 00:48 | tomoj | google seems to just say that gadgets should not rely on a linear and predictable state, whatever the fuck that means |
| 00:48 | tomoj | STM transactions and snapshots are so awesome! |
| 00:49 | tomoj | at least we can write our robots in clojure |
| 02:27 | somnium | how to hint overloaded interface methods with deftype? |
| 02:29 | somnium | nm, on assembla, not getting it working though... |
| 03:44 | michaeljaaka | hello |
| 03:44 | michaeljaaka | What is wrong with that? |
| 03:45 | michaeljaaka | (doto (proxy[Thread][] (run[] ( |
| 03:45 | michaeljaaka | dotimes [_ 10 ] ( |
| 03:45 | michaeljaaka | (println "Hello World ") |
| 03:45 | michaeljaaka | )) |
| 03:45 | michaeljaaka | )) (.start)) |
| 03:45 | michaeljaaka | REPL gives |
| 03:45 | michaeljaaka | #<CompilerException java.lang.IllegalArgumentException: Method 'doto' redefined (NO_SOURCE_FILE:407)> |
| 03:45 | michaeljaaka | user=> |
| 03:52 | _ato | michaeljaaka: you have an extra pair of parens around the println |
| 03:52 | _ato | (run[] (dotimes [_ 10 ] ((println "Hello World "))))) <-- if you write it like this it's more obvious |
| 03:54 | _ato | dunno what your doto being redefined is about though, you should be getting a null pointer exception |
| 03:55 | _ato | (cause println returns null and you try to call it with the extra set of parens.. you can't call null) |
| 03:58 | michaeljaaka | I'm just plaing with abstract classes and interfaces |
| 04:00 | michaeljaaka | wow |
| 04:00 | michaeljaaka | thanks |
| 04:00 | michaeljaaka | It works now |
| 04:01 | michaeljaaka | I'm using proxy to make sure that I undestand how to use it in diferent situations |
| 04:01 | michaeljaaka | I have a code in Java to be integrated with Clojure |
| 04:01 | michaeljaaka | that is why I'm more thinking in terms of java than clojure |
| 04:01 | michaeljaaka | but once I interface the code in Java with Clojure |
| 04:02 | michaeljaaka | I will be more playing with thinking in terms of Funtional Programing |
| 04:03 | michaeljaaka | _ato: thanks again, it just works like a charm |
| 07:05 | spuz | god, such miserable weather today |
| 07:05 | spuz | at least it's a good excuse to stay indoors :) |
| 08:40 | cgrand | rhickey: hi! I'm just starting to experiment with deftype. Shouldn't specifying ILookup opts out IKeywordLookup? |
| 08:42 | rhickey | cgrand: It should, but doesn't opt out of IKeywordLookup, which is used for keyword call sites. This is a bug |
| 08:42 | rhickey | got a small test case? |
| 08:43 | cgrand | not yet, I want to try to implement persistent vectors |
| 08:45 | cgrand | and had a problem with ILookup (on my side) so I dug into the source and saw that as a potential bug when implementing maps |
| 08:57 | lisppaste8 | cgrand pasted "IKeywordLookup not opted out" at http://paste.lisp.org/display/90382 |
| 08:59 | cgrand | rhickey: ^^ test case |
| 09:02 | cgrand | do you want a patch or you fix it yourself? |
| 09:02 | rhickey | cgrand: almost done |
| 09:02 | cgrand | great! |
| 09:08 | rhickey | cgrand: ok, it's up |
| 09:09 | rhickey | I'm still not happy with this auto-impl stuff |
| 09:12 | chouser | because of how it must be implemented? |
| 09:21 | rhickey | chouser: it just seems icky and hardwired. Because of the inheritance in the interfaces, it can get tricky to tell when someone is implementing something via implication |
| 09:22 | rhickey | I wonder also if nothing/full-map is sufficient granularity |
| 09:22 | rhickey | and as we spoke of before, if you implement map you lose keyword lookup for fields, so we need to expose that |
| 09:23 | rhickey | currently IDynamicType/getDynamicField |
| 09:26 | rhickey | hrm. looks like protocol fn docs aren't even flowing through anymore |
| 09:37 | chouser | 3 |
| 11:09 | Bjering | Hello, I have a newbie question re the state of clojures performance |
| 11:09 | Bjering | I made this (horrible I know, its on purpose...) fib function: (def fib (fn [x] (if (<= x 1) 1 (+ (fib (- x 1)) (fib (- x 2)))))) |
| 11:10 | Bjering | and (fib 40) takes 40 sec on my machine |
| 11:10 | Bjering | While the Java version: |
| 11:10 | Bjering | public static int fib(int n) |
| 11:10 | Bjering | { |
| 11:10 | Bjering | return n <= 1 ? 1 : fib(n - 1) + fib(n - 2); |
| 11:10 | Bjering | } |
| 11:10 | Bjering | Takes 2 sec |
| 11:11 | Bjering | Am I doing something wrong or did I just use something that isnät that well optimized in Clojure= |
| 11:11 | Bjering | ? |
| 11:14 | chouser | Bjering: numbers are boxed by default in Clojure. Check the interop page and the google group for discussions of primitive number types and math. |
| 11:15 | chouser | Or, better yet, find a more interesting problem to solve first (rather than fib), and then optimize that if needed. |
| 11:24 | spuz | Bjering: have a look at: http://clojure.org/java_interop#toc35 |
| 11:24 | Bjering | chouser: Thank you, found this http://www.mikeperham.com/2008/12/13/clojure-vs-ruby/ and tried the version with (int n), doubled the speed. I agree I should fins a more interesting problem, just getting started! :) |
| 11:24 | spuz | And also read the sections about primitives and coersions |
| 11:24 | Bjering | spuz, will check |
| 11:32 | slyrus | so, I had made an aborted attempt to ask this the other day, but swank-clojure doesn't seem to be working for me. Well, that's not strictly true, the *inferior-lisp* buffer works, but the REPL doesn't. |
| 11:32 | slyrus | anyone else seeing similar? |
| 11:33 | slyrus | should I not be using slime-fancy? |
| 11:36 | the-kenny | slyrus: It works with slime-fancy. Does *inferior-lisp* display any errors? |
| 11:36 | slyrus | the-kenny: no, although it occurs to me I might be loading the wrong slime. hang on a sec... |
| 11:38 | slyrus | nope, same problem... |
| 11:38 | slyrus | If I type: 3, I get 3 back. If I type (+ 3 4) it hangs. |
| 11:38 | the-kenny | Sounds strange |
| 11:39 | slyrus | yeah, and only in the slime fancy repl. in inferior-lisp, it's fine. |
| 11:40 | the-kenny | hm.. I used the fancy-repl with Common Lisp, I haven't changed anything in the config, but my clojure-repl isn't fancy... If I had this problems, I would try to disable the fancy-stuff. |
| 11:51 | Qvintvs | is there a function like take that works from the back of the collection instead of the front? |
| 11:53 | devlinsf | ,(reverse [1 2 3]) |
| 11:53 | clojurebot | (3 2 1) |
| 11:55 | Qvintvs | hrm, well I suppose I could do (reverse (take n (reverse col))) |
| 11:57 | Chousuke | (doc butlast) |
| 11:57 | clojurebot | "([coll]); Return a seq of all but the last item in coll, in linear time" |
| 11:57 | Chousuke | hmm |
| 11:57 | Chousuke | there was something else too. |
| 12:36 | hamza | Are clojure numbers always BigInteger? is this a correct way to determine is a varible is a number (instance? java.math.BigInteger obj) ? |
| 12:36 | rhickey | ,(doc number?) |
| 12:36 | clojurebot | "([x]); Returns true if x is a Number" |
| 12:37 | hamza | thanks you.. |
| 12:37 | hamza | *thank |
| 13:00 | spuz | is there a parallel version of doseq? |
| 13:40 | djork | I have implemented something like Clojure's proxy with Lua in Objective-C |
| 13:40 | djork | Lua *and* Objective_C |
| 13:41 | djork | thanks for the inspiration to all of Clojure's many geniuses |
| 13:44 | hamza | is there a way to turn a map in to vector [key1 val1 key2 val2...] reverse the effect of (apply hash-map [:a :b])? |
| 13:47 | devlinsf | ,(vec {:a 1 :b 2}) |
| 13:47 | clojurebot | [[:a 1] [:b 2]] |
| 13:47 | devlinsf | ,(into [] {:a 1 :b 2}) |
| 13:47 | clojurebot | [[:a 1] [:b 2]] |
| 13:48 | devlinsf | ,(apply concat (vec {:a 1 :b 2})) |
| 13:48 | clojurebot | (:a 1 :b 2) |
| 13:50 | ambient | heh, the best criticism of Haskell i've seen so far: "if I have to understand category theory to write a program that |
| 13:50 | ambient | does IO, IT IS A NON STARTER! |
| 13:51 | hamza | devlinsf: thank you.. |
| 13:52 | Chousuke | I think calling monads monads and trying to explain them through category theory is the problem :P |
| 13:52 | spuz | I'm not sure what category theory is but it would seem to me to be the same as complaining that you have to understand functions to write a program. If that's a feature of the language then guess what, you have to learn about it :p |
| 13:52 | ambient | the first way i understood functions was go here, then come back |
| 13:53 | ambient | it's pretty easy-peasy |
| 13:54 | spuz | I think my point is that different languages demand different background knowledge but ultimately you're always going to have to engage your brain at some point even in the simplest of languages |
| 13:54 | ambient | well, C was quite straight-forward for me to learn without any programming or mathematics background |
| 13:55 | Chousuke | C doesn't have functions though. it has procedures. |
| 13:55 | ambient | it's mostly just loops 'n jumps |
| 13:55 | Chousuke | functions are a very special kind of procedure :P |
| 13:55 | ambient | correction, jumps 'n conditions |
| 13:56 | gravity | spuz: Have you written any haskell? |
| 13:56 | spuz | gravity: a long time ago, very breifly, I guess I never got as far as category theory, or at least I didn't understand it :p |
| 13:56 | Chousuke | Sometimes when reading the haskell tutorials I get the feeling everyone involved in developing the language is a theoretical mathematician. |
| 13:58 | spuz | If some code is well broken down into functions that do well defined things, would you call that well factored code? well modularised? |
| 13:58 | spuz | well functionalarised? |
| 13:58 | Chousuke | I mean, as far as I understand, monads define how to compose a class of operations. |
| 13:58 | ambient | i don't think there is a visible line that separates computer science from math, it's more of a continuum |
| 13:59 | Chousuke | which makes a lot of sense, to me. |
| 13:59 | Chousuke | it's just a bit difficult to visualise how it all works :/ |
| 14:00 | spuz | ambient: I agree though I think the way people's brains are wired can be pretty distinct between mathematicians and computer scientists which can make crossing over painful |
| 14:00 | gravity | Chousuke: That's really all they do. The various monad tutorials give a lot of metaphors to visualize it (like assembly lines and whatnot) |
| 14:01 | Chousuke | gravity: yeah, but it's still difficult to bring to the "real" world :P |
| 14:01 | gravity | Chousuke: Yeah, I agree, which is why I stopped trying to beat my brain against haskell :-) |
| 14:01 | Chousuke | the maybe monad is easy to understand, but anything beyond that... |
| 14:02 | ambient | i can't really justify spending a lot of time learning Haskell when from the practical standpoint other platforms and languages _seem_ so much more productive. |
| 14:02 | Chousuke | the fun thing is that I have succesfully written monadic Clojure code once but even though it worked and was pretty nice I don't think I could understand why anymore. |
| 14:02 | Chousuke | it just doesn't stick :/ |
| 14:03 | Chousuke | haskell probably is productive once you get into it. |
| 14:03 | ambient | a probability that i'm not willing to bet on |
| 14:04 | gravity | There's a number of libraries for clojure that use monads, like the parser combinator library. I'm not sure how good they are though. |
| 14:04 | spuz | heh, reading about monads, they seem to relate to what I was looking for just now. It seems they provide a 'functional' way of doing regular imperative sequential work |
| 14:04 | Chousuke | ambient: yeah. the real problem seems to be that haskell is completely unusable until you start getting it :P |
| 14:04 | ambient | clojure is exactly what i want from a language, except faster than the best ever optimized C code :P |
| 14:04 | spuz | maybe 'monadic' was the word I was looking for :p |
| 14:05 | Chousuke | you can't even experiment with it because the compiler yells at you. |
| 14:05 | Chousuke | it's nice that the compiler can tell that a program makes no sense but sometimes you need to see it fail to understand why :P |
| 14:08 | Chousuke | spuz: they provide a functional way because using a monad, you can define how operations are composed... and for imperative code, the monad "just" has to impose sequentiality. it kind of works around the problem that some things aren't really "functional" at all. |
| 14:08 | spuz | Chousuke: I see |
| 14:13 | ambient | (my quote was from this rant: http://www.xent.com/pipermail/fork/Week-of-Mon-20091109/054578.html) |
| 14:21 | hiredman | clojurebot uses fnparse |
| 14:21 | hiredman | seems ok |
| 14:24 | hamza | hiredman: what for clojurebot uses fnparse? i always thought its just a read eval loop? |
| 14:28 | hiredman | clojurebot: where do you use fnparse? |
| 14:28 | clojurebot | where is your source code |
| 14:28 | hiredman | hamza: it uses fnparse for factoid lookups and definitions |
| 14:29 | hamza | oh ok. |
| 14:29 | arj | is there any updated instructed on how to use slime? I just tried installing and I get a bunch of wierd errors |
| 14:29 | arj | seems like all the emacs+slime+ubuntu guides are outdated |
| 14:30 | ambient | what kind of weird errors? |
| 14:30 | gravity | arj: I used the instructions on the clojure wiki |
| 14:30 | ambient | the easiest method for installing clojure/emacs for me on ubuntu would be: emacs > ELPA > clojure-mode from ELPA > M-x clojure-install |
| 14:30 | ambient | requires: ant & git |
| 14:31 | gravity | ambient: That's what I used as well. |
| 14:31 | hiredman | ~emacs |
| 14:31 | clojurebot | emacs is best configured for Clojure with instructions at http://technomancy.us/126 |
| 14:31 | gravity | arj: I had to undo the ubuntu tutorial stuff with that method as well to make things work properly |
| 14:31 | arj | thanks |
| 14:36 | ambient | i might've to clone drscheme for clojure :/ |
| 14:41 | Scriptor | Hi everyone, I'm having some trouble installing vimclojure |
| 14:42 | Scriptor | I compiled clojure-contrib with the -Dclojure.jar flag, but it still gives a ClassNotFoundException when I try to compile vimclojure for the prettyprinter |
| 14:42 | ambient | -Dclojure.jar=../clojure/clojure.jar ? |
| 14:43 | ambient | or wherever your clojure.jar is located |
| 14:43 | Scriptor | yep, did that |
| 14:43 | Scriptor | so clojure-contrib compiles fine |
| 14:43 | ambient | vimclojure should compile just fine if you have the .properties file right (iirc) |
| 14:44 | ambient | how that can be done is in the readme |
| 14:44 | Scriptor | yes, I did that as well |
| 14:45 | ambient | well, that should be working then :/ |
| 14:45 | Scriptor | used the absolute paths to clojure and contrib, |
| 14:45 | ambient | i used relative ones |
| 14:45 | ambient | ../clojure/ etc |
| 14:46 | ambient | clojure.jar = ../clojure/clojure.jar for example |
| 14:46 | arj | I don't get it, so I got slime working. And when I do a C-c C-k I just get: compilation finished and nothing in the repl? |
| 14:47 | ambient | arj did you do M-x slime? |
| 14:47 | Scriptor | ok, I just changed it to relative paths, still doesn't work |
| 14:47 | arj | ambient: yes |
| 14:47 | ambient | arj try running your functions from the repl |
| 14:47 | arj | I just have (+ 1 2) |
| 14:48 | arj | and that works fine ;-) |
| 14:48 | ambient | C-x b *SLIME <tab> :p |
| 14:48 | ambient | it doesn't print everything in the repl iirc |
| 14:48 | gravity | arj: Try something like (println (+ 1 2)) |
| 14:48 | arj | it just says 0 compiler notes |
| 14:49 | arj | aha that works |
| 14:49 | arj | thanks gravity! |
| 14:49 | gravity | arj: No problem. |
| 15:23 | spuz | Hi all, I've posted an article about my clojure mandelbrot app: http://developmentjungle.wordpress.com/2009/11/14/rendering-the-mandelbrot-set-in-clojure/ |
| 15:23 | spuz | Any feedback would be greatly appreciated! |
| 15:35 | ambient | well, the layout is very nice, and the article is descriptive, informative and has a nice logical progression |
| 15:36 | ambient | you might be interested in this: http://github.com/ztellman/penumbra/blob/master/src/examples/mandelbrot.clj |
| 15:38 | erikcw | I'm trying to get my feet wet with Clojure. To start, I'm trying to import a Java class for demo purposes. The class is not part of a package. Just "public class Demo" with a few methods inside. Why (import '(Demo)) everything seems to go fine (I get nil returned), but then when I try (.aMethod Demo) I get Unable to resolve symbol: Demo in this context. What am I missing? |
| 15:39 | krumholt | erikcw, is aMethod static? |
| 15:40 | krumholt | then you would have to do (Demo/aMethod) |
| 15:40 | krumholt | if not you would have to create an object of Demo (.aMethod (new Demo)) |
| 15:40 | hiredman | erikcw: (import 'Demo) |
| 15:41 | somnium | is it necessary to quote java classes? |
| 15:41 | hiredman | if Demo was in a java package like java.io you'd do someting like (import '(java.io Demo)) |
| 15:41 | erikcw | krumholt: no, it's not static |
| 15:42 | hiredman | somnium: no |
| 15:42 | hiredman | but import, until recently, was a regular function |
| 15:43 | hiredman | so (import Foo) would try to resolve Foo and fail, because the whole point of import is to set it up so Foo resolves to the java class |
| 15:44 | erikcw | I removed the parens form the import and it started working |
| 15:44 | somnium | in ns macro? |
| 15:44 | hiredman | somnium: in the ns macro you never needed to quote |
| 15:44 | somnium | at repl (import com.klass.Foo) creates a Foo in current ns |
| 15:44 | somnium | never saw quoted java class before today :) |
| 15:44 | hiredman | "... import, until recently, was .." |
| 15:45 | somnium | how recently is recenty? |
| 15:45 | hiredman | the last two months maybe? |
| 15:46 | hiredman | somnium: usually you see :import directives in the ns macro, which, as I said, never required the quote |
| 15:46 | hiredman | erikcw: usually java classes are in a package |
| 15:47 | erikcw | hiredman: this was practically a hello world... :-) |
| 15:47 | erikcw | I'm still in Python land |
| 15:48 | hiredman | erikcw: hello world is java -jar clojure.jar -e "(println \"Hello World\")" |
| 15:48 | hiredman | no import needed |
| 15:49 | erikcw | well, it wasn't exactly hello world, but it didn't seem like enough for a package either. I'm just trying to figure out all the Java interop stuff |
| 15:50 | hiredman | erikcw: java interop is, essentiallly, transparent, so I wouldn't bother "learning" it, just use it when you need it |
| 15:51 | hiredman | using import on Demo is kind of silly anyway |
| 15:51 | erikcw | what would be the preferred way of getting into my Demo class? |
| 15:51 | hiredman | you can just write Demo in your code and it will refer to the class Demo |
| 15:51 | hiredman | like in java, import just aliases the package qualified name to a shorted name |
| 15:52 | hiredman | java.io.File => File |
| 15:52 | hiredman | Demo => Demo is silly |
| 15:52 | erikcw | but when I restart the REPL and try (new Demo) without the import, I get an "Unable to resolve classname" error |
| 15:52 | hiredman | you never have to use import at all if you don't mind writing out long class names |
| 15:53 | erikcw | but I would need to put Demo in a package right? |
| 15:53 | hiredman | erikcw: and after import it works? |
| 15:53 | hiredman | ,File |
| 15:53 | clojurebot | java.lang.Exception: Unable to resolve symbol: File in this context |
| 15:53 | hiredman | ,java.io.File |
| 15:53 | clojurebot | java.io.File |
| 15:54 | hiredman | ,(import 'java.io.File) |
| 15:54 | clojurebot | java.io.File |
| 15:54 | hiredman | ,java.io.File |
| 15:54 | clojurebot | java.io.File |
| 15:54 | hiredman | ,File |
| 15:54 | clojurebot | java.io.File |
| 15:54 | hiredman | could be a default package issue (which is where classes with no package get stuffed) |
| 15:55 | erikcw | ,default.Demo?? |
| 15:55 | clojurebot | java.lang.ClassNotFoundException: default.Demo?? |
| 15:57 | chouser | clojure doesn't really support the default package |
| 15:57 | hiredman | like I said, don't bother with java interop until you have a real use for it, because it won't be an issue |
| 15:57 | hiredman | until you need something from some apache library or something |
| 16:00 | hiredman | performance issues are not the samething as interop issues |
| 16:00 | ambient | if java style arrays are considered as interop (and I'm going that) when without them, writing idiomatic clojure, the program would be a lot less performant |
| 16:01 | ambient | *doing |
| 16:01 | hiredman | it's not "java style arrays" they are java arrays |
| 16:01 | ambient | ok |
| 16:01 | hiredman | and using them, reading them, writing them, is all easy as pie |
| 16:02 | ambient | not really |
| 16:02 | ambient | it seriously clashes with functional programming style imo |
| 16:02 | hiredman | ,(into-array [1 2 3]) |
| 16:02 | clojurebot | #<Integer[] [Ljava.lang.Integer;@1fdc6f6> |
| 16:02 | hiredman | ,(into-array Integer/TYPE [1 2 3]) |
| 16:02 | clojurebot | #<int[] [I@1c803ae> |
| 16:03 | hiredman | ambient: well, that is an impedance mish mash that I don't think can be done away with |
| 16:03 | ambient | this is what i'm doing at the moment: http://bitbucket.org/amb/clojure-snippets/src/tip/src/amb/synth/engine.clj |
| 16:03 | ambient | and think that's pretty bad |
| 16:03 | ambient | it might be just my limitations |
| 16:05 | hiredman | what is bad about it from an interop stand point? |
| 16:05 | hiredman | there are java arrays as first class values |
| 16:05 | ambient | you said it, the impedance mish mash |
| 16:05 | hiredman | taking part in the macro system |
| 16:05 | hiredman | etc |
| 16:06 | hiredman | I mean, what else could you possibly want? |
| 16:07 | ambient | if i knew the answer to that question, i'd already done it |
| 16:07 | ambient | but im not satisfied with this current solution |
| 16:07 | hiredman | have you looked at changing stuff like osc-type-sin to an inline function? |
| 16:07 | ambient | it's not clojure, i think i just have to think about this problem a bit more |
| 16:07 | hiredman | I hate to see math traveling across function calls |
| 16:08 | ambient | i can't really make it functional because its realtime and every value could be changed at any given time |
| 16:08 | ambient | it constantly takes in user input |
| 16:09 | hiredman | *shrug* |
| 16:11 | hiredman | you've seen rich's recent talk thats up on infoq? |
| 16:11 | ambient | the jvm lang summit? |
| 16:12 | hiredman | yeah |
| 16:12 | ambient | i heard there were light-weight java classes coming at some point in the future for clojure |
| 16:12 | ambient | yeah i watched it |
| 16:13 | hiredman | so clojure is for describing processes, not for writing “functional” programs |
| 16:14 | hiredman | it's that functions are the most composable way to describe parts of a process |
| 16:14 | ambient | he also talked about discretizing the world into steps, which is exactly what im doing |
| 16:15 | ambient | between each step, the state can be changed by the user and then fed unto functions |
| 16:15 | ambient | it's just that i'm doing that 44000 times a second at minimum |
| 16:17 | somnium | ambient: are the 'light-weight java classes' deftype or lighter still? |
| 16:17 | somnium | these rumors |
| 16:17 | hiredman | a java class is a java class |
| 16:18 | hiredman | the only difference would be the amount of ceremony involved in defining one |
| 16:18 | somnium | true |
| 16:18 | ambient | somnium probably |
| 16:18 | somnium | I wish gen-class was lighter weight |
| 16:18 | somnium | often some ugly java apis want you to subclass some mutable thing that they're packages can mash all over |
| 16:18 | hiredman | somnium: write some macros |
| 16:20 | hiredman | http://gist.github.com/34229 |
| 16:20 | somnium | I've been unable to get equivalent performance with gen-class :( |
| 16:20 | somnium | remotely equivalent even |
| 16:20 | slyrus_ | ahh... thought i was losing my mind for a moment there. the changes that cause slime/swank-clojure to break are in slime, not in swank-clojure |
| 16:21 | hiredman | somnium: gen-class is not a performance construct |
| 16:21 | slyrus_ | 2009-10-28 is good, slime HEAD isn't... |
| 16:21 | hiredman | it is for interop |
| 16:21 | somnium | I know, I guess that's what I wish there was, though maybe its better it doesnt exist |
| 16:21 | hiredman | gen-class generates a stub for each method that in turn calls the clojure function that backs it |
| 16:21 | hiredman | ~performance |
| 16:21 | clojurebot | http://clojure.org/java_interop#toc46 |
| 16:21 | somnium | because people would use it for evil |
| 16:22 | hiredman | deftype and reify will both generate methods directly (no stubs) |
| 16:22 | somnium | but you can't subclass concrete types |
| 16:22 | hiredman | will and do, I should say, if you are following the new branch of clojure |
| 16:22 | somnium | ? using edge but reading assembla |
| 16:23 | somnium | I guess it hasn't caught up? assembla says only interfaces |
| 16:23 | hiredman | edge? |
| 16:23 | somnium | new |
| 16:23 | somnium | how many branches have defprotocol right now? |
| 16:23 | somnium | that one |
| 16:23 | hiredman | somnium: the will and do was not a reply to you, but a continuation of what I said earlier |
| 16:24 | hiredman | somnium: where do you need to extend a concrete superclass? |
| 16:26 | hiredman | I think there are a few possible work arounds for that case |
| 16:27 | somnium | I can get by with an interface, but it still would have to mutable, so I already bit the bullet on tiny .java file |
| 16:27 | somnium | just added a toclojure button that makes a shiny persistent map when the mashing is over |
| 16:27 | hiredman | somnium: it is very easy to get to mutable stuff in clojure |
| 16:28 | hiredman | of course there are the thread safe constructs like atoms and refs and agents |
| 16:28 | somnium | yes, but not easy to write fast performant classes that let other apis mash on them |
| 16:29 | hiredman | somnium: reify lets you create volatile fields |
| 16:29 | hiredman | or at least it did at some point |
| 16:29 | slyrus_ | looks like addc5be70a489cdc8ed555a2fed7273040da196e is the offending slime commit |
| 16:29 | hiredman | you can also just close over an array |
| 16:30 | somnium | well, I shouldnt really complain, 80 lines of java and everything else in persistent datastructures isn't a bad deal |
| 16:30 | somnium | if deftype/defprotocol gets fast enough maybe clojure-encoders will be fast enough to bypass the 90 class hierarchy in the driver some day |
| 16:31 | hiredman | you really shouldn't complain until you've reify+volatile fields or closing over an array |
| 16:31 | hiredman | tried |
| 16:31 | spuz | ambient: thanks |
| 16:32 | somnium | wasnt aware of volatile fields |
| 16:32 | spuz | I know there are plenty of other examples of the mandelbrot fractal in clojure. I've not seen that one before though |
| 16:32 | somnium | googling now |
| 16:32 | hiredman | somnium: it's on the new new assembla page |
| 16:33 | hiredman | but I don;'t know if they made the final reify cut |
| 16:33 | ambient | spuz it's plotting mandelbrot with the gpu :) |
| 16:33 | somnium | hiredman: its on the new new page but no mention in reify, that I see... |
| 16:34 | somnium | suggested resource? |
| 16:34 | hiredman | reify as mentioned on the datatypes page doesn't saying anything about volatile locals |
| 16:34 | hiredman | somnium: the reify docstring |
| 16:35 | hiredman | github hates firefox for some reason |
| 16:35 | spuz | ambient: I expect it's several thousand times faster than my version then :) |
| 16:37 | somnium | is reify in a package? |
| 16:37 | somnium | er ns |
| 16:37 | somnium | other than core? |
| 16:38 | chouser | it's in the 'new' branch |
| 16:38 | somnium | I have, from yesterday, with deftype and defprotocol |
| 16:39 | somnium | but reify isn't there |
| 16:40 | hiredman | looks like reify in Compiler.java has a slot for fields, but it is not used |
| 16:40 | hiredman | build is called with null |
| 16:40 | hiredman | http://github.com/richhickey/clojure/blob/new/src/jvm/clojure/lang/Compiler.java#L5431 |
| 16:41 | hiredman | GRRR |
| 16:41 | hiredman | why does github not work in firefox these days? |
| 16:42 | hiredman | I cannot even select text |
| 16:42 | hiredman | anyway, there is a comment that says "//todo - setup volatiles" |
| 16:42 | hiredman | so we'll see |
| 16:45 | slyrus_ | great... of course the patch that breaks slime/clojure is a 2661-line monster... |
| 16:46 | somnium | slyrus_: once a month or so I try to upgrade slime with a fresh .emacs.d, it hasn't gone well for a while |
| 16:46 | somnium | slyrus_: hopefully its coming to elpa soon |
| 16:47 | slyrus_ | what is elpa? |
| 16:47 | somnium | emacs lisp package archive |
| 16:48 | somnium | isn't that the recommended way to get clojure these days on emacs? |
| 16:48 | spuz | hiredman: You mean half that page is missing? I don't think it's just github, the clojure api page is cut off half way through as well on firefox. |
| 16:48 | ambient | it's an old firefox bug afaik |
| 16:49 | hiredman | spuz: no, I mean I can see the text, I just cannot select it |
| 16:49 | hiredman | and there is no syntax hilighting |
| 16:49 | ambient | perhaps they have disabled with javascript? |
| 16:49 | ambient | +it |
| 16:49 | spuz | hiredman: strange, I can see nothing but whitespace after line 1908 |
| 16:49 | slyrus_ | somnium: recommendend shmecomended... I'd like things to work out of the HEADS of various repos, at least most of the time. |
| 16:49 | slyrus_ | That was true until 10/31.. |
| 16:50 | hiredman | spuz: I have a similar issue with core.clj |
| 16:50 | ambient | yeah, doesn't work for me either. just blackness after 1/3 of the page |
| 16:50 | hiredman | blackness? |
| 16:50 | hiredman | I get whiteness |
| 16:50 | ambient | *shrug* |
| 16:50 | hiredman | all of Compiler.java is there |
| 16:50 | hiredman | I just cannot select and copy any of the text |
| 16:51 | sdeobald | Is there a clojuresque way to append to a list? Like: http://gist.github.com/234800 |
| 16:51 | hiredman | sdeobald: don't |
| 16:51 | sdeobald | Or should one always use a vector in that case? |
| 16:51 | hiredman | lists are for prepending |
| 16:52 | sdeobald | Right. |
| 16:52 | hiredman | vectors are for appending |
| 16:52 | sdeobald | Cool. |
| 16:52 | hiredman | you could actually make list appending lazy, I guess |
| 16:54 | sdeobald | Yeah, I was wondering if that existed as a library function (or contrib) -- though it makes sense that it doesn't. |
| 16:55 | hiredman | the other issue with github is if I allow all of github's javascript on the only computer I have with flash installed, firefox locks up for a minute or two |
| 16:55 | hiredman | sdeobald: I doubt it |
| 16:56 | sdeobald | s'cool. This is one of the many known issues of working through sicp in clojure, I guess. :) |
| 17:07 | hiredman | … |
| 17:08 | kanak | sdeobald: you could use concat to lazily append the second onto the first. But if you're appending extensively, it's time for a different data structure. :) |
| 17:11 | ambient | bah, i have a problem with git "error: Entry 'ClojureCLR/...' not uptodate. cannot merge" tried git reset --hard and git checkout . but wont work :/ |
| 17:12 | ambient | trying git pull gives that error |
| 17:15 | ambient | aah, it might be just that git is broken on windows |
| 17:41 | rhickey | protocol call site caching is up! |
| 17:41 | rhickey | will be in effect when no :on interface is specified |
| 17:41 | rhickey | chouser: please try with your finger trees |
| 18:01 | chouser | "queue" test: letfn+reify 2151, defprotocol 6234, now 5380 |
| 18:02 | chouser | split test: letfn+reify 2351, defprotocol 3824, now 3552 |
| 18:04 | hiredman | are there no obvious bottlenecks? |
| 18:04 | chouser | concat test: letfn+reify 1699, defprotocol: 1958, now 1679 |
| 18:05 | chouser | that's it for the tests I've been running regularly |
| 18:05 | hiredman | like if you run it through a profiler do you see certain hotspots? |
| 18:06 | chouser | hiredman: I had done that in working it down to the "letfn+reify" versions mentioned above. |
| 18:07 | chouser | There are a few areas I can proabaly still target, esp. on the split test |
| 18:07 | chouser | I haven't done any profiling since switching to defprotocol. |
| 18:08 | hiredman | I am just wondering if defprotocl might have a set of hotspots |
| 18:08 | chouser | I've been entrusting rhickey with that end of things. ;-) |
| 18:09 | hiredman | so say we all |
| 18:10 | somnium | am I crazy? I just built new and reify is not in 'user |
| 18:10 | chouser | it's a special form |
| 18:11 | somnium | ... so no doc string? |
| 18:11 | somnium | ah, ok |
| 18:11 | chouser | I guess not. but (reify) should return an object |
| 18:12 | somnium | it does |
| 18:12 | somnium | hiredman: where can I find the doc string you mentioned to read? |
| 18:13 | dpthfltr | just an idea.. someone should make a clojure DSL for the OpenLaszlo platform. That would be sooo badass and would be something that other non-java languages couldn't do as well. |
| 18:14 | dpthfltr | there.. I dropped a killerapp idea on you guys now I'll go away for 6 months and when I come back hopefully it'll be ready ;) |
| 18:14 | somnium | ooh, I didn't know pandora was openlaszlo |
| 18:14 | dpthfltr | walmart.com too |
| 18:15 | dpthfltr | it uses an XML/JS based language so it's all web standards, no bogus custom language like Adobe uses |
| 18:15 | somnium | dpthfltr: I tend to visit pandora more often than walmart.com ;) |
| 18:15 | ambient | hi folks, im having trouble in converting from java code to clojure: http://paste.pocoo.org/show/150687/ |
| 18:15 | dpthfltr | it's declarative programming. You code it once in this XML DSL and then it compiles a javascript and a flash version |
| 18:15 | ambient | trying to generate anonymous object that has a callback function |
| 18:16 | somnium | doesn't adobe have something like that? |
| 18:16 | ambient | here's the reference: http://code.google.com/p/jrtaudio/source/browse/trunk/examples/src/OscillatorBank.java |
| 18:16 | dpthfltr | no adobe doesn't have anything like that... they push Flash everything they don't support native JS |
| 18:16 | somnium | hmm, walmart site looks like any rails/django, pandora is badass though |
| 18:16 | hiredman | somnium: it was a guess |
| 18:17 | somnium | ok |
| 18:17 | somnium | hiredman: just made me think I was crazy for half an hour :) |
| 18:17 | hiredman | sorry |
| 18:19 | somnium | np |
| 18:21 | ambient | im trying to understand proxy. shouldn't this work? (.foo (proxy [] [] (foo [] 1))) |
| 18:22 | hiredman | nope |
| 18:22 | hiredman | proxy doesn't let you create new methods |
| 18:22 | hiredman | reify does |
| 18:22 | ambient | so it's only for actualizing interfaces? ok |
| 18:22 | ambient | (doc reify) ==> :( |
| 18:22 | clojurebot | Excuse me? |
| 18:22 | ambient | ,(doc reify) |
| 18:22 | clojurebot | Titim gan éirí ort. |
| 18:23 | hiredman | clojurebot doesn't have the special handling needed for special form's docstrings anyway |
| 18:24 | ambient | i just did git pull for clojure today and (doc reify) is missing from my repl also |
| 18:24 | ambient | so im guessing gen-class is what i'm looking for |
| 18:24 | hiredman | it's possible that doc's special handling of spcial forms has not been updated for reify |
| 18:25 | hiredman | which makes sense, because the special handling of special forms just points you to the clojure website, which doesn't document reify anyway |
| 18:25 | hiredman | ambient: reify is only on new branch |
| 18:27 | ambient | "implements one or more interfaces" can it implement zero interfaces and just construct an anonymous class? |
| 18:27 | hiredman | last I check it could |
| 18:27 | ambient | eg. would (.foo (reify [] [] (foo [] 1))) work? |
| 18:27 | hiredman | checked |
| 18:27 | ambient | ok |
| 18:28 | ambient | ty |
| 18:29 | chouser | but I think that requires runtime reflection. That is, it works but will never be as fast as java interop can be |
| 18:31 | hiredman | java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V strikes again |
| 18:32 | chouser | no, that doesn't work... Can't define method not in interfaces: foo |
| 18:32 | hiredman | hmmm |
| 18:33 | somnium | oddly, the inferior lisp buffer blows up when I load new branch, but slime gets started somehow anyway and it seems to work |
| 18:33 | somnium | *shrug* |
| 18:34 | qed | come back clojurebot! |
| 18:34 | hiredman | somnium: you might need to recompile contrib |
| 18:35 | hiredman | ,(reify [] (.toString "foo")) |
| 18:35 | clojurebot | java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentVector |
| 18:35 | somnium | yeah, I started doing that since yesterday |
| 18:35 | hiredman | ,(reify [] (.toString [] "foo")) |
| 18:35 | clojurebot | #<sandbox$eval$reify__3467 foo> |
| 18:35 | hiredman | ,(reify [] (.toString [] "foo") (.bar [] :baz)) |
| 18:35 | clojurebot | java.lang.IllegalArgumentException: Can't define method not in interfaces: bar |
| 18:35 | hiredman | I see |
| 18:36 | wooby | ,(doc reify) |
| 18:36 | clojurebot | Pardon? |
| 18:37 | hiredman | is there some interface generating compliment to deftype? |
| 18:38 | chouser | gen-interface is as close as we've got at the moment |
| 18:38 | chouser | there will be something with more deftype-like syntax I think |
| 18:39 | hiredman | ,(deftype Pair [a b]) |
| 18:39 | clojurebot | DENIED |
| 18:40 | hiredman | *zing* |
| 18:40 | rhickey | chouser: thanks - where are those tests? |
| 18:40 | rhickey | one thing that will not be sped up by the call-site caching is higher-order use of protocol fns |
| 18:41 | chouser | rhickey: sloppily noted here: http://github.com/Chouser/finger-tree/blob/master/notes.txt |
| 18:41 | rhickey | is that the case in the first 2 tests? |
| 18:41 | hiredman | hmm |
| 18:42 | chouser | (reduce consl (EmptyTree nil) ...) |
| 19:09 | chouser | rhickey: so if might it be worthwhile to generally replace (reduce consl ...) with (reduce #(consl %1 %2) ...) when consl is a protocol method? |
| 19:10 | qed | http://github.com/technomancy/leiningen/blob/master/README.md |
| 19:10 | hiredman | :( |
| 19:12 | ambient | if i feed a clojure function to a gen-class constructor, what is its type? |
| 19:12 | chouser | clojure.lang.IFn |
| 19:12 | ambient | cheers |
| 19:13 | chouser | though I guess you can take your pick: |
| 19:13 | chouser | ,(supers (class #())) |
| 19:13 | clojurebot | #{java.lang.Object clojure.lang.IMeta clojure.lang.AFunction clojure.lang.Obj java.io.Serializable clojure.lang.AFn java.util.concurrent.Callable java.lang.Runnable java.util.Comparator clojure.lang.IFn clojure.lang.Fn clojure.lang.IObj} |
| 19:35 | chouser | putting the protocols :on interfaces is faster than not, but not as fast as the call-site caching |
| 19:38 | arj | I have a simple question, how do change the classpath of the repl in Emacs? |
| 19:39 | ambient | you mean namespace? (ns my.new.namespace) |
| 19:40 | somnium | arj: or add-classpath? |
| 19:40 | somnium | ,(doc add-classpath) |
| 19:40 | clojurebot | "([url]); Adds the url (String or URL object) to the classpath per URLClassLoader.addURL" |
| 19:40 | arj | I have a library in the current folder that I want to add |
| 19:40 | arj | like the java -cp |
| 19:41 | somnium | arj: M-x clojure-project / swank-clojure-project make it easier |
| 19:41 | arj | ok I'll try |
| 19:41 | somnium | but (add-classpath "~/libs/foo.jar") will work by hand |
| 19:41 | somnium | er, probably no shell expansions I guess |
| 19:42 | ambient | if you want to make it permanent to ~/.emacs then "(dolist (d (list "c:/stuff/lib" "c:/more/stuff")) (add-to-list 'swank-clojure-classpath d)) |
| 19:42 | ambient | " |
| 19:42 | arj | aha |
| 19:42 | arj | thanks! |
| 19:44 | arj | damn this clojure stuff is insanely cool :-) |
| 19:48 | ambient | seems i can't have gen-class and other random clojure code in the same file? |
| 19:48 | ambient | trying to gen-class and after write clojure code to use that class fails |
| 19:48 | somnium | ambient: did you compile it? |
| 19:49 | _ato | it should work okay if you compile it |
| 19:49 | ambient | yeah but the gen-class is different from the file name and namespace |
| 19:49 | somnium | I think the :name parameter determines the final classname |
| 19:50 | ambient | im using (gen-class) instead of (ns foo.bar (:gen-class)) |
| 19:50 | _ato | ah, I haven't tried that combination |
| 19:50 | ambient | so the problem is that (compile amb.synth.rt-impl) wouldn't find the class needed |
| 19:51 | ambient | when the file it resides in is amb.synth.audioloop-rt |
| 19:52 | _ato | hmm.. I would have thought (compile amb.synth.audioloop-rt) would do it |
| 19:52 | ambient | it gives classnotfound |
| 19:55 | ambient | here's the code http://paste.pocoo.org/show/150699/ |
| 19:56 | Draggor | How do I load a java class? |
| 19:59 | somnium | ambient: hmm, it looks like you could put gen class in the ns (which I've gotten to work, no idea about out of ns) |
| 19:59 | ambient | yeah, it's what i'm trying to do now |
| 20:00 | somnium | ambient: are the defs at the top to be the state? |
| 20:00 | ambient | not of the gen-class, no |
| 20:00 | somnium | if you have state you need to an -init somewhere to set it |
| 20:00 | scottj | Is there a more idiomatic way to write (for [_ (range 3)] (rand-elt "abcdefgh")) than that and (take 3 (repeatedly #(rand-elt "abcdefgh"))) and (map (fn [x] (rand-elt "abcdefgh")) (range 3))? |
| 20:00 | _ato | ambient: hmm... your code is actually working for me |
| 20:01 | _ato | (once I stripped the references to stuff I don't have) |
| 20:03 | _ato | ambient: http://gist.github.com/234896 |
| 20:04 | somnium | scottj: maybe (def *random-letters* (repeatedly #(rand-elt))) and then (take n *random-letters*) |
| 20:04 | somnium | or (dotimes [_ n] ...) |
| 20:05 | ambient | _ato ok, i got to try that and start from there |
| 20:05 | somnium | Ive never seen for or map used with their bindings ignored |
| 20:09 | ztellman | just finished a clone of asteroids, if anyone's interested: http://github.com/ztellman/penumbra/blob/master/src/examples/asteroids.clj |
| 20:12 | ambient | were there some problems in naming files "rt-impl.clj" ? |
| 20:12 | ambient | looks like (use foo-bar) tries to look for foo_bar.clj |
| 20:13 | ambient | and thus... naming audioloop-rt.clj might screw up gen-class |
| 20:13 | qed | what is rand-elt? |
| 20:15 | scottj | qed, random element from collection |
| 20:15 | qed | is that in a special library or something? |
| 20:16 | scottj | qed, clojure.contrib.seq-utils |
| 20:17 | _ato | ambient: ah yeah. I think it's because java doesn't like hyphens in class names, so you should put namespace foo-bar in foo_bar.clj |
| 20:18 | ambient | i wonder how do i reset namespaces in emacs/clojure/slime? |
| 20:18 | ambient | sometimes there are leftover functions that annoyingly interfere |
| 20:19 | _ato | M-x sime-quit-lisp M-x slime ? |
| 20:19 | ambient | tried M-x slime, nope |
| 20:19 | _ato | s/sime/slime/ |
| 20:19 | ambient | cool, slime-quit-lisp works, thanks :) |
| 20:20 | somnium | you can use ns-unmap if there's only one or two |
| 20:21 | technomancy | ambient: re-invoking M-x swank-clojure-project will do it if that's how you launched it. |
| 20:21 | _ato | hmm... looks lie there's also a slime-restart-inferior-lisp |
| 20:21 | ambient | nah, not using swank-clojure-project |
| 20:21 | ambient | even though i perhaps should |
| 20:21 | technomancy | you should, unless you're either hacking clojure itself (or contrib) or are just playing around with Clojure. |
| 20:22 | somnium | I love being to able to jump from a project in new to 1.0 in seconds |
| 20:23 | somnium | technomancy: don't know how I used clojure without it |
| 20:24 | technomancy | sweet. |
| 20:29 | technomancy | _ato: yeah, that doesn't pick up on new jars in lib/, so I don't use it as much |
| 20:32 | Draggor | is this a valid string for add-class? "file./somedir/another/" |
| 20:32 | Draggor | add-classpath* |
| 20:34 | _ato | I doubt it |
| 20:34 | _ato | Draggor: "file:///somedir/another" |
| 20:35 | Draggor | _ato: Sorry, my typing is failing, but I don't want to use an aboslute path. Maybe "file://./somedir/another/"? |
| 20:36 | _ato | I don't think you can use a relative path |
| 20:36 | Draggor | Is there a way to get the current working dir from clojure? |
| 20:36 | _ato | (System/getProperty "user.dir") |
| 20:37 | Draggor | Thank ye sir |
| 20:39 | briancarper | Is it still possible to install swank-clojure without using ELPA and clojure-install and such? |
| 20:40 | briancarper | I'd like to download it to a folder of my choosing and throw some lines in ~/.emacs and have it work. But this seems difficult and undocumented. |
| 20:48 | technomancy | briancarper: the master branch of swank-clojure is still un-elpa-ified |
| 20:48 | technomancy | unfortunately it takes a while for things to propagate to the elpa repos; once it makes it in it will be much more straightforward |
| 20:50 | briancarper | I'd almost rather things be less straightforward. :( I don't like when things are auto-downloaded and stashed away in places I can't find. |
| 20:50 | technomancy | briancarper: the problem is the autoloads for the combination of clojure, swank, and clojure-test-mode are nontrivial |
| 20:50 | technomancy | so it's only straightforward if you don't mind loading them all at emacs boot time, which is not a good general solution. |
| 20:52 | briancarper | Yeah, I've noticed the order is hard to get right. |
| 20:54 | technomancy | there's not much magic behind elpa, it just puts packages in ~/.emacs.d/elpa/PACKAGE-NAME-VERSION/ |
| 20:54 | technomancy | and then it compiles and sets up autoloads |
| 20:54 | technomancy | better get used to it anyway; it's going to be part of Emacs 24. |
| 20:54 | briancarper | When it downloads Clojure itself, where does that end up? |
| 20:55 | technomancy | the new version puts its jars in ~/.swank-clojure/ |
| 20:55 | briancarper | Ah, OK. |
| 20:56 | ambient | weird. (ns amb.synth.foo (:gen-class :methods [[callback [] Integer]])) (defn -callback [this] 0) and then trying to (compile 'amb.synth.foo) returns IOException |
| 20:56 | ambient | "system cannot find the path specified" |
| 20:59 | ambient | *sigh* such fun |
| 21:07 | briancarper | ambient: Do you have a "classes" directory for compiled files to be put into? |
| 21:08 | ambient | yeah, i created it but it might be in the wrong place |
| 21:09 | ambient | it would help if i knew where clojure tried to put them |
| 21:10 | briancarper | I think it's "classes" relative to the current working directory. Check *compile-path*. |
| 21:10 | technomancy | ambient: just check the value of *compile-path* |
| 21:10 | ambient | "classes" |
| 21:12 | ambient | i should probably find out what is current emacs working directory instead of project root or classpath |
| 21:14 | technomancy | ambient: ,cd from slime-repl should do it |
| 21:15 | st3fan | is there a simple way to iterate over a map like python does, with for key,value in map.values() ? |
| 21:16 | ambient | technomancy yeah, putting classes dir to emacs bin directory seems to work, but... i think there might be a better way D: |
| 21:16 | briancarper | st3fan: (for [[k v] some-map] (do-something-with k v)) |
| 21:16 | ambient | there must be a way to change emacs slime-repl working directory on startup |
| 21:16 | st3fan | ah that was the syntax i was looking for! :) |
| 21:17 | briancarper | ambient: Every time I start Emacs I M-x cd into the right project dir, then immediately start Slime from there. |
| 21:18 | ambient | briancarper heh, i already do M-x color-mode-arjen and various rituals |
| 21:18 | ambient | i'd rather automate the whole thing |
| 21:34 | Gul | hi, still learning (at the very beginning), looking for an example of a simple spider (thread pool of 10 connections) for crawling a list of uris, i would be glad if anyone could point me to a simple example |
| 21:45 | Jetien | is there anybody out there? |
| 21:45 | hiredman | ~ping |
| 21:45 | clojurebot | PONG! |
| 21:55 | ambient | so how do i set the default directory in .emacs? |
| 21:56 | gcv | ambient: I think you can just (let ((default-directory "/your/path")) ...) |
| 21:57 | ambient | i dont know how would that work? isn't it usually setting some variable to foo, instead of let |
| 21:58 | ambient | M-x cd is (swank:set-default-directory "foobar") but that doesn't work like that in .emacs |
| 21:59 | gcv | So you're trying to change the current directory for the buffer you're visiting? |
| 22:00 | ambient | i just want a way to keep the default location in which clojure created gen-class classes c:/code/clj/classes |
| 22:00 | ambient | so the working directory of emacs should then be c:/code/clj |
| 22:03 | gcv | at a guess I'd say that forcefully setting the default directory will screw things up for you. I think there's a better way to achieve what you want, trying to think of it now... |
| 22:04 | gcv | ah |
| 22:04 | gcv | I think I have it |
| 22:05 | gcv | http://technomancy.us/126 has a mention that setting -Dclojure.compile.path should do the trick for you. just set it to your absolute path, and you should be good to go. |
| 22:07 | gcv | on another subject, is anyone around who is really good with syntax-quote and unquote? |
| 22:07 | gcv | I'm trying to transform ['a 'b 'c] into [~'a ~'b ~'c] for intentional variable capture purposes. |
| 22:15 | hiredman | gcv: do you have an example? |
| 22:16 | technomancy | gcv: tried ['~'a '~'b '~'c] ? |
| 22:16 | gcv | hiredman: here's what I really want: (map (fn [x] ?????) ['a 'b 'c]) |
| 22:17 | gcv | fill in the question marks |
| 22:17 | hiredman | and what is the output of map? |
| 22:17 | gcv | [~'a ~'b ~'c] |
| 22:17 | hiredman | it would have to be eval |
| 22:18 | gcv | yuck, really? I've been so heavily warned off against eval I didn't even think of it. |
| 22:18 | hiredman | no |
| 22:18 | hiredman | not eval |
| 22:18 | hiredman | ,'a |
| 22:18 | clojurebot | a |
| 22:19 | hiredman | ,`~'a |
| 22:19 | clojurebot | a |
| 22:19 | hiredman | no difference |
| 22:19 | st3fan | gcv, show the full code |
| 22:20 | hiredman | so what you want makes no sense, so it's time to widen the scope of the inquery |
| 22:20 | gcv | okay, this needs a little explanation |
| 22:20 | gcv | yes :) |
| 22:20 | gcv | okay, I'm really really sick and tired of parsing out my own arglists for keyword arguments, so I set out to write something that handles keywords like Common Lisp's lambda lists |
| 22:20 | gcv | defnk is cool and all, but doesn't work with multimethods |
| 22:20 | gcv | or (fn [...] ...) forms |
| 22:20 | hiredman | god |
| 22:21 | hiredman | just use map destructuring |
| 22:21 | hiredman | I am tired of defnk and apply hash-map nonsense |
| 22:21 | gcv | yes, map destructuring is a decent alternative, but isn't quite as DRY as I'd like |
| 22:22 | hiredman | ,((fn [{:keys [a b]}] [a b]) {: 1 :b 2}) |
| 22:22 | clojurebot | Invalid token: : |
| 22:22 | hiredman | ,((fn [{:keys [a b]}] [a b]) {:a 1 :b 2}) |
| 22:22 | clojurebot | [1 2] |
| 22:22 | gcv | And you had to write each symbol twice |
| 22:22 | chouser | no |
| 22:22 | gcv | one other wrinkle |
| 22:22 | hiredman | uh |
| 22:22 | hiredman | what? |
| 22:23 | gcv | sorry, if you want to specify defaults, you have to write each symbol twice, once in :keys and once in :or |
| 22:23 | hiredman | ,((fn [a b] [a b]) 1 2) |
| 22:23 | clojurebot | [1 2] |
| 22:24 | hiredman | gcv: ok, where is your implementation of this? |
| 22:24 | gcv | I want (1) to specify defaults, and (2) to be able to specify an extra optional symbol to be set to an indication if the keyword was passed in. In short, I want it to work exactly like Common Lisp :) |
| 22:25 | hiredman | actually, forget it, it's bound to be a complicated macro, and I have no motivation for this, maybe someone else will look at it |
| 22:25 | gcv | hiredman: okay, no worries, thanks anyway |
| 22:27 | gcv | http://paste.lisp.org/display/90409 |
| 22:30 | st3fan | cool! http://github.com/technomancy/leiningen/blob/master/README.md |
| 22:58 | technomancy | st3fan: let me know how it works for you if you try it |
| 22:59 | technomancy | I haven't even announced it and it seems there's a lot of interest, so I guess it's addressing a pain point for clojure developers |
| 23:00 | cross | i'm trying to build neman.cells, but having some trouble. does anyone know of a pre-built jar somewhere? |
| 23:01 | technomancy | yay; slime/swank-clojure got uploaded to elpa. |
| 23:05 | gcv | technomancy: does leiningen support going against non-canonical Maven repositories? |
| 23:07 | technomancy | gcv: yeah, I just added that |
| 23:08 | technomancy | it includes build.clojure.org by default, but you can add more in project.clj |
| 23:08 | technomancy | not documented yet, but you just add :repositories {"myrepo" "http://my.repo.org"} to defproject |
| 23:09 | gcv | very very nice. thanks for taking this on. |
| 23:09 | technomancy | somebody had to do it. =) |
| 23:11 | scottj | How do the new branches on clojure and contrib work? Does everything go there first, or just new features, and when are they moved into master? |
| 23:12 | scottj | Do you guys use the new branches for active development? Is there often breakage between core and contrib and slime and swank when following new? |
| 23:13 | _ato | scottj: the "new" branch doesn't actually mean new as in "new things" in means "new" as "new-new" (a feature which was later renamed to reify) |
| 23:13 | hiredman | the new branch of contrib is brand new |
| 23:14 | gcv | scottj: fwiw, the latest slime and swank-clojure work just fine with Clojure from the 'new' branch. |
| 23:14 | _ato | scottj: but yes experiement features that might change completely or may never actually make it into clojure are developed in branches |
| 23:15 | hiredman | the new branch of contrib is for contrib contributors to play with features from the new branch of clojure |
| 23:16 | _ato | smaller changes and bugfixes go into master, so you can generally rely on master being reasonably stable |
| 23:16 | _ato | (in the sens of API stability) |
| 23:18 | technomancy | clojure.contrib.logging has a really lousy format by default: Nov 14, 2009 8:16:51 PM clojure.contrib.logging$fn__5081$impl_write_BANG___5089 invoke INFO: Compiling leiningen.uberjar |
| 23:18 | technomancy | |
| 23:18 | technomancy | any way to tidy that up without pulling in something like log4j? |
| 23:19 | technomancy | never mind; there's really no reason to use anything more complicated than println in this case. =P |
| 23:19 | hiredman | I think that is java.util.Logger's format |
| 23:20 | hiredman | time classname method name loglevel message |
| 23:20 | _ato | which I think you can override by subclassing java.util.logging.Formatter |
| 23:21 | hiredman | :( |
| 23:21 | technomancy | yeah, println wins for this. =) |
| 23:21 | _ato | yeah, definitely |
| 23:21 | hiredman | (binding [*out* *err*] (prn :foo)) |
| 23:23 | _ato | technomancy: does compiling something with a different version of clojure.jar to the one leiningen is running in work? |
| 23:24 | _ato | eg. I was thinking about a case where you might want to compile against 1.0 but leiningen is running 1.1 or vice-versa |
| 23:25 | technomancy | _ato: currently unsupported, but I think it could be added without too much difficulty with lancet's "java" task. |
| 23:25 | _ato | ah good point, so that'd let ant do the trouble of setting up the classloaders and whatever is necessary |
| 23:26 | technomancy | yeah, that part doesn't sound like fun to implement |
| 23:26 | hiredman | technomancy: because of the way clojure's compiler currently works, if you compile again from the same java process, your compiled classes will be overwritten with garbage |
| 23:27 | hiredman | this is something to keep in mind with build systems |
| 23:27 | technomancy | good to know |
| 23:27 | _ato | I like the way you're using the ant maven tasks as well. I used the maven API directly in clojars-web and it's horrible |
| 23:27 | _ato | all that weird plexus stuff |
| 23:27 | technomancy | _ato: isn't it a mess? |
| 23:27 | technomancy | ivy was not quite as bad, but still a headache |
| 23:28 | technomancy | hiredman: the differing clojure versions problem means we'd need a separate java process eventually anyway, but I haven't gotten around to that yet |
| 23:28 | _ato | it's crazy.. not only do you need to do the usual javaish factory stuff, you have to now lookup factories in a magical container thing |
| 23:28 | technomancy | _ato: I completely failed to load Maven.main from within Clojure at all. |
| 23:31 | _ato | I didn't try maven.main, I was just trying to use the repository deployment stuff and ended up looking at what the maven-deploy-plugin does |
| 23:31 | _ato | although half of it is implicit cause things get autowired all over the place by plexus |
| 23:32 | _ato | http://github.com/ato/clojars-web/blob/master/src/clojars/maven.clj |
| 23:32 | technomancy | _ato: so maven has this idea that some dependencies are "test scoped" and don't apply in production |
| 23:32 | technomancy | but I'm thinking that a separate list of dev-time dependencies is clearer |
| 23:33 | technomancy | since they really are two separate lists: things this code needs to run vs things you need to install to be able to hack on it. |
| 23:33 | technomancy | does that make sense to you? |
| 23:34 | _ato | hmm... can you give me an exxample of a dev-time dependency? do you mean like unit-testing frameworks? |
| 23:35 | technomancy | yeah, swank-clojure is the textbook example |
| 23:35 | technomancy | or other leiningen plugins |
| 23:35 | _ato | ah right, and like nailgun for vimclojure and such, okay gotcha |
| 23:36 | _ato | should that be something that is specified in the project, or should it be implied by using lein swank? |
| 23:37 | technomancy | I'm thinking of moving lein swank into a plugin |
| 23:37 | technomancy | so you'd add leiningen-swank to your dev deps if you wanted to use it |
| 23:38 | _ato | hmm okay. I'm a bit 50-50 on that. I don't really like the idea of having to modify your project.clj just to run swank on it |
| 23:39 | technomancy | you have to do that either way... really the question is rather the dev-time dependencies should be a separate list, or if the main deps list should have a "scope" attribute. |
| 23:39 | _ato | I'd put it in a seperate list |
| 23:40 | technomancy | it's not "the maven way", but I think it's clearer |
| 23:40 | _ato | less boilerplate that way, you just have to specify the scope once for each type of scope, instead of for every dependency |
| 23:40 | _ato | yeah and it also groups together things that are dev-only vs normal deps |
| 23:40 | gcv | hiredman: turns out I was chasing the wrong problem earlier. got it working now |
| 23:41 | gcv | check out http://paste.lisp.org/display/90409#3 for a flexible way to handle keyword arguments. works with defmethod and plain fn forms. |