an abstraction for accessing stored data
hi clojure-community, today i found this interesting blog-post about an abstraction for accessing stored data: http://anvil.io/2010/10/25/clojurize-the-data-not-the-database.html i searched the list if this was already discussed, but that seams not to be the case. would someone disagree, if i say, that such an abstraction could be important as the seq ? especially interesting perhaps, how the transaction-aspect is solved. have a successful time -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why isn't there a fold-right?
On Nov 5, 2010, at 9:03 PM, Yang Dong wrote: > Maybe because Clojure has a vector, and conj conjoins new elements to > the end of the vector, so there's mere little use of fold-right. But, > fold-right is an abstraction tool, missing it in the core is kind of > pity. What's wrong with just using reverse? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why isn't there a fold-right?
2010/11/7 Alan : > Clojure's reduce is fold-left, not fold-right. My suspicion is that > fold-right is not as amenable to laziness or to tail-call recursion as > fold-right, but I don't have much experience in the area so I could be > wrong. > > What I'm surprised we're missing is unfold, not foldr: unfold is easy > to define lazily, and foldr can often be replaced with foldl. There's iterate, which seems to be like unfold (minus the recursion stopping predicate) > > On Nov 6, 6:33 pm, Michel Alexandre Salim > wrote: >> On Fri, 05 Nov 2010 19:03:20 -0700, Yang Dong wrote: >> > Maybe because Clojure has a vector, and conj conjoins new elements to >> > the end of the vector, so there's mere little use of fold-right. But, >> > fold-right is an abstraction tool, missing it in the core is kind of >> > pity. >> >> fold-right and reduce-right are both called reduce in >> Clojure:http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ >> reduce >> >> Regards, >> >> -- >> Michel Alexandre Salim, MSc., University of Erlangen-Nuremberg >> Open Source Research Group, Applied Software Engineering >> Web:http://osr.cs.fau.de, Email: michel.sa...@cs.fau.de >> GPG key ID: D09272F7 >> >> () ascii ribbon campaign - against html e-mail >> /\ www.asciiribbon.org - against proprietary attachments > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
as-str function in Clojure 1.3
Hi, Some of the functions from clojure.contrib.string seem to have made it into clojure.string (e.g. blank?, replace-xxx, join etc) in Clojure master, but not 'as-str' as yet. Can somebody tell me whether 'as-str' is going to be part of clojure.string in 1.3? Regards, Shantanu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
could clojure be androids joker card
hi clojure-commmunity, when learning 2 new things at a time, one is always temped to combine them and have some unrealistic fantasies. i am just reading through the meap of ??? so it's not a surprise, that i think about a combination of clojure and android. according to other discussions in the mailinglist, clojure on android is possible and someone has also managed to run the combination. i also noticed, that android-support is mentioned in the clojure 'roadmap' at jira. in particular i though of, how clojure could help android to overcome its java-dependency on the long run ... -> clojure in clojure -> clojure on base of the android system-level-abstractions. also leveraging the power of FP for embedded systems programming seams like something that could pay back. what do you think ? could clojure be androids joker card ? and vice versa ? ;-) have a successful day -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: could clojure be androids joker card
>>I am just reading through the meap of ??? ??? = http://www.manning.com/ableson2/ sorry -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: could clojure be androids joker card
This is a subject that has interested me for a while now. While Clojure doesn't seem to work with android very well, another lisp based language called the kawa framework, that uses JVM just like Clojure, seems to work very well with android. The Kawa framework is used by the android AppInventor to compile AppInventor's Blocks language into dalvik bytecode. You can see how Kawa works on Android at here. http://per.bothner.com/blog/2010/AndroidHelloScheme/ I would really like to see Clojure work on android the same way. On Sun, Nov 7, 2010 at 1:49 PM, faenvie wrote: > hi clojure-commmunity, > > when learning 2 new things at a time, one is always > temped to combine them and have some unrealistic > fantasies. > > i am just reading through the meap of ??? > so it's not a surprise, that i think about a > combination of clojure and android. > > according to other discussions in the mailinglist, > clojure on android is possible and someone has also > managed to run the combination. i also noticed, that > android-support is mentioned in the clojure 'roadmap' > at jira. > > in particular i though of, how clojure could help android > to overcome its java-dependency on the long run ... > -> clojure in clojure -> clojure on base of the android > system-level-abstractions. > > also leveraging the power of FP for embedded systems > programming seams like something that could pay back. > > what do you think ? could clojure be androids joker card ? > and vice versa ? ;-) > > have a successful day > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- http://hi.im/santosh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: could clojure be androids joker card
Hopefully enough, Android support has a dedicated page on clojure dev's wiki : http://dev.clojure.org/display/design/Android+Support ! 2010/11/7 Santosh Rajan : > This is a subject that has interested me for a while now. While > Clojure doesn't seem to work with android very well, another lisp > based language called the kawa framework, that uses JVM just like > Clojure, seems to work very well with android. The Kawa framework is > used by the android AppInventor to compile AppInventor's Blocks > language into dalvik bytecode. You can see how Kawa works on Android > at here. > > http://per.bothner.com/blog/2010/AndroidHelloScheme/ > > I would really like to see Clojure work on android the same way. > > On Sun, Nov 7, 2010 at 1:49 PM, faenvie wrote: >> hi clojure-commmunity, >> >> when learning 2 new things at a time, one is always >> temped to combine them and have some unrealistic >> fantasies. >> >> i am just reading through the meap of ??? >> so it's not a surprise, that i think about a >> combination of clojure and android. >> >> according to other discussions in the mailinglist, >> clojure on android is possible and someone has also >> managed to run the combination. i also noticed, that >> android-support is mentioned in the clojure 'roadmap' >> at jira. >> >> in particular i though of, how clojure could help android >> to overcome its java-dependency on the long run ... >> -> clojure in clojure -> clojure on base of the android >> system-level-abstractions. >> >> also leveraging the power of FP for embedded systems >> programming seams like something that could pay back. >> >> what do you think ? could clojure be androids joker card ? >> and vice versa ? ;-) >> >> have a successful day >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with your >> first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en > > > > -- > http://hi.im/santosh > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: could clojure be androids joker card
On Sun, Nov 7, 2010 at 10:10 AM, Santosh Rajan wrote: > I would really like to see Clojure work on android the same way. Hi, I can hardly explain it myself and that's why I'm asking others whenever I stumble upon such a statement. Bear with my ignorance. I'm simply curious. Why is that important to you? I believe you can use Clojure as a Java library right now without much worries, can't you? Is merely Clojure's syntax so appealing? Jacek -- Jacek Laskowski Notatnik Projektanta Java EE - http://jaceklaskowski.pl -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: could clojure be androids joker card
I find Clojure syntax very appealing. Also Clojure is the first Lisp I have learnt. I give credit to Clojure to bringing Lisp back into the mainstream in the last couple of years. It has brought many people like me, (non Lisp, non Java) programmers like me into the fold. Having said that. Apps on smaller hardware footprints are booming now. Particularly Android. Also Lisp like Languages are a natural, if you wan't to further build on a higher level language. (Like the App Inventor Blocks language does. It has a set of Scheme macro's that map blocks to scheme code). Taking both of the above into account, I would really like to see Clojure there. I hope what I have said makes sense. On Sun, Nov 7, 2010 at 5:12 PM, Jacek Laskowski wrote: > On Sun, Nov 7, 2010 at 10:10 AM, Santosh Rajan wrote: > >> I would really like to see Clojure work on android the same way. > > Hi, > > I can hardly explain it myself and that's why I'm asking others > whenever I stumble upon such a statement. Bear with my ignorance. I'm > simply curious. > > Why is that important to you? I believe you can use Clojure as a Java > library right now without much worries, can't you? Is merely Clojure's > syntax so appealing? > > Jacek > > -- > Jacek Laskowski > Notatnik Projektanta Java EE - http://jaceklaskowski.pl > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- http://hi.im/santosh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: map versus pmap
yes, I started out trying the following example from Practical Clojure: (defn make-heavy [f] (fn [& args] (Thread/sleep 1000) (apply f args))) user=> (time (+ 5 5)) "Elapsed time: 0.06403 msecs" 10 user=> (time ((make-heavy +) 5 5)) "Elapsed time: 1000.622706 msecs" 10 user=> (time (doall (map (make-heavy inc) [1 2 3 4 5]))) "Elapsed time: 5003.314909 msecs" (2 3 4 5 6) user=> (time (doall (pmap (make-heavy inc) [1 2 3 4 5]))) "Elapsed time: 1000.720951 msecs" (2 3 4 5 6) in this case, pmap is faster. On Nov 7, 3:25 am, André Thieme wrote: > Am 06.11.2010 12:57, schrieb philip schwarz: > > > > > > > > > > > Hi all, > > > be gentle please: I have only just started using clojure. > > > I run the following on an Intel Core 2 Duo CPU (starting clojure with > > "java -Xms1000m -Xmx1000m -jar clojure.jar"): > > > user=> (time (nth (doall (map inc (range 1000))) 999)) > > "Elapsed time: 5944.068355 msecs" > > 1000 > > > user=> (time (nth (doall (pmap inc (range 1000))) 999)) > > "Elapsed time: 108837.451146 msecs" > > 1000 > > > I was expecting pmap to take less time then map, instead it took much > > much longer. > > > Any thoughts? > > Try > (time (count (map (fn [_] (Thread/sleep 1)) (range 1000 > vs. > (time (count (pmap (fn [_] (Thread/sleep 1)) (range 1000 > > On my system this is 1002 msecs vs. 39 msecs. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why isn't there a fold-right?
On Sun, Nov 7, 2010 at 3:04 AM, Laurent PETIT wrote: > 2010/11/7 Alan : >> Clojure's reduce is fold-left, not fold-right. My suspicion is that >> fold-right is not as amenable to laziness or to tail-call recursion as >> fold-right, but I don't have much experience in the area so I could be >> wrong. >> >> What I'm surprised we're missing is unfold, not foldr: unfold is easy >> to define lazily, and foldr can often be replaced with foldl. > > There's iterate, which seems to be like unfold (minus the recursion > stopping predicate) And then there's (take-while #(not (stop-pred %)) (iterate f start)). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: as-str function in Clojure 1.3
It will not. Instead, the "clojure.core/name" function now accepts string arguments, returning the string unchanged. -S On Nov 7, 3:15 am, Shantanu Kumar wrote: > Hi, > > Some of the functions from clojure.contrib.string seem to have made it > into clojure.string (e.g. blank?, replace-xxx, join etc) in Clojure > master, but not 'as-str' as yet. Can somebody tell me whether 'as-str' > is going to be part of clojure.string in 1.3? > > Regards, > Shantanu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
clojure-contrib 1.3.0-alpha3 deployed to build.clojure.org
http://build.clojure.org/releases/org/clojure/contrib/ -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why isn't there a fold-right?
You could define a naive 'foldr' like this: (defn foldr [f coll] (if (empty? (rest coll)) (first coll) (f (first coll) (foldr f (rest coll ) (foldr list '(1 2 3 4)) => (1 (2 (3 4))) (foldr - [1 2 3 4]) => -2 However, this is not a tail-recursive function and will be limited by the size of the stack. An alternative involves reversing the sequence and applying the function with its arguments reversed. Then we can just pretend that we are doing a left fold and use 'reduce': (defn foldr [f coll] (reduce (fn [x y] (f y x)) (reverse coll))) Or for those of you who prefer that other people won't be able to read your code: (defn foldr [f coll] (reduce #(f %2 %1) (reverse coll))) Have all good days, David Sletten On Nov 5, 2010, at 10:03 PM, Yang Dong wrote: > Maybe because Clojure has a vector, and conj conjoins new elements to > the end of the vector, so there's mere little use of fold-right. But, > fold-right is an abstraction tool, missing it in the core is kind of > pity. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why isn't there a fold-right?
2010/11/7 David Sletten > Or for those of you who prefer that other people won't be able to read your > code: > (defn foldr [f coll] > (reduce #(f %2 %1) (reverse coll))) > > To be honest, I find this one more readable... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Python is way faster than Clojure on this task
Implementing this in straight Java might help pinpoint whether this is a JVM issue or a Clojure issue. Also, FYI, there is clj-glob (https://github.com/jkk/clj-glob) for finding files based on patterns like */*/*.dat Justin On Nov 4, 4:28 pm, Pepijn de Vos wrote: > Hi all, > > I have written a Python script to analyze Minecraft levels and render a > graph. Then I did the same with Clojure. It takes Python 10 seconds to > analyze a map, while it takes Clojure over a minute. > > After having tried different options without any significant improvement, I > am lost as to why there is such a huge difference. I wouldn't mind an extra > pair of eyes/brains to look at this. > > I blogged about it in more detail > here:http://pepijndevos.nl/clojure-versus-python > Clojure version:https://github.com/pepijndevos/Clomian/ > Python version:https://github.com/l0b0/mian > > Clojure spends most of its time in the freqs function, here are a couple of > variations:https://gist.github.com/663096 > > If you want to run the code yourself, you'll need a Minecraft level and JNBT, > which is not on Maven. > JNBT:http://jnbt.sourceforge.net/ > The level used in the blogpost:http://dl.dropbox.com/u/10094764/World2.zip > > Groeten, > Pepijn de Vos > -- > Sent from my iPod Shufflehttp://pepijndevos.nl -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why isn't there a fold-right?
On Sun, Nov 7, 2010 at 3:28 PM, iko...@gmail.com wrote: > 2010/11/7 David Sletten >> >> Or for those of you who prefer that other people won't be able to read >> your code: >> (defn foldr [f coll] >> (reduce #(f %2 %1) (reverse coll))) >> > fold-right can not be made tail-recursive and in one-pass at the same time. reverse and reduce is a good way to do it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Python is way faster than Clojure on this task
The problem is not the freqs function. The implementation in Python and in Clojure are different algorithms. Both produce a graph with the number of blocks per layer per type, for 6 particular types. These six types are the Clay, Coal ore, Diamond ore, Gold ore, Iron ore, Obsidian, and Redstone ore that are plotted in the graphs in Pepijn's blogpost. The Python approach only calculates the frequencies for these 6 types. The Clojure approach calculates the frequency for ALL the types and then only displays the plot of the 6 types. This is why the freqs function take such a long time as it does too much. The implementation in Clojure below only counts the frequencies for the 6 types. It also only traverses the blocks array only once, similarly to the suggestion from Benny Tsai. Counting the frequencies takes 3 seconds on my machine, using Pepijn's example level as input. This shows that there is no need to apologize for using Clojure :) Counting the frequencies of all 92 types takes 40 seconds on my machine on the example level. I bet this is faster than the Python algorithm for all types, because the Clojure approach traverses the blocks array only once. The Python algorithm will traverse each of the 128 layers 92 times. ;; blocks is one big byte array of all the blocks, created by concatenating all the files (defn freqs [^bytes blocks] (let [freq-layer (vec (repeatedly 128 #(transient {}))) types #{(byte 56) (byte 49) (byte 16) (byte 15) (byte 14) (byte 73)} size (alength blocks)] (loop [idx (int 0)] (when (< idx size) (let [block (byte (aget blocks idx))] (when (types block) ;;the work below is only done when block is one of the six types (let [layer (unchecked-remainder idx 128) fl (nth freq-layer layer)] (assoc! fl block (inc (get fl block (int 0)) (recur (unchecked-inc idx) (doall (map persistent! freq-layer The whole file: https://gist.github.com/666228 -Gijs -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
IntelliJ IDEA/La Clojure with Clojure 1.2?
Hi, Has anybody been able to run La Clojure (IntelliJ IDEA Community Edition 9.0) with Clojure 1.2? The built-in Clojure version in LaClojure are 1.0 and 1.1 and there doesn't seem to be a way to ask LaClojure to use another Clojure JAR or not use either on its own. Regards, Shantanu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: IntelliJ IDEA/La Clojure with Clojure 1.2?
For now I just went ahead and replaced existing LaClojure/clojure.jar (1.1) with clojure-1.2.0.jar and it seems to be working fine, but any pointer that doesn't force me to use this hack would be appreciated. Regards, Shantanu On Nov 8, 1:03 am, Shantanu Kumar wrote: > Hi, > > Has anybody been able to run La Clojure (IntelliJ IDEA Community > Edition 9.0) with Clojure 1.2? The built-in Clojure version in > LaClojure are 1.0 and 1.1 and there doesn't seem to be a way to ask > LaClojure to use another Clojure JAR or not use either on its own. > > Regards, > Shantanu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure-contrib 1.3.0-alpha3 deployed to build.clojure.org
Thanx Stuart! As a general point of protocol, would the Clojure team prefer folks test against the Alpha builds or the (master) SNAPSHOT builds? Sean On Sun, Nov 7, 2010 at 6:50 AM, Stuart Sierra wrote: > http://build.clojure.org/releases/org/clojure/contrib/ -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Python is way faster than Clojure on this task
Great catch, Gijs! On Nov 7, 9:32 am, "Gijs S." wrote: > The problem is not the freqs function. The implementation in Python > and in Clojure are different algorithms. > > Both produce a graph with the number of blocks per layer per type, for > 6 particular types. These six types are the Clay, Coal ore, Diamond > ore, Gold ore, Iron ore, Obsidian, and Redstone ore that are plotted > in the graphs in Pepijn's blogpost. > > The Python approach only calculates the frequencies for these 6 types. > The Clojure approach calculates the frequency for ALL the types and > then only displays the plot of the 6 types. This is why the freqs > function take such a long time as it does too much. > > The implementation in Clojure below only counts the frequencies for > the 6 types. It also only traverses the blocks array only once, > similarly to the suggestion from Benny Tsai. > > Counting the frequencies takes 3 seconds on my machine, using Pepijn's > example level as input. This shows that there is no need to apologize > for using Clojure :) > > Counting the frequencies of all 92 types takes 40 seconds on my > machine on the example level. I bet this is faster than the Python > algorithm for all types, because the Clojure approach traverses the > blocks array only once. The Python algorithm will traverse each of the > 128 layers 92 times. > > ;; blocks is one big byte array of all the blocks, created by > concatenating all the files > (defn freqs [^bytes blocks] > > (let [freq-layer (vec (repeatedly 128 #(transient {}))) > > types #{(byte 56) (byte 49) (byte 16) (byte 15) (byte 14) > (byte 73)} > > size (alength blocks)] > > (loop [idx (int 0)] > > (when (< idx size) > > (let [block (byte (aget blocks idx))] > > (when (types block) > > ;;the work below is only done when block is one of the six > types > (let [layer (unchecked-remainder idx 128) > > fl (nth freq-layer layer)] > > (assoc! fl block (inc (get fl block (int 0)) > > (recur (unchecked-inc idx) > > (doall (map persistent! freq-layer > > The whole file:https://gist.github.com/666228 > > -Gijs -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: could clojure be androids joker card
On Sun, 7 Nov 2010 12:42:09 +0100 Jacek Laskowski wrote: > On Sun, Nov 7, 2010 at 10:10 AM, Santosh Rajan wrote: > > > I would really like to see Clojure work on android the same way. > > Hi, > > I can hardly explain it myself and that's why I'm asking others > whenever I stumble upon such a statement. Bear with my ignorance. I'm > simply curious. > > Why is that important to you? I believe you can use Clojure as a Java > library right now without much worries, can't you? Is merely Clojure's > syntax so appealing? No, its more having a REPL available, so that you can: 1) It makes a nice programmable calculator for mobile devices. 2) I can test out an idea when I have it, rather than having to make a note of it and test it when I'm back at my desk. 3) I can answer mail asking questions about clojure and provided checked answers while on the go, rather than wait until I'm back at my desk. 4) I can do development on all aspects of a clojure application that's going to run on android on the device. And of course: 5) Java is that unappealing. Admittedly, there are other good solutions for some of these, and others you'd only want to do under extreme conditions - or with an android tablet - but still, they do add up. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why isn't there a fold-right?
If that's the case, I can accept it. Thank you guys :) On Nov 8, 2:18 am, "nicolas.o...@gmail.com" wrote: > On Sun, Nov 7, 2010 at 3:28 PM, iko...@gmail.com wrote: > > 2010/11/7 David Sletten > > >> Or for those of you who prefer that other people won't be able to read > >> your code: > >> (defn foldr [f coll] > >> (reduce #(f %2 %1) (reverse coll))) > > fold-right can not be made tail-recursive and in one-pass at the same time. > reverse and reduce is a good way to do it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: could clojure be androids joker card
You might find http://www.slideshare.net/smartrevolution/using-clojure-nosql-databases-and-functionalstyle-javascript-to-write-gextgeneration-html5-apps an interesting alternate approach. As I see it a language is a tool, and I'm still not convinced that Clojure is the right tool for UI. On Nov 7, 12:19 am, faenvie wrote: > hi clojure-commmunity, > > when learning 2 new things at a time, one is always > temped to combine them and have some unrealistic > fantasies. > > i am just reading through the meap of ??? > so it's not a surprise, that i think about a > combination of clojure and android. > > according to other discussions in the mailinglist, > clojure on android is possible and someone has also > managed to run the combination. i also noticed, that > android-support is mentioned in the clojure 'roadmap' > at jira. > > in particular i though of, how clojure could help android > to overcome its java-dependency on the long run ... > -> clojure in clojure -> clojure on base of the android > system-level-abstractions. > > also leveraging the power of FP for embedded systems > programming seams like something that could pay back. > > what do you think ? could clojure be androids joker card ? > and vice versa ? ;-) > > have a successful day -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
CUBRID JDBC driver is on Clojars
Hi, Just a heads up to all. I got in touch with CUBRID guys for a Maven repo for their JDBC driver. They have uploaded it on Clojars and have said they would maintain it there in future: http://clojars.org/org.clojars.cubrid/cubrid-jdbc I will soon include this in OSS-JDBC and do a v0.3 release: http://bitbucket.org/kumarshantanu/oss-jdbc/src Regards, Shantanu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
ANN: Durable Clojure - Phase II - Persistent Data Structures
Extension of http://groups.google.com/group/clojure/browse_thread/thread/561230749be02f28 Hi everyone! I've continued hacking the Clojure core to extend durability. 1. Durable atoms and agents are now supported in addition to refs, using (datom) and (dagent) respectively. 2. Keywords and symbols are now supported. 3. Persistent data structures (except for tree-map and tree-set) are now supported. Durable persistent data structures are truly persistent: writing one with shared structure skips the part that has been written before. This leads to an enormous performance bump, one that I'm confident beats serialization schemes that are less integrated with the Clojure core. Get it here: git://github.com/kwanalyssa/clojure.git TODO: 1. Support for refs of refs, i.e. a ref pointing to a collection of refs. 2. Support for closures and functions. Help greatly appreciated! 3. Support for tree-map and tree-set. This requires functions because of the comparator. 4. Lazy loading and unloading of persistent data structures. This is probably orthogonal to durability for identities, but can share a lot of the same architecture. 5. More unit tests! Especially for concurrent writes to identities! 6. Performance benchmarks! 7. Airtight ACID for drefs, which requires 2PC for in-memory refs. This is a fundamental redesign of LockingTransaction. 8. Hygienic namespaces. This is a tough one. 9. Change API? Maybe use (ref {:durable true} …) instead of (dref …). This may be a way to make the store arg optional with dynamic bindings. Feedback please! 10. A way to maintain namespace identity without relying on a static cache to get reference identity. I really don't like that I punted on this implementation point, but a better way escapes me. Help on this is REALLY welcome! Feedback appreciated and patches welcome! Alyssa Kwan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en