#clojure log - Jul 25 2009

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

1:13 codyK: hahaha

1:13 got some more time to work on that circular reference issue

1:13 was actually a problem of binding / lazy map

1:13 hiredman: that'll do it

1:14 codyK: so seriously, do people just avoid using binding at all cost?

1:15 hiredman: nope

1:15 but it is a common gotcha

1:15 there has been some talk and proposals of various solutions

1:16 I never paid too much attention

1:17 mostly you just need to capture the dynamic environment (binding) in the static environment (a let)

1:17 (binding [a 1] (let [a a] (map #(+ % a) (range 10))))

1:24 codyK: that doesnt seem to be sufficient

1:24 lisppaste8: codyK pasted "binding / laziness" at http://paste.lisp.org/display/84162

1:25 codyK: ::js method will succeed, ::html method will fail

1:25 (where fail == recurse indefinitely)

1:26 forcing the map in the ::html method, works fine

1:26 or does interpose force . . .

1:33 iBong: simple question, trying to iterate over a an array from a java object, doseq gives (... doseq requires a vector binding)

1:34 Lau_of_DK: Is that a question?

1:34 iBong: No, not technically I suppose

1:35 how to iterate across a java array in clojure? (I'm out of my depth, trying to get my feet wet converting a java csv processing program to clojure)

1:36 Lau_of_DK: I believe doseq will get you where you need to go, depending a little on the purpose

1:36 (its not lazy and primarily used for side-effects I believe)

1:37 iBong: something like (doseq java-array function)? from the error I surmised that either I was doing something very stupid syntactically or java-array's don't qualify as vectors

1:37 arbscht: iBong: that error suggests that your binding form is malformed. a syntax error perhaps?

1:37 iBong: probably

1:38 arbscht: (doseq [x (into-array [1 2 3])] (println x))

1:38 Lau_of_DK: or (doseq [item (make-array String 20)] (println item))

1:41 iBong: ah! I was indeed doing something very stupid (x was not inside brackets) thank you

1:44 Lau_of_DK: You'll get used to it quickly :)

1:45 iBong: hope so, clojure is very cool, all my ruby code is .map .inject lambda x now, want to start using it seriously as soon as I can grok it

1:50 another question, say I have 20 csv files I want to process with some function. Is it simple to fire up 20 threads?

1:51 hiredman: I doubt you want 20 threads

1:52 iBong: an optimal number then?

1:52 hiredman: maybe 20 tasks executed on four or five threads

1:52 agents

1:53 iBong: will rtfm, thanks

1:55 hiredman: ,(map #(send-off %2 + %1) (range 10) (cycle (take 4 #(repeatedly (agent 0))))

1:55 clojurebot: EOF while reading

1:55 hiredman: bah

1:55 ,(map #(send-off %2 + %1) (range 10) (cycle (take 4 #(repeatedly (agent 0)))))

1:55 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: sandbox$eval__3974$fn__3979

1:55 hiredman: :/

1:55 iBong: lol

1:55 Lau_of_DK: # too much

1:55 iBong: too bad emacs isn't lisp-aware in erc mode

1:56 that's quite dense, will have to thoroughly google agents

1:56 Lau_of_DK: iBong: You can make it that I think :)

1:56 hiredman: ,(map #(send-off %2 + %1) (range 10) (cycle (take 4 (repeatedly #(agent 0)))))

1:56 clojurebot: (#<Agent@151a9d4: 4> #<Agent@64cc22: 6> #<Agent@195f463: 2> #<Agent@1dfae24: 3> #<Agent@151a9d4: 4> #<Agent@64cc22: 6> #<Agent@195f463: 2> #<Agent@1dfae24: 3> #<Agent@151a9d4: 4> #<Agent@64cc22: 6>)

1:56 Lau_of_DK: iBong: hiredman is making it very complicated

1:56 iBong: Im dutr domronr hsd

1:56 Im sure someone has

1:56 Lau_of_DK: Its actually really easy

1:56 hiredman: what!?

1:57 I am not

1:57 Lau_of_DK: (defn foo [a] (map parse-csv-file (get-list-of-csv-files)))

1:57 hiredman: ,(pmap #(send-off %2 + %1) (range 10) (cycle (take 4 (repeatedly #(agent 0)))))

1:57 Lau_of_DK: (send-off (agent 0) foo)

1:57 clojurebot: (#<Agent@1827697: 12> #<Agent@37eaa5: 6> #<Agent@10e1899: 8> #<Agent@7118a4: 10> #<Agent@1827697: 12> #<Agent@37eaa5: 6> #<Agent@10e1899: 8> #<Agent@7118a4: 10> #<Agent@1827697: 12> #<Agent@37eaa5: 6>)

1:57 Lau_of_DK: Thanks for spamming

1:57 hiredman: Lau_of_DK: that won't spread the work out over multiple agents

1:58 Lau_of_DK: No, but I dont think showing him send-off, cycle, repeatedly and agent will make it very clear to him what youre doing, so I opted to show send-off :)

1:59 hiredman: you would take my example, and replace (range 10) with a list of csv files and + with the csv processing function

1:59 and capture the resulting sequence in a name somehow, most likely let, apply await, then reduce the results

2:00 perfectly cromulent

2:00 Lau_of_DK: haha - I dont even know what cromulent mean, but I'll go look it up Mr. Scholar

2:00 piyo`: leveraging cromulent synergy

2:00 hiredman: it's a made up word, but I am sure some dictionary has it

2:01 of course, wikictionary does

2:01 http://en.wiktionary.org/wiki/cromulent

2:01 arbscht: embiggening one's vocabulary :)

2:02 Lau_of_DK: haha

2:03 If you dont, communication with hiredman will be absolutely unpossible

2:03 Fossi: hi

2:03 iBong: I sheepishly admit I was only able to make sense of Lau's example

2:03 copied and pasted the above for reference

2:05 Lau_of_DK: Great :D

2:05 Fossi: hiredman: the definition of cromulent is pretty broad though

2:05 hiredman: iBong: first (agent 0) creates and agent holding the value 0, #(agent 0) creates an anonymous function that returns a new agent holding the value 0 everytime it is invoked

2:06 repeatedly takes a function and creates a infinite lazy sequence of the result of invoking the function over and over again

2:07 so (repeatedly #(agent 0)) creates an infinte sequence of agents holding 0

2:07 Lau_of_DK: ~clojureql

2:07 clojurebot: clojureql is a quite impressive piece of work

2:07 Lau_of_DK: ~clojureql

2:07 clojurebot: clojureql is http://github.com/Lau-of-DK/clojureql/tree/master

2:07 Lau_of_DK: Right on both accounts

2:08 hiredman: take of course takes the first n of a sequence

2:09 so (take 4 (repeatedly #(agent 0))) gives you a lazy-seq of four agents holding 0

2:09 ,(pl (λx.x 1))

2:09 clojurebot: 1

2:11 iBong: *iBong senses the fog thinning slightly

2:12 hiredman: cycle repeats the same four agents over and over

2:12 iBong: I'll try to plug it in to the program and see if its faster ;)

2:12 hopefully learn something along the way

2:12 hiredman: I wonder if you might as well just do a reduce of a pmap

2:12 Lau_of_DK: iBong: Generally I'd say, build working code first, if its too slow, then optimize

2:13 iBong: yeah, I could just grab the biggest function on the java class, but that would be cheating

2:14 Lau_of_DK: What I meant is, usually Clojure code runs quite fast without paying special attention to optimizing, so dont get ahead of yourself - This advice I got from Chouser has saved me lots of time in the past

2:15 iBong: 20 files, 20 sheets per file, many agents for sheets in file? agents for files?

2:15 good advice indeed

2:15 and QL looks very cool

2:15 cloned it for safe keeping

2:16 hiredman: there is overhead for managing threads and some for the agent system, so the work load has to be not insignificant for there to be a performance boost

2:17 iBong: it takes about 5 minutes now, so its not THAT slow, but a speed increase would noticeable, and the logic is quite simple so it seemed like a good learning experiment

2:18 Lau_of_DK: How large are the files in terms of mb ?

2:18 iBong: between 5 and 15 on avg

2:18 not taking every sheet, though its on the horizon

2:19 Lau_of_DK: Ok - Then I'd probably dispatch threads, if its something you have to sit and look at

2:19 iBong: excel files produced by an accounting organization that really should have gotten a database a long time ago

2:20 hiredman: man, I wish scopes would land

2:20 Lau_of_DK: Why?

2:20 hiredman: so useful for resource management

2:23 Lau_of_DK: I never looked at it, what would be the typical use case?

2:31 @ hiredman

2:33 Fossi: time for clojure and android

2:33 Lau_of_DK: Which reminds me, anyone got Clojure going on the iphone?

2:34 Fossi: hmmm. why should that be problematic? bad jvm implementation?

2:34 JAS415: how would i translate this to clojure: java.awt.Image image = java.awt.Toolkit.getDefaultToolkit().getDefaultToolkit().createImage(url);

2:34 ??

2:35 tried a bunch of things but nothing seemed to work properly

2:35 seems to die on the .getDefaultToolkit thing

2:35 Lau_of_DK: (Image. (.. (getDefaultToolkit) (getDefaultToolkit) (createImage url)) I think

2:36 if you import java.awt.Toolkit

2:36 JAS415: hmm

2:36 okay

2:37 Fossi: without the Image.

2:37 or well

2:37 most likely you dont want it

2:37 JAS415: hmm

2:38 seems to get confused on getDefaultToolkit stil

2:38 i had assumed i'd need the class

2:38 Fossi: at least i guess createImage already returns an Image

2:38 JAS415: ahhh

2:38 there we go

2:38 okay

2:38 it is

2:39 (.. java.awt.Toolkit (getDefaultToolkit) (createImage url))

2:39 slashus2: JAS415: (.. (java.awt.Toolkit/getDefaultToolkit) (createImage url))

2:39 Or that

2:39 JAS415: seems like the second getDefaultToolkit was unnecessary

2:39 :-)

2:39 oh ok

2:39 so you can qualify them with /'s

2:39 that will be useful too

2:40 Fossi: "/ is for static stuff

2:41 hiredman: Lau_of_DK: instead of using with-open everywhere, functions can register a function to be run when a scope is exited

2:42 so (reader …) which returns a Reader could register a function to close the reader it produces

2:42 once you leave the (scope …)

2:42 and it throws an exception if not called within a scope

2:42 Lau_of_DK: JAS415: (Image. (.createImage (java.awt.Toolkit/getDefaultToolkit) url)) How about that?

2:43 Oh ok, thanks hiredman

2:43 hiredman: ~scopes

2:43 clojurebot: Pardon?

2:43 hiredman: ~scope

2:43 clojurebot: scope is at http://paste.lisp.org/display/73838

2:45 Lau_of_DK: In that example, what is the 'scope' ? I'm confused that a string in the REPL triggers something, I had expected a reference to foo

2:45 Chouser: huh. When I push a patch authored by X that includes "Fixes #Y", assembla reports that X closed ticket Y.

2:45 hiredman: Chouser: cute

2:45 Lau_of_DK: the string in the repl doesn't trigger something

2:46 Lau_of_DK: Git - Keeping you humble

2:46 Chouser: I mean, I guess that's right, but it's weird to see a change timestamped now when they're not even logged in.

2:47 hiredman: (when-scope :fails (prn "failed")) registers the action (prn "failed") to be performed if the scope fails to exit cleanly (uncaught exception, etc)

2:48 the "exited" and "failed" just print'ed oddly

2:48 Chouser: where "the scope" is the outermost (scope ...) in the current dynamic context

2:48 hiredman: ~horizon

2:48 clojurebot: horizons is http://gist.github.com/51721

2:48 Chouser: hm, was there talk of named or directed scopes, rather than all bubbling to the highest?

2:48 hiredman: yeah

2:49 Lau_of_DK: Ah ok

2:49 What are you doing up Chouser?

2:49 Chouser: Tomorrow's my turn to sleep in, so I'm taking advantage of it.

2:50 Lau_of_DK: Ah I see

2:50 Chouser: but I've pretty much used up my time now...

2:50 Lau_of_DK: But did you get much done?

2:52 Chouser: not too bad. tested image-grid [OT] and cranked through 5 tickets

2:53 hm.. I think that's an average of about 30 minutes per ticket. not so hot...

2:53 Lau_of_DK: I wouldnt know, were they complex?

2:54 Chouser: eh, not really.

2:55 I mean, I'm not creating patches or anything, just double-checking the patch and doing "paperwork".

2:55 anyway, bedtime. Y'all have fun, now.

2:55 Lau_of_DK: Thats geat

2:55 great

2:55 Al'right, good night

3:02 Fossi: people are so cool. a repl on the android. <3

3:02 time for breakfast first though :D

5:52 Jetien: Hello! I often like to write functions that don't care if the argument is a collection containing one element or just one element. Is there an elegant way to do this in clojure?

5:53 i like to be a ble to write (f x) instead of (f (list x))

5:59 Chousuke: Jetien: I think you'll need an if in the function

6:00 Jetien: okay

6:00 thanks! :)

6:24 alinp: hi

6:24 I have a folder with some subfolders and some files (clj files)

6:24 how can I include all of these in the classpath ?

6:25 I tried -cp "${MY_FOLDER}/*"

6:25 but when doing the (require 'folder.examples) it doesn't work

6:25 doesn't find the folder/examples.clj file

6:25 although it exists there

6:32 rottcodd: if you use -cp dir then it will look in dir/folder/examples.clj

6:33 StartsWithK: try -cp ${MY_FOLDER}/sub1:${MY_FOLDER}/sub2 .. i assume subs have proper structure used by http://clojure.org/libs

6:38 docs for remove-ns say: Removes the namespace named by the symbol. Use with caution.

6:38 what problems could i create if i remove a namespace?

6:46 alinp: thanks guys

8:33 Fossi: Is Remco van 't Veer coming here?

9:11 yay. got clojure to run on the android emulator. time for fun

11:12 krumholt_: hiredman, that (pl ..) is that in clojure-contrib?

11:25 rhickey: lisppaste8: url

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

11:26 rhickey pasted "newnew syntax" at http://paste.lisp.org/display/84174

11:26 rhickey: :as might be :this

11:27 but the key is :volatile, allows keeping closure model, just a declaration affecting mutability in this scope, doesn't add new notion of 'field'

11:31 * rhickey git co -b new master

11:54 StartsWithK: rhickey: will you leave proxy and related functions?

12:04 dbaser: _

12:11 rhickey: StartsWithK: yes

12:11 but you won't generally want to use proxy once new new exists

12:51 Fossi: rhickey: i like how you kinda push/trash concurrency in practice at the same time in the concurrency speech :D

12:52 rhickey: Fossi: I don't think I trash it - I think it's very good and recommend it. I think doing the things it recommends is very hard work and easy to get wrong.

12:53 Fossi: yeah, i totally feel the same way

12:54 and i guess prolly every person who read it

13:25 angerman: how would i wrap a few functions into an (if body

13:25 rhickey: angerman: they likely have side effects, so (do ...)

13:26 clojurebot: They found no relationship between a programmer’s amount of experience and code quality or productivity.

13:27 angerman: rhickey: thanks. I thought about the (do but wasn't sure if it was the way to go.. :)

13:27 I tried just wrapping the consecutive calls into ()

13:28 yes. What I wanted was stmt; expr

13:53 krumholt: hi i am trying agents and i send a function to an agent which will send itself to the same agent. how can i make this agent stop?

13:55 mebaran151: is there anything like a lazy conjoin?

13:55 I'd like to add an element to aset but not realize it until its done?

13:55 *until the collection is evaluated

14:14 nvm the delay macro has me covered

15:03 angerman: ... egal is nota function i can relate to.

15:14 can someone help me on my macro: http://gist.github.com/154862

15:17 Fossi: programming with java ui frameworks is kinda weird in clojure

15:23 angerman: Fossi: I think with a few macros (though I'm not good at macros yet) it's quite plesant compared to writing pure java

15:23 Fossi: i love it. but currently i try to write a android app and all this state is giving me headaches ;)

15:28 so far it's nice that state is so explicit in clojure (compared to scala, groovy, jython)

15:29 but the 'interfaces' between stateful java code and mine is always tricky to get right somehow

15:30 if only for the mass of code wrapped in do that you have to write

15:30 * angerman likes the ClojureQL way of querying.

15:30 angerman: I'm just to stupid to get it right now.

15:32 Fossi: well, look at the source?

15:32 but i guess clojureql uses a pretty deep stack of macros

15:32 angerman: Fossi: I am ... :(

15:34 Fossi: it would be nice if there was a tool/program that would clean up imports

15:34 the only thing i miss about eclipse really

15:43 hiredman: krumholt_: nope

16:16 Anniepoo: hmm... lookinf for some foomap that does (foo #(+ %1 %2) '(1 2 3) '(10 20 30)) => (11 22 33)

16:16 rhickey: ,(map + [1 2 3] [10 20 30])

16:16 clojurebot: (11 22 33)

16:19 Fossi: ,(map #(+ %1 %2) '(1 2 3) '(10 20 30))

16:19 clojurebot: (11 22 33)

16:20 Fossi: just checking my sanity... ;)

16:20 Anniepoo: ah, nice

16:20 thanks!

16:20 Fossi: do you put your source dirs into the 'swank-clojure-extra-classpaths' in emacs?

16:21 there prolly has to be a smarter way of making it find the classes it needs for :use

16:21 rhickey: there's no need for #(+ %1 %2), just map +

16:22 Fossi: sorry, i should've tested locally

16:22 Anniepoo: yah, I see

16:22 that's one more insanely useful thing about Clojure

16:22 Fossi: rhickey: you still code in other languages for work?

16:22 clojurebot: for is not a loop

16:23 Fossi: clojurebot: for me, it is, sometimes

16:23 clojurebot: for is not used often enough.

16:23 Fossi: clojurebot: for that, i agree

16:23 clojurebot: for is a loop...in Java

16:26 Fossi: if i want to instantiate a gen-class from another gen-class, do i :use or import it?

16:27 Anniepoo: this is getting messy.

16:29 I have a structure, a 'widget' that has a set of children and a set of slaves.

16:30 I'm making each widget a structmap with a couple keys, :children, a vector of children, and

16:30 :slaves, a vector of slaves

16:31 now I need to traverse through this struct applying all sorts of changes to masters and slaves

16:31 and it's messy

16:33 Fossi: no, it's beautiful :)

16:33 Anniepoo: LOL

16:33 well, I could use less beauty and more functionality at the moment

16:34 Fossi: naturally depending on whether you find a good abstraction of your problem and a nifty way to handle it ;)

16:34 rhickey: Anniepoo: you know about get-in, update-in, assoc-in?

16:34 Anniepoo: no, I don't

16:34 rhickey: ,(doc get-in)

16:34 clojurebot: "([m ks]); returns the value in a nested associative structure, where ks is a sequence of keys"

16:34 Anniepoo: hitting doc now

16:34 Fossi: nested stuff still grows on me as well. takes a good while to grasp

16:35 Anniepoo: ah! This is perfect!

16:35 Fossi: as a collegue of mine said: even if your operation takes 24 lines of comments for each line of code, it will still be half of what you would've written in java :)

16:37 Anniepoo: it's striking - I actually started this project in Java. I felt my Clojure knowledge was too weak.

16:37 I realized I'd never get it done in time, and switched to Clojure

16:38 even given the extra time for my noobishness in Clojure my productivity is much higher

16:39 actually, get-in won't work here

16:39 because I have a vector of each thing I need to map over

16:40 like the 2nd slave of the 3rd son of the 2nd slave of the 3rd prince of king kickipoo

16:49 (get-in {:foo [{:mep "yup"} {:mep "no way"}] :bar "nope"} [:foo 0 :mep])

16:50 wow, that's insanely neat

16:50 MarkVolkmann: I've been studying the Clojure STM implementation because I want to understand it better and be able to explain it to others.

16:51 I have focused primarily on LockingTransaction.java and Ref.java.

16:51 I have a question about Refs and being "bound".

16:51 I can't see in the code how it is possible for a Ref to be unbound. That means that its tvals field is null. I don't see how that can happen.

16:53 rhickey: MarkVolkmann: there was once a no-arg ctor and there may be again

16:53 MarkVolkmann: Ah ... that makes sense. Thanks!

17:04 Fossi: hmmm. i guess i should've started with the domain stuff instead of poking around android and opengles all evening

17:07 MarkVolkmann: I'm looking at how a ref gets "faults" in the doGet method of LockingTransaction.

17:08 Since every Ref always has at least one TVal and the initial one has a "point" of zero, it seems that the line "ref.faults.incrementAndGet()" at the bottom of the doGet method will never execute. Is that correct?

17:09 IOW, some TVal for each Ref will always precede the read point.

17:11 Anniepoo: beyond terseness is there some advantage to (swap! foo myfunc) over (reset! foo (myfunc @foo)) ??

17:17 hiredman: reset! there is a race condition

17:17 Anniepoo: ah, thanks

17:17 hiredman: well, potential

17:18 Anniepoo: reset! isn't a transaction

17:18 hiredman: so?

17:18 Lau_of_DK: Did anybody get some sweet UI's going with Java FX ?

17:18 Anniepoo: I'm restating what you said

17:18 hiredman: that is not what I said

17:19 you are presumably trying to set foo's value to some new value dependent on the old value

17:19 rhickey: MarkVolkmann: no, another transaction could have changed the ref subsequent to this transaction starting, and there isn't enough history

17:19 Anniepoo: yes

17:19 hiredman: like using inc

17:19 Anniepoo: sure

17:19 hiredman: so (myfunc @foo) executes and you get a new value for foo

17:20 and then the new value is written to foo

17:20 but in that time, foo's value could have changed

17:20 Anniepoo: ok, that's what I meant

17:20 hiredman: ok, you are correct

17:20 Anniepoo: swap! is ACI - not D

17:21 thanks

17:24 Fossi: hmmm. not being connected through the repl to the phone is only half as productive

17:26 i still don't get how :state works

17:27 hiredman: for gen-class?

17:27 Fossi: yeah

17:27 hiredman: it lates you create a place to store state

17:27 Fossi: the book is having a nice example, but that so doesn't fit my rl code

17:28 yeah, and i can (swap! (.state this) (dosomething))

17:28 but then, the state does not seem to be changed

17:29 at least i get a nullpointer trying to access what i put in there in the next called method

17:30 hiredman: do you have an :init function?

17:32 Fossi: yes, as such: [[] {}]

17:32 ups

17:32 yes, as such: [[] (atom {})] of course

17:32 hiredman: oh

17:33 dosomething returns a keyword or a symbol?

17:33 Fossi: (swap! (.state this) conj {:view view})

17:34 (log-info (:view ( .state this)))

17:34 NPE

17:34 in another method that is

17:34 hiredman: uh

17:34 Fossi: do i have to dereference it?

17:34 hiredman: of course

17:35 ,(conj {} {:view 'view})

17:35 clojurebot: {:view view}

17:35 hiredman: seems like you could just use assoc

17:35 ,(:view (atom {:view 1}))

17:35 clojurebot: nil

17:36 Fossi: i could, but i'll prolly add a few more fields later

17:36 hiredman: ,(:view @(atom {:view 1}))

17:36 clojurebot: 1

17:36 hiredman: ,(assoc {} :view 'view :bar 'bar)

17:36 clojurebot: {:bar bar, :view view}

17:36 Fossi: not being able to test this without deploying to the emulator really sucks :\

17:37 i guess making a proxied clojure api wouldn't be too hard

17:38 ok, that helped. next problem ;)

17:44 lbj: No takers on the JavaFX question?

17:47 Anniepoo: the answer for me is no

17:48 but it sounds itneresting

17:48 are you doing it?

17:48 lbj: So for GUI's we've got Swing, a cut-short Qt implementation and Awt ?

17:48 Anniepoo: SWT

17:48 lbj: Anniepoo: If the answer to the above question is no, then I might

17:49 Anniepoo: I know that in general there's a feeling you shouldn't need to wrap libs

17:50 lbj: I think it was AWizzard who had encountered some un-beatable obstacle in regards to FX

17:50 Anniepoo: yah, there's a fundamental problem with Clojure on android

17:51 lbj: I wasn't thinking android though, just for regular desktop apps

17:51 Anniepoo: the sandbox won't let dynamic compile happen

17:51 lbj: Swing always seems laggy somehow

17:51 hiredman: the prefered gui kit in #java seems be swing, surprisingly enough

17:51 Anniepoo: I don't think it's the sandbox

17:51 Anniepoo: it's the bytecode verifier

17:51 * Raynes uses Swing, because he doesn't know if he would be able to figure out how to use anything else in Clojure.

17:52 hiredman: the asm library clojure uses emits jvm bytecode, but android runs on some other virtual machine

17:52 Anniepoo: this per George from the baclojure group - his day job is in Android - and a question he asked rhickey when he spoke at the not=-Javaone thing

17:53 ok, believe hiredman, not me

17:53 I could be misunderstanding

17:53 hiredman: *shrug*

17:54 I can imagine the dalvik byte code verifier would choke on jvm byte code :P

17:59 Fossi: clojure works on android though

17:59 hiredman: but not eval

17:59 Fossi: it's only really slow for dynamic stuff

17:59 hiredman: oh

18:00 Fossi: and slow for reflection and functional programming as is

18:00 somebody used the dalvik compiler to compile the bytecode realtime

18:00 by converting it with itself to run on the phone

18:00 hiredman: yeah, so what happens is the jvm byte code is written to a file, then the translation tool is run, which turns jvm byte code into dalvik byte code then it loads the dalvik byte code

18:01 Fossi: which is slow in the first place

18:01 but still, it *works* ;)

18:02 hiredman: I don't think there is a "dalvik compiler" just a tool that transforms the bytecode

18:02 Fossi: yeah, well, same thing really pretty much

18:02 hiredman: altering the eclipse java compiler to emit dalvik byte code might be interesting

18:02 Fossi: still wwouldn't solve the clojure problem though

18:02 hiredman: since ejc is written in java

18:03 Fossi: somebody spotted an asm version on the phone as well

18:03 would be much more promising :)

18:04 then again, i don't care too much about eval and such. i'm glad i can write my 'static' bytecode in clojure

18:06 hiredman: http://stackoverflow.com/questions/935103/how-do-i-execute-dalvik-op-codes

18:06 answer is "You cannot"

18:21 Fossi: porting java to clojure is more annoying than i thought

18:22 but finally, it's 'running'. a black opengl screen :)

18:24 lbj: Fossi, had a look at JMonkey ?

18:26 Fossi: i searched around, but didn't find any engine that had explicit android support

18:26 lbj: Argh, forgot about the Android angle :)

18:26 Hit me back when you find a way to execute on the iphone

18:27 Fossi: :)

18:27 i guess somebody will prolly do dual boot android at some point

18:27 lbj: Probably

18:28 Fossi: and i guess you could use clojure on jailbreaked iphones with some shitty jvm and no hardware support

18:28 but that's not so interesting/useful :)

18:28 i guess since i want to do more gl and clojure i'll just roll my own

18:29 my first project does not have big requirements anyway

18:29 2d with a little isometric should be sufficient

18:29 and maybe some candy effects. maybe a particle system or two

18:29 lbj: Have fun, paste link to Github when done :)

18:30 Fossi: will do :)

18:31 lbj: Good night all

18:31 Fossi: n8

19:43 mebaran151: java.util.Timer doesn't seem to like my proxy object: how do I directly subclass

19:46 hiredman: mebaran151: you're proxy'ing TimerTask?

19:46 I think the best advice for Timer is to use a ScheduledThreadpoolExecutor instead

19:48 rhickey: ,(.schedule (java.util.Timer.) (proxy [java.util.TimerTask] [] (run [] (prn "Hello World"))) (long 500))

19:48 clojurebot: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)

19:48 hiredman: :P

19:48 but back when I used Timer proxy just worked

19:49 mebaran151: hiredman, I was trying

19:49 rhickey: what I posted up should work

19:49 does it?

19:49 mebaran151: the timer class doesn't seem to recognize that method

19:50 says it can't find a matching method schedule

19:50 hiredman: http://github.com/hiredman/clojurebot/blob/52a02ce8dae22034444fa42e6c2f8f4bb9b986b0/hiredman/schedule.clj is a bit of a wrper around scheduled threadpoolexec

19:50 rhickey: exactly what I posted?

19:50 hiredman: mebaran151: pastbin

19:50 lisppaste8: url?

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

19:50 mebaran151: rhickey, I'm testing yours now

19:52 I think it pasted

19:53 lisppaste8: mebaran151 pasted "TimerTask?" at http://paste.lisp.org/display/84193

19:53 hiredman: yeah, you are missing the (long …)

19:54 mebaran151: oh it won't make the cast for me

19:54 I see

19:54 but isn't current time already long

19:54 oh, but I'm used period there, nvm

19:55 thanks all

19:55 I would have thought that the JVM would be smart enough to make lossless casts for me

20:09 fsm: Image quality getting better: http://tu.be/graphics/8ball.jpg

22:26 liron_: question.. why do we have to call (shutdown-agents) in order to terminate a script that uses agents?

22:45 Raynes: Oh noes! A lispers worst nightmare... Mismatched parentheses!

23:07 mebaran151: setting java -Xmx should set the largest maximum memory a java app can use right?

Logging service provided by n01se.net