#clojure log - Jan 05 2010

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

1:13 ndimiduk: from within (ns foo (:gen-class)), how do I access foo.class?

1:13 i'd like to pass the .class of the generated class as a parameter. saying (. instance method foo) doesn't work.

1:13 compiling throws an exception saying Unable to resolve symbol foo

1:21 scottj_: is there a function in clojure or contrib to turn [{:a "x" :b 1} {:a "y" :b 1} {:a "x" :b 1}] into {"x" 2 "y" 1}?

1:22 I wrote my own with reduce and but I'm wondering if there's a higher level idiom I'm missing

1:26 somnium: ,(frequencies [{:a "x" :b 1} {:a "y" :b 1} {:a "x" :b 1}])

1:26 clojurebot: {{:a "y", :b 1} 1, {:a "x", :b 1} 2}

1:26 somnium: ^^ gets pretty close, one transformation or so away

1:27 danlarkin: What will the syntax be for defining a print-dup for a byte array

1:28 defmethod print-dup bytes isn't it, defmethod print-dup [B throws an EOFException

1:28 those were my two ideas

1:29 somnium: (->> [{:a "x", :b 1} {:a "y", :b 1} {:a "x", :b 1}] frequencies (map (fn [[{a :a} b]] [a b])) (reduce merge {}))

1:30 ,(->> [{:a "x", :b 1} {:a "y", :b 1} {:a "x", :b 1}] frequencies (map (fn [[{a :a} b]] [a b])) (reduce merge {}))

1:30 clojurebot: {"x" 2, "y" 1}

1:31 somnium: hmm, into {} better than reduce merge

1:33 scottj_: somnium: interesting. my example wasn't clear but I actually wanted to add up the :b's, that's how "x" gets 2

1:34 somnium: scottj_: well, as long as :b is always 1 it will work for any value of :a

1:35 scottj_: but to your orginal question frequencies is the only that I know of

1:38 scottj_: this is the best I came up w/, curious if there's something better

1:38 (reduce (fn [result item] (assoc result (:a item) (+ (get result (:a item) 0) (:b item)))) {} [{:a "x", :b 1} {:a "y", :b 1} {:a "x", :b 1}])

1:43 somnium: ,(reduce (fn [m {x :a y :b}] (update-in m [x] + y)) { "x" 0 "y" 0 } [{:a "x", :b 1} {:a "y", :b 1} {:a "x", :b 1}])

1:43 clojurebot: {"x" 2, "y" 1}

1:44 somnium: scottj_: + blows up on nil keys so a custom + fn would make it a bit more robust

