Simlpe style question
Dear Community, I have one question about readability. As I am not yet deep into Clojure I can only post scala but I am sure you will get my point. Recently I wrote the following dump function in Scala: // convert 1228 to "e2e4" def move2ascii(move: Int): String = { // Clojure Style (((move / 100) % 8 + 97).toChar).toString + ((move / 100) / 8 + 1).toString + (((move % 100) % 8 + 97).toChar).toString + ((move % 100) / 8 + 1).toString } but I could as well have written it like this in an imprative style: (both are equal) def move2ascii(move: Int): String = {// Scala Style val f1 = move / 100 val f2 = move % 100 val row1 = f1 / 8 + 1 // 2 von e2 val row2 = f2 / 8 + 1 // 4 von e4 val col1 = (f1 % 8 + 97).toChar // 5 = e von e2 val col2 = (f2 % 8 + 97).toChar // 5 = e von e4 col1.toString + row1.toString + col2.toString + row2.toString } I am sure if you write the first function in Clojure it would look nearly the same. My point and my question is: Isn't the second function easier to read? I know there had been a lot of threads about readability in clojure but I am not yet convinced. In the second version the brain can rely on some steps inbetween which make it more readable for me. Or should the first function be split up into several more functions to become more readable? I would be happy if you convince me to give Clojure a better chance. Thanks in advance Stefan Edlich P.S.: It's nice to see the upcoming Clojure book in Manning! -- 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: Simlpe style question
Dear freinds, > I would be interested in your feedback now that you've read all the > different proposed alternatives ? Thanks a lot for all these fruitful answers! I am very grateful. Especially the examples of Laurent and Islon where very impressive. I think this should be a major aspect in books and in any efforts to convince developers to switch to clojure. To me the normal developer (and perhaps myself) has not the brain to eval big brackets amounts inside out. But if the code can be made readable like your example did, then Clojure will definitely attract n-times more developers! Anyway you gave me a good kick to invest again. Thanks a lot. Best Regards Stefan Edlich P.S: It would be great if these thoughts would get their way into the new manning book! -- 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
Google Benchmark: needs a Clojure implementation...
Google just published this benchmark comparing C++, Go, Java and Scala using various dimensions. https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf Unfortunately they did not take a look at Clojure. Is there anyone having time to port the benchmark algorithm to Clojure?! http://code.google.com/p/multi-language-bench/ Would be great to see the results they have in * execution time * Code Size * Binary / Jar Size * Memory Footprint (although I think only the two first really matter). Best Stefan Edlich P.S.: I would donate a few bucks for the results ;-) -- 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: Google Benchmark: needs a Clojure implementation...
On 8 Jun., 07:58, Mark Engelberg wrote: > Is there a free source for the original article containing the > detailed description of the algorithm? Well I think the original article by Paul Havlac is availble if you have ACM access here: http://portal.acm.org/citation.cfm?id=262005 The algorithm in the benchmark paper above is not so easy to understand. But if you browse the sourcecode of the implementations (i.e. in your favourite language), you will fast get a vision of how to implement this in Clojure. (Klick Source Browse in the multi language bench). Best Stefan Edlich P.S. I'll try to find a student for this... -- 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: Transactional Synchronization in Haswell
Interesting. Thanks for the good answer. I totally forgot the JVM layer adjustments first ;-) Best Stefan E. -- 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
Transactional Synchronization in Haswell
Hi all, will this RTM have a big language effect on Clojure and other languages? http://software.intel.com/en-us/blogs/2012/02/07/transactional-synchronization-in-haswell/ Best Stefan Edlich -- 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
CFP Special Issue on Clojure => Software Developers Journal
Dear all, the Software Developers Journal http://sdjournal.org/ is planning a special issue on Clojure. Hence we would be interested in Clojure Authors who would be willing to write a few pages on any Clojure topic. The following topics could be of interest: * Introduction to Clojure * The Clojure Philosophy * Macros Demystified (with nice simple examples) * Clojure Concurrency in Practice * Logic Programming with Core logic * The Clojure Web Stack (Heroku) * The Clojure Development Stack * Interesting Libraries * (No) Design Patterns and Clojure * (No) Testing (Needed;-) with Clojure (Various Testing Libs) * Accessing SQL & NoSQL Databases * ... and more! (make your proposal) If you feel you could have time and fun in publishing an article here (ISSN available) then please do not hesitate to contact us. Stefan Edlich (edl...@gmail.com) & Bartosz Miedeksza email: bartosz.miedek...@sdjournal.org www: www.sdjournal.org twitter: www.twitter.com/SDJ_EN download a teaser of the latest issue here: http://sdjournal.org/sdj_cassandra_01_2013?a_aid=bartoszmiedeksza&a_bid=45f0d439 -- 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 Course on Coursera
The community should make an own course and not wait till some god appears in coursera. If someone could host an online learning environment (Google has something new?!) we could split Clojure into 100 topics. Then we need 100 persons to produce each a 5-10 min Video. I would coordinate the 100 topics and produce one video. We just need 99 other volunteers...Cheers. -- 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