1:51 ,(reduce (fn [m {x :a y :b}] (update-in m [x] #(-> %1 (or 0) (+ %2)) y)) {}

1:51 [{:a "x", :b 1} {:a "y", :b 1} {:a "x", :b 1}])

1:51 clojurebot: EOF while reading

1:52 somnium: ,(reduce (fn [m {x :a y :b}] (update-in m [x] #(-> %1 (or 0) (+ %2)) y)) {} [{:a "x", :b 1} {:a "y", :b 1} {:a "x", :b 1}])

1:52 clojurebot: {"y" 1, "x" 2}

1:52 somnium: last try before bed :)

2:06 scottj_: on reflection I think I like your original better, I would just add map destructuring

2:11 chouser: danlarkin: (Class/forName "[B") I think

2:13 or (type (byte-array nil))

2:13 danlarkin: chouser: ah ha, trickery :)

2:13 thanks

4:56 adityo: ~max people

4:56 clojurebot: max people is 240

6:19 defn: How does one use options with (clojure.contrib.shell-out/sh)?

6:19 ,(use 'clojure.contrib.shell-out)

6:19 clojurebot: nil

6:20 defn: ,(doc sh)

6:20 clojurebot: "([& args]); Passes the given strings to Runtime.exec() to launch a sub-process. Options are :in may be given followed by a String specifying text to be fed to the sub-process's stdin. :out option may be given followed by :bytes or a String. If a String is given, it will be used as a character encoding name (for example \"UTF-8\" or \"ISO-8859-1\") to convert the sub-process's stdout to a String which is returned. If :byt

6:23 shafi: Are there any clojure examples based on GPU?

6:26 hoeck: defn: it parses its args, and whenever it finds a keyword, the next string is considered a value to this key

6:27 defn: so this should work: (sh "ls" "-l" :in "-a"), or this (sh :in "abc" "ls" "-la")

6:29 clojurebot: google clojure gpu

6:29 clojurebot: First, out of 6760 results is:

6:29 ideolalia - is it strange to dance so soon

6:29 http://ideolalia.com/

6:30 hoeck: shafi: ^^

6:30 slashus2: http://github.com/ztellman/penumbra

6:31 shafi: Many thanks. I will have a look.

6:53 defn: hoeck: thanks buddy

7:00 praptak: Suggestions for Clojure docs changes. Where to raise them?

7:01 Is there an accepted way to suggest improvements to docs?

7:02 slashus2: praptak: Raise the issue in the google group.

7:02 praptak: Ok, thanks.

7:02 Chousuke: though if it's just "add examples, please", then don't bother. that's a known issue :)

7:03 unless you have a solution for it, of course.

7:03 praptak: Nope, maybe it's even "remove examples" :)

7:32 cark: clojurebot: source reductions

7:34 clojurebot: source rec-seq

7:38 bbommarito: Does Clojure have something like progn?

7:38 praptak: do

7:38 I believe that 'do' is the Clojure equivalent of progn

7:39 bbommarito: praptak: Thanks much. I'm sitting here trying to figure out why progn is bombing, until I think that maybe Clojure doesn't have that construct.

7:40 I may at some point have to add a progn into Clojure.

7:44 praptak: I am not sure if 'do' is 100% equivalent to 'progn', though.

7:47 bbommarito: praptak: Looks to be...I use progn usually for one use: ifs

7:48 Yep, do is progn. Takes a series of forms, evaluates them in order, returns the last one.

7:49 praptak: At this level they are equivalent - I mean the fine details of compilation (what is and what isn't a top-level form, etc.)

7:50 bbommarito: praptak: I don't tend to concern myself so much at the lower level of functions (I should, but sometimes there isn't time).

7:50 Chousuke: progn is a weird name :/

7:50 I'm still not sure what it's supposed to mean

7:51 I guess it's something historical like car and cdr

7:51 praptak: I think it's "professional gnome"

7:51 bbommarito: Chousuke: progn is a program without arguments, prog is a program with arguments. prog is an older lisp form.

7:52 Chousuke: I see.

7:52 bbommarito: prog takes arguments in, sort of like a let, and progn doesn't. Needless to say, you will see mostly progn when you need to run multiple forms in a body (IE in an if)

7:56 praptak: for this, we have 'when'

7:56 bbommarito: You can do: (prog ((x 1)(y 2)(z 3)) (print x)(print y)(print z))

7:57 praptak: I try to use whens and unless whenever possible, but sometimes you need both conditions.

7:57 praptak: True.

7:58 bbommarito: I really have to set slime up with clojure and allegro...make my life so simple.

8:01 hoeck: I always thought then n in progn stands for the nth-form which is returned

8:03 bbommarito: "progn is a special form that stands for “program with no arguments”."

8:05 That's the best meaning I could find for it.

8:07 progn is identical to prog, except prog can take arguments, progn cannot.

8:09 hoeck: but there is also prog1 and prog2, both taking any number of forms returning the result of the first or the second

8:10 but anyway, sometimes I'm really in need of a do1, in clojure

8:10 Chousuke: do1? :/

8:10 ah.

8:10 read only the latest line :P

8:13 bbommarito: Oooohhhh, prog could be useful. There is another macro to write in clojure.

8:14 I have never heard of dol.

8:19 Which means I have to figure out how to take a list of bindings...

8:25 Chousuke: prog just looks like a plain let though :/

9:11 * praptak breaks out the slapping rod and looks sternly at praptak

10:02 danlei: when I try to use contrib from the new branch I always get NoSuchMethodErrors (RestFn ...) I thought that a patch was applied to contrib to fix that?

10:03 the-kenny: danlei: Have you tried rebuilding a clean contrib? (ant clean && ant build)

10:03 danlei: the-kenny: ah, that might be it

10:03 the-kenny: clojurebot: clojure.lang.RestFN

10:03 clojurebot: ant clean and rebuild contrib

10:03 the-kenny: :)

10:04 danlei: ant stuff :D

10:04 I always mess it up :)

10:06 chouser: ooh

10:09 danlei: the-kenny: works, ty

10:09 the-kenny: danlei: You're welcome

10:27 danlei: are there plans to get clojure-dev on gmane, too?

10:27 would be nice

10:43 CalJunior: Have a question about am auto-proxy macro for implementing a Java interface. See the macro here: http://paste.lisp.org/+1ZRY

10:46 This is a macro I found on a blog by Tim (don't know his surname) on his blog at brool.com

10:47 The macro works very well and saves a lot of overriding code when implementing a Java interface with a lot of things that need to be overriden.

10:48 The problem I have is that it seems to override only the first call I define.

10:49 This is his example implementation of auto-proxy: http://paste.lisp.org/+1ZS0

10:51 defn: Is there a limit to the depth a namespace can be?

10:51 www.xyz.server.foo.bar.baz

10:54 CalJunior: OK, posted too soon. I solved the problem. I had a bug in the second defined method.

10:54 the macro is perfectly fine.

10:54 Chousuke: defn: probably not any limit that you're going to hit :P

10:55 unless you like REALLY long names.

10:56 CalJunior: by the way: would be nice to have this in clojure contrib. very handy for java interop.

10:56 I have asked Tim to submit it.

12:23 rbe: whats your favourite solutions for distribution, clustering?

12:27 esj: from what I've read Terracotta seems to be in favour

12:28 is there a way to upack the arguments that get bundled as an array seq in & parameters ?

12:29 arohner_: esj: yes, destructuring in the fn args, and let

12:30 esj: oooh that's sneaky

12:30 arohner_: http://clojure.org/special_forms

12:30 esj: thanks

12:31 perhaps that's what I need... can you look at my mock-up example at http://paste.lisp.org/display/93032 see ?

12:32 or perhaps my hiding of the composition is stupid ?

12:33 arohner_: if you want ((seq-add-x 2) 10) and ((seq-add-x 2) 10 20) to work, you'll need to dispatch on the type

12:33 Chousuke: what exactly do you want those to do? :/

12:33 arohner_: (cond (number? y) ... (seq? y) ...)

12:34 churib: perhaps apply would help :)

12:34 arohner_: oh, yes

12:34 that's a better solution

12:35 esj: sorry, as usual I'm not clear. The composed function is for a DSL, so I want to able to do (s-a-x 4 3) or (s-a-x 4 3 10) rather than ((s-a-x 4) 3) and ((s-a-x 4) 3 10), to make the interface clean.

12:35 but can't figure out how to write the wrapping function

12:35 arohner_: so you want s-a-x to return [3+4 10+4]?

12:35 Chousuke: but what are those supposed to do?

12:36 remember, you can also overload on arity.

12:36 JonSmith: you could always make it ((s-a-x 4) 3 10) and then write a macro

12:36 esj: yeah, I could explicitly overload by arity

12:37 but it seems like there should be a way to avoid that ?

12:37 arohner_: (defn s-a-x [x & y] (map #(+ x %) y))

12:37 assuming you want to add the first argument to each of the second

12:37 Chousuke: esj: there might be if I understood what you want the functions to do.

12:37 arohner_: (s-a-x 4 3 10) => (7 14)

12:37 JonSmith: idk i like macros :-P

12:38 Chousuke: aha.

12:39 churib: overloaded arity in already built in +

12:39 ,(+ 1 2 3)

12:39 clojurebot: 6

12:40 esj: the example itself is totally made up to have something simple to talk about. What I've got is a composed function which (like range) has several possible arities. So if I accept the double parens ((s-a-x 3) ...) then I'm 100% fine. But I'd like to get rid of the internal parens and have calls like (s-a-x 3 ...). Perhaps I'm just being greedy ?

12:40 Chousuke: and is the two-argument form of s-a-x supposed to use a range of ten elements as the seq?

12:40 I still don't quite get what they're supposed to do.

12:41 JonSmith: well you can just wrap the double parens in another function

12:41 esj: Chousuke: the two argument form of s-a-x calls the two argument form of range.

12:42 JonSmith - yes, but then I have arity trouble in writing this wrapping function.

12:42 Chousuke: ,((partial apply (comp #(map + 1 %) range)) 1 5)

12:42 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

12:42 Chousuke: hm

12:43 whoops

12:43 ,((partial apply (comp #(map (partial + 1) %) range)) 1 5)

12:43 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

12:43 esj: the partial ?

12:43 JonSmith: (defn s-a-x [& args] (let [function (fn [] ...composed... function)] (apply function args)))

12:43 Chousuke: ghsghj

12:43 JonSmith: or something like that

12:44 can do arg & argsif you want to have one seperated out

12:44 esj: JonSmith... interesting, let me wrap my mind around that .

12:44 JonSmith: arg and args if*

12:44 Chousuke: ,((partial apply (comp #(map (partial + 1) %) range))) 1)

12:44 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$apply

12:45 Chousuke: ,((partial apply (comp #(map (partial + 1) %) range))) 1 2)

12:45 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$apply

12:45 Chousuke: ardsgf

12:45 * Chousuke can't count the parens

12:45 Chousuke: also, point-free :(

12:45 JonSmith: point free makes my head hurt :-(

12:46 ((partial apply (comp #(map (partial + 1) %) range))) (list 1 2))

12:46 Chousuke: ah, right.

12:46 JonSmith: ,((partial apply (comp #(map (partial + 1) %) range))) (list 1 2))

12:46 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$apply

12:46 JonSmith: lol

12:46 maybe not

12:46 Chousuke: ,((partial apply (comp #(map (partial + 1) %) range)) [1 5])

12:46 clojurebot: (2 3 4 5)

12:46 JonSmith: ah

12:46 there we go

12:46 Chousuke: ,((partial apply (comp #(map (partial + 1) %) range)) [5])

12:46 clojurebot: (1 2 3 4 5)

12:47 Chousuke: ,(let [s-a-x (fn [& args] ((partial apply (comp #(map (partial + 1) %) range)) args))] (s-a-x 1 3))

12:47 clojurebot: (2 3)

12:47 esj: smoooth

12:48 Chousuke: completely unreadable :P

12:48 actually.

12:48 the partial apply is unnecessary

12:49 ,(let [s-a-x (fn [& args] (apply (comp #(map (partial + 1) %) range)) args)] (s-a-x 1 3))

12:49 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$apply

12:49 Chousuke: or wait.

12:49 ,(let [s-a-x (fn [& args] (apply (comp #(map (partial + 1) %) range) args))] (s-a-x 1 3))

12:49 clojurebot: (2 3)

12:50 esj: I know nothing about macros, so forgive me if its a stupid, but is there not a way just to pass in ((s-a-x a) ...) and get out (s-a-x a ...) ?

12:50 sorry, the other way around.

12:50 Chousuke: no.

12:50 or yes, but s-a-x would then be infinitely recursive

12:51 hmm.

12:51 or actually, not.

12:51 depends on what the one-argument form of s-a-x expands to.

12:52 it's actually pretty easy: (defmacro sax ([x & xs] `((sax ~x) ~@xs))) ([x] one-arg-form-here))

12:53 esj: :)

12:53 konr: Are there documentation functions (something like describe-symbol) available in clojure--mode on emacs? Strangely I couldn't find anything on the docs

12:54 Chousuke: konr: C-c C-d or something prints docstrings

12:54 Might be C-c C-d d or C-c C-d C-d. I'm not sure.

12:54 all I know is that it works :P

12:55 my fingers do it so I'm not sure of the command :D

12:55 konr: Chousuke: Hahaha, I guess I'm using an old version, then

12:55 esj: thanks for your help everybody.

12:55 Chousuke: konr: I think it might be a SLIME thing actually.

12:57 esj: konr: I saw an slime "inspect" thing working in Lau Jensen's screencast, never got it working myself.

12:57 that brought up the javadocs

12:59 konr: esj: thanks for the reference! I was precisely looking for a compojure screencast

12:59 technomancy: esj: it requires Emacs 23 unfortunately, are you on an older version?

13:00 arj_: seq-utils/flatten seems to be failing for me. I have a lazyseq of arraylists and if I flatten it, it just gives me back the lazyseq again

13:01 the-kenny: slime-inspect is working fine here, without a special setup

13:02 patrkris: what is the easiest way of creating a map m2 from m1, where all values of m2 are the values from m1 except that str has been applied to them?

13:03 esj: technomancy: shouldn't be, its the latest aquamacs.

13:03 maybe I should try harder.... hold on.

13:04 the-kenny: patrkris: A mix of zipmap, keys and values

13:04 patrkris: the-kenny: of course! thanks!

13:07 technomancy: oh, with aquamacs all bets are off

13:08 the-kenny: ,(let [map {:foo 42 :bar 23} ] (zipmap (keys map) (map str (vals map))))

13:08 clojurebot: {:bar 23, :foo 42}

13:08 the-kenny: ,(let [m {:foo 42 :bar 23} ] (zipmap (keys m) (map str (vals m))))

13:08 clojurebot: {:bar "23", :foo "42"}

13:08 the-kenny: :)

13:08 patrkris: there you are

13:09 patrkris: the-kenny: i did exactly that, except that I keep forgetting that I can just pass standard functions to map (instead of str I passed #(str %) as the map function)

13:10 the-kenny: thanks in any case

13:10 the-kenny: You're welcome :)

13:44 jlongster: Hey guys, I'm new to Clojure. What's the best practice for splitting up a project into several files? I want each file to have its own namespace, and import them into each other. But I can't find a way to do relative imports.

13:49 the-kenny: jlongster: (ns foo.bar) in src/foo/bar.clj, (ns foo.baz) in src/foo/baz.clj

13:49 jlongster: importing is done with the correct classpath (for examplw provided by swank-clojure-project) and (require 'foo.bar) or (require 'foo.baz)

13:50 jlongster: the-kenny: ok, so I need add my project's path onto the list of classpaths?

13:50 phaer: I have been trying to install vimclojure for hours, without success. ng-server runs, syntax highlighting, rainbow parens,.. works. But there are now keymappings in, according to :nmap and if i want to :call vimclojure#EvalFile() - for example - it throws errors: http://dpaste.com/141401/

13:50 jlongster: Can I do that with Clojure code?

13:55 technomancy: jlongster: no; the JVM doesn't allow that =(

13:55 jlongster: setting up your classpath is something that should be handled by your editor

13:57 jlongster: technomancy: ok. I can write some Emacs functions. thanks.

13:58 technomancy: jlongster: they're written for you. =) check out M-x swank-clojure-project from the swank-clojure readme

14:00 jlongster: technomancy: I've already got that set up and using SLIME. It's great. I don't want to hardcode project paths in my .emacs though, so I think I'll write a "slime-at-project" function which takes a path, sets the cwd to it and adds it to the classpath, and fires up SLIME. Or does it do something like that already?

14:02 technomancy: you've basically just described swank-clojure-project, yeah

14:03 jlongster: Oh, I must not have that code then, it sits on top of swank-clojure?

14:03 aking: jlongster: no need to hardcode paths in .emacs - M-x swank-clojure-project asks for the correct path and automatically uses any jars in the dep dir

14:04 technomancy: jlongster: it's defined in swank-clojure.el. if you've got an old version remove your config and install via package.el: http://tromey.com/elpa/install.html

14:04 aking: jlongster: if you're using lein that is..

14:06 jlongster: see technomancy's leiningen here: http://github.com/technomancy/leiningen/

14:07 jlongster: technomancy: aking: thanks, I'll install it through elpa

14:13 technomancy: If I may ask this here, I just installed swank-clojure through elpa. I don't see a swank-clojure.jar though, doesn't it need one? And what should be in my .emacs now? Just my call to "swank-clojure-config"?

14:14 LauJensen: jlongster: http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/

14:16 technomancy: jlongster: swank-clojure-config is deprecated

14:17 swank-clojure.jar should be handled by leiningen or whatever you're using for deps

14:18 jlongster: technomancy: ok

14:32 knuckolls: LauJensen: since we're on the topic. that screencast you posted was just what i needed to finally get everything set up with emacs last week. thanks.

14:33 LauJensen: knuckolls: Great, I'm glad to hear it :)

14:41 joshua-choi: Is there a version of clojure.template/do-template that encloses its expansions in a list rather than a do block?

14:41 Or some kind of sequence

14:43 jlongster: technomancy: So I've downloaded all of the necessary Emacs packages, and now I need the swank-clojure.jar file. Were you saying that I need to build it myself?

14:46 technomancy: jlongster: no, it should be handled like any other JVM dependencies. (using leiningen, maven, etc.)

14:47 jlongster: I'm completely new to the JVM/Clojure world, and that's the first time I've heard of leiningen, which looks like a tool which would help me build swank-clojure.jar. If you have time, do you mind elaborating?

14:49 technomancy: jlongster: this is a pretty good introduction: http://zef.me/2470/building-clojure-projects-with-leiningen

14:52 the-kenny: hm.. the post doesn't use "lein new" for bootstrapping project directories

14:53 aking: jlongster: once you have lein installed and a project setup, just add " :dev-dependencies [[org.clojure/swank-clojure "1.0"]])

14:53 the-kenny: aking: there's already [swank-clojure "1.1.0"] :)

14:54 jlongster: But surely my project doesn't depend on swank-clojure, it's just my development environment that does?

14:54 aking: to the project.clj file and do M-x swank-clojure-project

14:55 the-kenny: jlongster: That's what :dev-dependencies is for

14:55 aking: you forgot "lein deps"

14:55 aking: jlongster: you're right - that's why it's tagged as :dev-dependenciers

14:55 jlongster: ok, I see. It's still a little strange that my project should mention it at all though.

14:58 aking: So - to setup a new project called 'jlo', it's simple: lein new jlo; cd jlo; "add the swanl-clojure dependency to project.clj";lein deps - and that's it

14:59 the-kenny: aking: Yes

14:59 :)

14:59 aking: the-kenny: yup - I'm already using that for 3 different projects - love the uberjar option :)

15:00 the-kenny: aking: uberjar is really cool - especially for deploying :)

15:10 defn: im having trouble with shell-out

15:11 (sh *command* :in "abc123" "-x" "-f" "etc")

15:11 the command expects a file where abc123 is

15:12 chouser_: :in supplies the given string as the command's stdin

15:13 cburroughs: I am trying to use clojure.contrib.http.agent to open a large number of urls. One of those requests has a problem with "Agent has errors". I can't figure out how to either 1. figure out which url caused the error 2. keep the error from blocking the rest of the requests.

15:13 defn: chouser: is there a way to fake it being a file?

15:13 chouser: defn: many commands take a dash "-" to mean "read from stdin instead of a file"

15:14 cburroughs: (A better way to open a large number of urls would also be welcome.)

15:14 chouser: cburroughs: agent error handling is up for an overhaul

15:15 the-kenny: cburroughs: Can you define "open"?

15:15 jlongster: Hey guys, thanks for the help so far. I've got everything installed now and unfortunately I'm getting an obscure error when I run SLIME. I can look into it more, but is this a common error?

15:15 http://paste.lisp.org/display/93041

15:15 Emacs 23.1 on OS X

15:15 chouser: cburroughs: until then, you can try 'agent-errors' to get a look at the details of the stack trace

15:15 the-kenny: If you just want the text behind the url, you could use slurp* together with a ThreadPool

15:15 cburroughs: the-kenny, GET the url

15:16 chouser: cburroughs: or be careful to wrap try/catch around every action you send to the agent, printing what ever details you need in the 'catch'

15:16 the-kenny: cburroughs: Try slurp* with a threadPool :) slurp* is a member of duck-streams and can pull text from urls of different types

15:17 jlongster: Huh? the ~/tmp/bla.something looks wrong

15:17 aking: jlongster: M-x swank-clojure-project doesn't work?

15:17 the-kenny: It's /var/folders/something here.

15:18 cburroughs: the-kenny, Is there a standard threadpool to use?

15:18 jlongster: aking: no, in the end that still calls slime

15:19 the-kenny: I don't know why it's that way, but ~/tmp exists so it should be able to create it

15:19 the-kenny: cburroughs: hm.. not one that I'm aware of. But it's easy of you use java.concurrent.Executor

15:19 jlongster: hm yes, right.

15:19 aking: jlongster: I used to do M-x slime to start slime - but no need to now with the lein stuff.

15:20 the-kenny: jlongster: Are the permission of the directory correct?

15:20 jlongster: I create stuff in ~/tmp all the time, so yeah

15:20 the-kenny: and what if you do "lein repl" and paste the code there? You can also try to modify the file-url when you paste it

15:21 ctdean: It's the shell that expands ~/tmp Try using the fully qualified pathname

15:22 jlongster: ctdean: good point, that's what it is

15:22 Why is it trying to create it there then?

15:22 * the-kenny would take a look at swank-clojure.el

15:25 jlongster: finally.

15:25 I had to:

15:25 (setq temporary-file-directory "/var/tmp")

15:25 the-kenny: In your .emacs?

15:25 jlongster: I freaking hate setting up development enviroments.

15:26 yeah

15:26 the-kenny: try (expand-file-name "~/tmp/")

15:26 The command will expand the ~

15:26 jlongster: The default one in my slime.el was set to ~/tmp

15:26 I could do that too

15:26 ctdean: There is probably a EXPAND-FILE-NAME missing somewhere in your emacs startup, or a misconfigure env variable

15:27 yep, like he said :)

15:27 aking: looks like slime will use one of: TMPDIR TMP or TEMP, if found

15:27 technomancy: jlongster: you aren't using aquamacs by any chance, are you?

15:28 jlongster: No, just the normal gnu emacs which recently incorporated the Cocoa-specific Emacs extensions for OS X

15:29 ctdean: Yeah, it looks like "~/tmp" was set in my custom-set-variables

15:30 Thanks guys, gotta restart Emacs

15:30 ordnungswidrig: re

15:32 does anybody know of a clojure lib to produce css?

15:35 ctdean: How do folks setup a repl when deploying a production app?

15:42 poet: any idea what could cause this error in leiningen? https://pastee.org/dk3mf

15:57 Licenser: good evening my lispy friends!

15:57 konr: hi there!

15:57 Licenser: I have a question regarding security today. Is it possible to wrap a single function call into something like a 'secure' manner? that it can only accees some functions not overload memory or eat unlimited time?

15:58 somewhat like the clojurebot is doing but I'm not sure of his security isn't JVM based

15:58 * the-kenny thinks clojurebot's security is jvm-based

15:58 * ordnungswidrig thinks this, too.

15:58 ordnungswidrig: I like the jvm for that

15:58 +chroot, selinux and ulimit

15:58 chouser: preventing consumption of memory and time are both rather tricky, I think.

15:59 hiredman: yes

15:59 Licenser: well time can be done with a thread and a timeout - that should not be so hard me thinks

15:59 chouser: yeah, chroot, ulimit, etc. are probably more bullet-proof.

15:59 Licenser: chouser: yap but I don't want to fire up a own JVM for every function call - not really feasable for my scenario :P

16:00 hiredman: Licenser: but what if your function starts other threads?

16:00 chouser: Licenser: but what do you do when the timeout expires? The only way to guarantee a shutdown of some other thread is using a deprecated method call.

16:00 hiredman: that too

16:00 Chousuke: Clojurebot's security measures are rather fragile :/

16:00 hiredman: of course, deprecated things are never *removed* from java

16:00 Licenser: hiredman: that (and other things) fall under 'can only access some functions'

16:00 Chousuke: it's pretty easy to DOS

16:00 chouser: Licenser: you could keep a process running and toss functions to it to eval. nailgun-like.

16:01 ordnungswidrig: you could use a bunch of jvm to eval a request and then kill the jvm is a request takes to much time.

16:02 jkill to the rescue

16:02 Licenser: Heh

16:02 pjackson: How do people generally host a Compojure app? Via Apache?

16:02 ordnungswidrig: or ulimit with cpu-bounding. Don't know if you can limit the max user/sys time

16:02 Licenser: Well I had the same problem with ruby, I solved it by writing a own VM to run the code on (not an ideal but pretty interesting solution)

16:02 ordnungswidrig: pjackson: you mean apache http server or apache tomcat :-) or apache geronimo.

16:03 pjackson: I don't know, how do you do it? :)

16:03 ordnungswidrig: pjackson: I'd use jetty + ngnix

16:03 pjackson: or pure jetty if a single instance is enough

16:03 pjackson: Really? Cool, thanks.

16:03 Licenser: What I generally want to do is having a Server that can run user submitted functions without them wreaking havoc on the server itself or being able to do more then they should do (

16:04 arohner_: that's very hard in the general case

16:04 how much do you care about maliciousness?

16:04 the-kenny: Licenser: Why not do it like clojurebot?

16:04 Chousuke: the-kenny: Clojurebot is not very safe.

16:04 Licenser: the-kenny: because that would also limit the server itself to run certein functions when I'm not mistaken

16:05 arohner_: It sould be not like a open door :P

16:05 ordnungswidrig: Licenser: i would surely pool some jvms with strict java policy and jail them in chroots.

16:05 Chousuke: the-kenny: you can't take over the system it runs on, but you can make the JVM it runs on pretty much use its maximum allotted resources.

16:05 knuckolls: pjackson: there was an article on hn about deploying compojure websites earlier today. http://briancarper.net/blog/deploying-clojure-websites

16:05 ordnungswidrig: Licenser: you can distribute the requests using some mq like rabbitmq

16:05 Licenser: ordnungswidrig: sounds like a good start

16:06 hiredman: the other option is writing an interpreter

16:06 Chousuke: Licenser: write a clojure interpreter and disable the . special form except for core functions!

16:06 Licenser: then you can easily interrupt any rogue clojure code.

16:06 Licenser: Chousuke: I run a solaris under it, so I can limit exessive use of system resources

16:06 Chousuke: and we'd have clojure in clojure :P

16:06 ordnungswidrig: are there distributed agents for clojure?

16:07 Chousuke: Licenser: yeah, but you need to restart the JVM still :/

16:07 ordnungswidrig: Licenser: …the wholy grail: cinc

16:07 Chousuke: a clojure interpreter would not be cinc :)

16:07 pjackson: A repl to live seems like a bad idea... doesn't it?

16:07 ordnungswidrig: chouser: i know.

16:07 Chousuke: well, it would be, but I want a compiler ;/

16:07 Licenser: heh I'll go with a mission specific interpreter - sory

16:08 ordnungswidrig: will jvms of recent java versions share memory? I remember some vm options. So that if multiple jvms run the same libs they don't all have a copy of the code in mem?

16:08 jlongster: Is eval in clojure limited to the clojure.core namespace, or can I eval inside a different namespace?

16:09 ordnungswidrig: that was java -Xshare:on

16:09 Chousuke: jlongster: eval happens in whatever namespace you're in

16:10 jlongster: and in whatever environment :P

16:10 can't access locals though.

16:11 jlongster: Hm, for some reason *ns* was clojure.core when I tried, but that must have been something else

16:11 Licenser: then a interpreter it shall be!

16:13 but first some other things

16:27 * aldebrn can now do (+ 1 2 3) with clojurebot and runroot.com

16:44 lpetit: Chousuke: but preventing user code to use the . special form, thus limiting the access of any method/static field of any java class for all users is ... rather restrictive ! How do you make your String uppercase ?

16:45 Chousuke: and also, you'll have to prevent the user from jumping into the clojure.core ns and defining all his functions in there ... :-p

17:41 xster: test 1 2 3

17:41 the-kenny: xster: Test passed

17:41 xster: kewl!

17:42 whendo people get together to talk about clojure?

17:42 JonSmith: right now

17:42 here

17:42 xster: Well, I'm a newbie. But I really like what I've read about clojure

17:43 I come from a C, Java, Smalltalk background

17:43 I've over the years tried to learn Lisp and Scheme, but did not get very far, I'm afarid.

17:43 I'd like to become proficient in clojure though

17:44 Any tips for someone like me?

17:44 JonSmith: i feel the same way

17:44 except i come from lisp and am bad at c and java

17:44 hiredman: you could do some analysis of the logs to discover peak #clojure times

17:45 xster: Well, as a Lisper, i think you're certainly one up on me

17:45 JonSmith: well remember that java libraries are like clojure libraries

17:45 so you can just plug them in pretty much

17:45 xster: @hiredman: interesting. I'm new to IRC as well. how do I read the logs of previous IRC chats?

17:46 ohpauleez: xster: http://clojure-log.n01se.net/

17:46 arj_: any good tips for easy profiling in clojure?

17:47 xster: @ohpauleez: Thanks!

17:47 ohpauleez: xster: totally welcome

17:47 xster: @JonSmith: have you had experience with Genera or Symolics Lisp?

17:48 JonSmith: nope!

17:48 arj_: I'm looking for something like (profile *something)

17:48 JonSmith: just writing application code in old(e) versions of common lisp

17:48 like gold hill lisp 4!

17:49 gravity: arj_: I've heard that using the jvm's profiling flags is good, but I've not done it myself

17:49 arj_: gravity: thanks

17:49 ohpauleez: xster: to answer your question, read these: http://java.ociweb.com/mark/clojure/article.html http://en.wikibooks.org/wiki/Clojure_Programming/By_Example

17:50 and hang out in here for a week or so

17:50 and you'll be up to speed in no time

17:50 JonSmith: and write code

17:50 write lots of code

17:51 ohpauleez: Also it helps to watch the screencasts on clojure.org

17:51 JonSmith: writing > reading

17:51 ohpauleez: agreed

17:52 xster: Thanks guys!. Those are great tips.

17:53 Since I'm used to Smalltalk, I've come to appreciate the value of a good development environment, and the usefulness of using an image. How good are Common Lisp IDEs such as LispWorks or Genera? I'm sure clojure is still too new to have as good a development environment.

17:53 arj_: xster: Emacs

17:53 the-kenny: xster: Clojure has an excellent development environment: Emacs together with Slime :)

17:54 JonSmith: i didn't know you could get genera beyond emulation

17:54 the-kenny: (Slime has it's roots in Common Lisp, but it's expandable)

17:55 xster: emacs? *cough* I was hoping for more Smalltalk tools such as the browser, inspector, and debugger. One can code in the debugger.

17:55 ohpauleez: xster: I think both emacs and vim are great for clojure. Clojure is the first lisp I use vim with

17:55 mebaran151: what's the best way to get the arity of a function object?

17:55 the-kenny: xster: You have a browser, a repl and an inspector in emacs :)

17:55 gravity: O

17:56 ohpauleez: xster: there is a plugin for netbeans, and I think someone may have an eclipse plugin

17:56 gravity: I've not seen the coding inside the debugger thing anywhere but smalltalk

17:56 the-kenny: gravity: You mean something like redefining functions while stepping in the debugger?

17:57 gravity: xster: There is an inspector in the clojure.inspector namespace

17:57 the-kenny: That's possible with Slime in Common Lisp, but sadly not in Clojure

17:57 gravity: the-kenny: Yeah

17:57 Ah, neat

17:57 ohpauleez: mebaran151: no idea, but if you get reflection on it, you may find a field for that sort of thing

17:57 the-kenny: gravity: There's also a really cool inspector in slime :) C-c I

17:58 mebaran151: It's possible if you can get the metadata of the var, like #'+. I don't think there is a way with function-objects

17:58 gravity: the-kenny: Cool! I'll play with that some more later

17:58 the-kenny: (functions don't have metadata in clojure)

17:58 gravity: I really need to dig in to slime. I know I'm barely using it

17:58 mebaran151: seems like there should be a way to reflect that

17:59 I'm trying to figure out a functional way to wrap Netty that doesn't make people cry

17:59 the-kenny: gravity: If you use a frequent version of swank-clojure (1.1.0), you can also do -x swank-list-threads and kill java-threds from there :)

17:59 technomancy: xster: if you're hoping for smalltalk-like support, every language is going to disappoint you.

17:59 the-kenny: Uhm.. M-x ...

17:59 JonSmith: m-x smalltalk-mode?

18:00 gravity: oooooh.... I could use some thread control.

18:00 Too much stuff!

18:00 mebaran151: I wonder if ti was possible to somehow integrate metadata and annotations

18:01 modern Java has moved toward using annotations, which make interoperability with clojure a little bit more problematic

18:01 xster: @technomancy: You may be right.

18:02 technomancy: the-kenny: list-threads is really slick; thanks!

18:02 the-kenny: technomancy: I'm glad I can help :)

18:02 xster: I've head thoughthat genera from Symbolics was the most productive Common Lisp environment around. Don't know if it's true or how well it stacks up against Smalltalk.

18:03 the-kenny: technomancy: I would like to implement more things like the thread-list, but it's kind of hard to find missing features. Any suggestions?

18:04 technomancy: the-kenny: there's a TODO in swank-clojure. =)

18:04 JonSmith: hum, can't find any symbolics machines on ebay

18:04 technomancy: prompting for insertion of :import lines when you try to refer to an unqualified Java class would be a great feature.

18:04 also making M-. work for namespaces

18:05 the-kenny: technomancy: Ah :) Cool, and even in org-mode. I'll take a look.

18:05 xster: @JonSmith: yeah, they're like moon rocks. however genera can be run in an emulated Dec Alpha environment

18:06 arj_: how does a dosync inside another dosync work?

18:06 JonSmith: i think i just found a moon meteorite on ebay though :-P

18:06 arohner_: arj_: the transaction happens at the end of the outermost dosync

18:07 arj_: arohner_: ah, cool. That is perfect for composability

18:07 arohner_: arj_: that's the plan :-)

18:07 arj_: sweet!

18:07 thanks arohner_

18:07 arohner_: np

18:08 the-kenny: technomancy: hm.. looks like slime-list-threads is broken in Emacs 22 too :(

18:21 Licenser: hmm I know there is an easy way to write a function that returns an unique id in clojure but I'm just too stupid to think of it :(

18:22 rhickey: ,(gensym)

18:22 clojurebot: G__5824

18:22 rhickey: ,(gensym)

18:22 clojurebot: G__5828

18:22 rhickey: or use UUIDs

18:22 ohpauleez: rhickey: Update the copyright on the bottom of clojure.org

18:22 Licenser: I

18:22 I

18:22 argh sorry

18:23 rhickey: ohpauleez: done - thanks

18:23 Licenser: I'd mean something like a function that returns 1, 2, 3 ... for every call - I saw an example somewhere

18:23 on the other hand uuid's are just fine too

18:24 rhickey: ,(gensym "")

18:24 clojurebot: 5832

18:24 rhickey: ,(gensym "")

18:24 clojurebot: 5836

18:24 Licenser: rhickey: that is briliant

18:25 ohpauleez: rhickey: np, noticed it today

18:25 the-kenny: A

18:25 Oops

18:26 Licenser: I really enjoy clojure more and more as I use it

18:35 mebaran151: anybody know any good libraries for something akin to binary json to efficiently send some clojure data structures between processes?

18:35 bradford: anyone had class not found issues in emacs/slime with genclassing?

18:36 Knekk: mebaran151: something like Thrift?

18:36 mebaran151: something like Thrift without the whole fixed schema precompiling

18:36 hiredman: someone did a clojure implementation of bert

18:36 mebaran151: I'd like to take a hash map and send it down river

18:36 patrkris: question concerning clojure.contrib.http.agent: how do I specify headers to (http-agent ...) without having to calculate the request length manually?

18:36 hiredman: ~google clojure bert

18:36 clojurebot: First, out of 465 results is:

18:36 mebaran151: bert?

18:36 clojurebot: trotter's bert-clj at master - GitHub

18:36 bradford: I've found that I have to stick requires for all the ns'es that i use before i import the gen'd classes

18:36 clojurebot: http://github.com/trotter/bert-clj

18:37 Knekk: with Thrift you can just send a hashmap, simple schema

18:37 mebaran151: do I have to run a precompilation stage though?

18:37 I'd be happy to use thrift, but I'd prefer not to go through all the code genning

18:38 especially 'cause I have to write an actionscript adapter too, and last I looked thrift and as3 weren't best buddies

18:38 Knekk: dunno then

19:16 konr: Guys, what do I need to do to make swank find swank.clj? I'm getting the 'java.io.FileNotFoundException: Could not locate swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0)' despite having its directory on the swank-clojure-extra-classpath

19:17 the-kenny: konr: I would suggest using leiningen in combination with swank-clojure-project. It's dead-easy and very cool

19:19 konr: the-kenny: hmm, what do I need to set in order to use it? I tried it here and slime was loading sbcl, haha

19:20 the-kenny: konr: Here is the readme for leiningen: http://github.com/technomancy/leiningen/blob/master/README.md After you ran "lein deps", you can just fire a repl in emacs with M-x swank-clojure-project

19:20 All classpaths etc. are set correctly according to the project.

19:22 ieure: +1. I use it, and it rocks.

19:24 Licenser: out of curiosity is a vector faster at sorting then a list?

19:25 konr: even that doesn't work. I guess that I'm having some problem with the versions

19:26 the-kenny: konr: What's the error if you use leiningen?

19:27 Have you added [swank-clojure "1.1.0"] to the list of dev-dependencies? :dev-dependencies [[swank-clojure "1.1.0"]]

19:29 konr: the-kenny: yes, and it was working in another box. The error is the same, and happens after I use swank-clojure-project - 'java.io.FileNotFoundException: Could not locate swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0)'

19:31 the-kenny: the swank-clojure jar in lib/ also seems to be valid

19:31 the-kenny: konr: That's strange

19:45 konr: the-kenny: do you set any variable or configure emacs in some way, besides requiring swank-clojure and clojure, to use swank-clojure-project? I've noticed that I don't get an error without the (clojure-slime-config) line (although in this case it loads the wrong lisp).

19:46 the-kenny: konr: In fact, I don't even require swank-clojure explicitly, as it's managed by elpa.

19:46 konr: And no, I don't set any additional vars.

19:47 konr: I use swank-clojure only in combination with leiningen. I've never bothered with setting additional variables.

19:57 rdsr: Hi all, is there a good way to convert between a java map (e.g. Hashtable) to clojure persistent arraymap

19:58 I ask this because I cannot read values from hashtable the way I can from clojure maps

19:59 like (map key)

19:59 technomancy: (into {} my-hash-table) maybe

19:59 rdsr: oh ok thk technomancy

20:12 poet: what should be used instead of (gen-and-load-class)?

20:12 as that macro was removed

20:13 Chousuke: :gen-class in the ns form

20:14 (doc gen-class)

20:14 clojurebot: "([& options]); When compiling, generates compiled bytecode for a class with the given package-qualified :name (which, as all names in these parameters, can be a string or symbol), and writes the .class file to the *compile-path* directory. When not compiling, does nothing. The gen-class construct contains no implementation, as the implementation will be dynamically sought by the generated class in functions in an impleme

20:14 Chousuke: see that, and also see (doc ns)

20:31 mebaran151: why don't function objects support metadata?

20:33 ctdean_: What's the difference between the elpa version of slime and the one from common-lisp.net ?

20:37 the-kenny: ctdean_: The one from elpa is just slime on the emacs-side. The other side (swank) needs to be installed seperatedly by the dependency-manager of your backend.

20:37 ctdean_: The one from common lisp should bring a bunch of .lisp-files for different common lisp implementations and some contrib modules with it

20:38 ctdean_: the-kenny: it looks like all the slime/contrib stuff is missing too

20:39 the-kenny: Yes, the contrib stuff is missing. But most people only use one or two modules from there (usually repl and fancy) and it's no problem to install them by hand

20:39 (slime-repl is also in elpa)

20:40 Maybe someday more and more of these contrib-stuff will be in elpa when it's integrated in emacs

20:41 ctdean_: I see (I use 6 from contrib myself)

20:41 hiredman: mebaran151: (with-meta a m) evaluates to a new thing, a-prime with the metadate m, doing this with functions is slightly more complicated and some choices have to be made (regarding function identity and equality, closed over values, etc) and rather than make those choices, fn's just don't support metadata for now

20:42 mebaran151: but technically, there could be a with-meta! that just added a hash-map to the field

20:42 ctdean_: There also seems to be enough of a version skew that the latest cvs slime doesn't work with the lein swank server

20:42 technomancy: ctdean_: that's correct, you can't use cvs slime with clojure at all

20:43 ctdean_: This is going to wreak havoc with my CL development

20:43 technomancy: I'd love help bringing the clojure side up to date, but I don't have time to do it myself

20:44 hiredman: mebaran151: fortunately this is not a technical decision, but a design decision

20:44 ctdean: <--- irc client keeps crashing :(

20:44 technomancy: ctdean: I'd love help bringing the clojure side up to date, but I don't have time to do it myself

20:45 mebaran151: it would be nice to have it for Strings to, but I understand why their implementation might be problematic

21:32 poet: is there a way to force a member of a structure to be a certain type?

21:40 chouser: nope

21:44 but that's the kind of thing that deftype can do for you ("new" branch)

21:58 konr: Is there a clojure.contrib cheatsheet?

22:02 djork: How would you like to edit Clojure on your iPhone :)

22:02 without typing much

22:05 aking: djork: I got clojure running on the iphone with jamvm - but it took about 20s to show the repl

22:05 djork: I'd want to run the code remotely

22:05 over HTTP/S

22:05 or whatever transport

22:05 aking: ohh.. that's different then

22:06 djork: but I am interested in building an S-expression editor

22:06 mebaran151: djork, I'm also considering building a clojure editor in clojure

22:07 djork: that would be fun

22:07 mebaran151: I'm thinking of layering it on top of neo4j actually

22:07 djork: a Dr Scheme for Clojure

22:07 aking: I saw someone writing an emacs like editor in javascript - you could probably use that as a base

22:07 mebaran151: and connecting depending fn's as nodes

22:07 at the end I'd just output all the files in whatever configuration you wanted

22:08 so ns reorganization would be fast

22:09 djork: neo4j... not familiar

22:09 ah, graph database

22:09 mebaran151: i've always thought it would be cool if one could cherrypick fn's from projects, if we weren't bound to libraries as they existed but only as they relied on other fn's

22:09 djork: cool

22:09 mebaran151: yeah it's a graph db

22:09 chouser: djork: I want

22:10 mebaran151: yeah I think it would be cool too

22:10 djork: working on it as we speak

22:10 mebaran151: you might be able to use some of the code I'm writing now, connecting netty to evaluate s expressions

22:11 I wish I had an iPhone :(

22:11 djork: no you don't

22:11 AT&T sucks and it's expensive :)

22:11 mebaran151: I have ATT

22:11 djork: If I wasn't working for an iPhone shop I wouldn't have one

22:11 mebaran151: but no iPhone

22:11 chouser: so expensive. I wouldn't have one if I had to pay for it.

22:11 djork: I DO have to pay for it

22:11 mebaran151: I got a Blackberry Bold, which is actually a neat little device

22:11 djork: that's the shitty part

22:11 mebaran151: I haven't gotten a chance to whack clojure on it

22:11 djork: yeah those aren't bad at all

22:12 mebaran151: I like it for typing

22:12 I'd actually love to have a dev environment for it

22:12 somnium: djork: have you seen ymacs?

22:12 chouser: I don't like typing on the iphone, though I guess it's slight better than graffiti

22:12 mebaran151: I didn't mind graffiti

22:13 could Clojure run on an BlackBerry Bold

22:13 it's got a beefy little processor, and I think everything RIM does is Java Tastic

22:13 chouser: no, not terrible. typing on the iphone is better though

22:13 djork: chouser: as little typing as possible would be the goal

22:13 lists of fns

22:13 mebaran151: djork, that would be generally useful for all mobile phones

22:13 chouser: right. auto-completing keywords. oh, sure, lists

22:13 djork: yes

22:14 writing code and other things like SSH clients suck horrendously on mobile devies

22:14 devices

22:14 hiredman: mebaran151: bb's still only have j2me

22:14 mebaran151: j2me can't run Clojure?

22:14 hiredman: j2me is a complete waste

22:14 nope

22:14 mebaran151: I thought j2me was j2se without swing and stuff

22:14 hiredman: nope

22:14 mebaran151: oh

22:14 I know nothing of phone dev land

22:14 hiredman: j2me is like java 1.3 or 1.4

22:15 mebaran151: I just thought it would be cool to hack clojure on my blackberry

22:15 and clojure probably needs 1.5 for generic support

22:15 hiredman: it would, if someone would release a phone that actually ran java

22:15 mebaran151: nope

22:15 mebaran151: nope?

22:15 hiredman: it needs 1.5 for the Collections api mostly

22:15 clojure doesn't care about generics

22:15 mebaran151: I thought the collections api was from way back when

22:16 which is why it was so badly designed

22:16 hiredman: thats possible

22:18 mebaran151: I thought Dalvik was basically j2me but with different bytecode and reinvented by google

22:18 hiredman: it's more like standard java with a different bytecode

22:19 djork: dalvik, yech

22:19 hiredman: (the developement environments for j2me are hellish as well)

22:19 djork: the dalvik compilation step can get nasty if you have bad 3rd-party jars

22:20 hiredman: palm's phones apparently come with apache's jre

22:20 harmony

22:22 djork: that's pretty good

22:22 better than most

22:22 but basically, whenever I see the Java logo come up on a phone I know I am going to be waiting a while

22:22 and not just at startup

22:22 every button press, and even shutdown, is painful

22:33 mebaran151: sigh

22:33 I wonder if Clojure in Clojure could actually help the mobile phone scene

22:34 though concurrency isn't a huge issue for phones yet

22:35 KirinDave2: mebaran151: Distribution is, tho.

22:35 mebaran151: oh yeah, I couldn't even tell you how to load a program on my blackberry

22:36 I think Adobe AIR actually might help this a great deal if they get the whole Open Mobile thing to work out

22:36 Adobe products always make deployment trivially easy

22:52 alexyk: chouser: ping

22:53 chouser: hiredman:

22:53 er

22:53 hi

22:53 :-)

22:54 alexyk: so I'm using your sorted-seq-merge from yesterday, which was toy-tested for int seqs and uses (< x y). But the real data is java.util.Date, which is compared with: (< (.compareTo (first a) (first b)) 0)

22:54 unless there's a prettier way equivalent to <

22:54 how do we parameterize sorted-seq-merge with the sorting predicate, defaulting to < ?

22:55 chouser: hmmm

22:57 alexyk: kind of tests the whole dynamic typing :)

22:57 i.e., the literal (< x y) -- works only for numbers?

22:59 chouser: yes, apparently for performance reasons

23:00 all fns implement .compare -- I'm trying to think if that would be useful.

23:00 alexyk: the question is, do I really have to specialize per type, e.g. sorted-date-seq-merge, or there's an efficient way to parameterize

23:00 simplest case is numbers and strings

23:02 chouser: I guess it'd be reasonable to accept 2 or 3 args, [comparator a b]

23:05 use (.compare comparator (first a) (first b)), comparator can default to <

23:05 alexyk: chouser: would it be as efficient as hard-coded < for numbers? And how do I syntactically write the default to < ?

23:07 chouser: < is faster for unboxed numbers, but these will all be boxed.

23:07 ...so I dunno. It seems plausible to me that hotspot could make it about as fast. I guess you'd have to test it.

23:09 alexyk: chouser: the minor question remains, how to do default. Check if comparator is given in an (if ...)?

23:09 (if comparator (.compare ...) (< ...))?

23:09 chouser: no, < implements .compre

23:10 as do all two-arg clojure fns :-)

23:10 alexyk: ok; so how'd I give < as a parameter?

23:17 lisppaste8: Chouser annotated #93006 "three-arg sorted-seq-merge" at http://paste.lisp.org/display/93006#1

23:29 chouser: ha! don't use that version

23:30 my recursive calls weren't including the new arg

23:35 GeekyCoder: :)

23:38 lisppaste8: Chouser annotated #93006 "fixed it" at http://paste.lisp.org/display/93006#2

23:39 chouser: alexyk: there you go. Could use a type hint on 'c' if you care about performance

23:40 could also try to build a chunked seq instead of one-at-a-time. Dunno how well that would go.

23:40 off to bed.

23:43 alexyk: thanks much!

23:44 gonna try

Logging service provided by n01se.net