[ANN] Clojure 1.7.0-alpha5 now available
Clojure 1.7.0-alpha5 is now available. Try it via - Download: https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-alpha5/ - Leiningen: [org.clojure/clojure 1.7.0-alpha5] A few of the highlights in alpha5: 1) New transducer arities for map-indexed, distinct, and interpose. The transducer versions are generally faster than the sequence versions. See CLJ-1601 for more details. 2) The set and vec functions should now be faster in many cases. Some of the vec improvements will not kick in until CLJ-1499 is committed in the future. See CLJ-1546 and CLJ-1618 for more details. 3) Two particularly troublesome AOT classloading bugs have been addressed - CLJ-979 and CLJ-1544. Many other tickets were found to be duplicates of one of these as well. Big thanks to Nicola Mometto for doing the hard work on debugging and providing fixes for these. For all changes new in alpha5, see the issues marked (alpha5) in the full changes below. Clojure 1.7.0-alpha5 has the changes below from 1.6.0: ## 1 New and Improved Features ### 1.1 Transducers Transducers is a new way to decouple algorithmic transformations from their application in different contexts. Transducers are functions that transform reducing functions to build up a recipe for transformation. Also see: http://clojure.org/transducers Many existing sequence functions now have a new arity (one fewer argument than before). This arity will return a transducer that represents the same logic but is independent of lazy sequence processing. Functions included are: * conj (conjs to []) * map * mapcat * filter * remove * take * take-while * drop * drop-while * cycle * take-nth * replace * partition-by * partition-all * keep * keep-indexed * map-indexed (alpha5) * distinct (alpha5) * interpose (alpha5) Additionally some new transducer functions have been added: * cat - concatenates the contents of each input * de-dupe - removes consecutive duplicated values * random-sample - returns items from coll with random probability And this function can be used to make completing transforms: * completing There are also several new or modified functions that can be used to apply transducers in different ways: * sequence - takes a transformation and a coll and produces a lazy seq * transduce - reduce with a transformation (eager) * eduction - returns a reducible/seqable/iterable seq of applications of the transducer to items in coll. Applications are re-performed with every reduce/seq/iterator. * run! - run the transformation for side effects on the collection There have been a number of internal changes to support transducers: * volatiles - there are a new set of functions (volatile!, vswap!, vreset!, volatile?) to create and use volatile boxes to hold state in stateful transducers. Volatiles are faster than atoms but give up atomicity guarantees so should only be used with thread isolation. * array iterators - added support for iterators over arrays Some related issues addressed during development: * [CLJ-1511](http://dev.clojure.org/jira/browse/CLJ-1511) * [CLJ-1497](http://dev.clojure.org/jira/browse/CLJ-1497) * [CLJ-1549](http://dev.clojure.org/jira/browse/CLJ-1549) * [CLJ-1537](http://dev.clojure.org/jira/browse/CLJ-1537) * [CLJ-1554](http://dev.clojure.org/jira/browse/CLJ-1554) * [CLJ-1601](http://dev.clojure.org/jira/browse/CLJ-1601) (alpha5) * [CLJ-1606](http://dev.clojure.org/jira/browse/CLJ-1606) (alpha5) * [CLJ-1621](http://dev.clojure.org/jira/browse/CLJ-1621) (alpha5) * [CLJ-1600](http://dev.clojure.org/jira/browse/CLJ-1600) (alpha5) ### 1.2 Keyword and Symbol Construction In response to issues raised in [CLJ-1439]( http://dev.clojure.org/jira/browse/CLJ-1439), several changes have been made in symbol and keyword construction: 1) The main bottleneck in construction of symbols (which also occurs inside keywords) was interning of the name and namespace strings. This interning has been removed, resulting in a performance increase. 2) Keywords are cached and keyword construction includes a cache check. A change was made to only clear the cache reference queue when there is a cache miss. ### 1.3 Warn on Boxed Math One source of performance issues is the (unintended) use of arithmetic operations on boxed numbers. To make detecting the presence of boxed math easier, a warning will now be emitted about boxed math if \*unchecked-math* is set to :warn-on-boxed (any truthy value will enable unchecked-math, only this specific value enables the warning). Example use: user (defn plus-2 [x] (+ x 2)) ;; no warning, but boxed #'user/plus-2 user (set! *unchecked-math* :warn-on-boxed) true user (defn plus-2 [x] (+ x 2)) ;; now we see a warning Boxed math warning, NO_SOURCE_PATH:10:18 - call: public static java.lang.Number clojure.lang.Numbers.unchecked_add(java.lang.Object,long). #'user/plus-2 user (defn plus-2 [^long x] (+ x 2)) ;; use a hint to avoid boxing #'user/plus-2 *
Re: channels operations
Not sure if it’s “proper”, but you could just alts! twice on all three channels: (let [[_ p1] (alts! [player1-ch player2-ch timeout-ch]) [_ p2] (alts! [player1-ch player2-ch timeout-ch])] (cond (= p1 timeout-ch) No players played. (= p2 timeout-ch) (str p1 played, and the other player did not play.) :else Both players played before timeout.)) e On Sat, Jan 10, 2015 at 12:53 PM, Jeremy Vuillermet jeremy.vuiller...@gmail.com wrote: Hi, I'm learning core.async with a game I'm developing. This is a one on one game where players have 5 seconds to play. If only one has played before 5 seconds, he is the winner. If none has played, I randomly choose a winner. I have 3 channels, player1-channel, player2-channel and timeout-channel. Although I know I can use alts! to detect the timeout like (alts! [player1-channel player2-channel timeout-channel]) I won't be able to detect the case when only 1 player has played. I can't think of a proper way to do this. Any idea ? Thanks -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
ANN: Om 0.8.0
I'm happy to announce the release of Om 0.8.0. There's nothing much to say over the last rc1 release. The biggest change is how you include Om as a dependency: [org.om/om 0.8.0] https://github.com/swannodette/om Have fun! David -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
channels operations
Hi, I'm learning core.async with a game I'm developing. This is a one on one game where players have 5 seconds to play. If only one has played before 5 seconds, he is the winner. If none has played, I randomly choose a winner. I have 3 channels, player1-channel, player2-channel and timeout-channel. Although I know I can use alts! to detect the timeout like (alts! [player1-channel player2-channel timeout-channel]) I won't be able to detect the case when only 1 player has played. I can't think of a proper way to do this. Any idea ? Thanks -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ClojureScript] ANN: Om 0.8.0
Cool! Thanks, David. I'm curious about the new dependency namespace. It looks like om.org is registered to OM International Services Ltd. Are you associated with them? On Sat, Jan 10, 2015 at 12:27 PM, David Nolen dnolen.li...@gmail.com wrote: I'm happy to announce the release of Om 0.8.0. There's nothing much to say over the last rc1 release. The biggest change is how you include Om as a dependency: [org.om/om 0.8.0] https://github.com/swannodette/om Have fun! David -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescr...@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: channels operations
You might want to put it into a loop, keeping the 'played' values as the loop bindings. (I imagine [false false] in my head, but whatever is meaningful to you.) If the timer dings, you evaluate the winner. If you get a value on a player channel and the other player HAS played, you might recur with a new timeout channel and empty 'played' values. Thus the game starts over. (Careful - you don't want to accumulate a bunch of timeout channels. I haven't looked into this deeply.) If you get a value on a player channel and the other player HAS NOT played, you recur with the existing timeout channel and an updated copy of the 'played' values (in my head, [true false] or [false true]). Chris On Sat, Jan 10, 2015 at 11:53 AM, Jeremy Vuillermet jeremy.vuiller...@gmail.com wrote: Hi, I'm learning core.async with a game I'm developing. This is a one on one game where players have 5 seconds to play. If only one has played before 5 seconds, he is the winner. If none has played, I randomly choose a winner. I have 3 channels, player1-channel, player2-channel and timeout-channel. Although I know I can use alts! to detect the timeout like (alts! [player1-channel player2-channel timeout-channel]) I won't be able to detect the case when only 1 player has played. I can't think of a proper way to do this. Any idea ? Thanks -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: Sparse matrix support for Clojure with vectorz-clj 0.28.0
Thanks Matt! I've just release Vectorz 0.45.0 including your changes. A lot of sparse operations are much faster now! On Monday, 29 December 2014 21:56:30 UTC+8, Matt Revelle wrote: Yes, will do. On Dec 28, 2014, at 9:58 PM, Mike Anderson mike.r.anderson...@gmail.com wrote: Looks like you have some good changes in your Vectorz branch - any chance you could tidy up and make a PR? I like the idea of specialised getSlices and getColumns in particular - these should be much faster than getting the slices one-by-one if the data is very sparse. On Monday, 29 December 2014 09:43:54 UTC+8, Matt Revelle wrote: On Dec 28, 2014, at 7:28 PM, Mike Anderson mike.r.anderson...@gmail.com wrote: Interesting idea. The challenge is that I'm not sure how to add representation specification in an implementation independent way. It's a quirk of vectorz that it has both indexed and hashed storage, I probably wouldn't expect any other implementations to have that. Likewise row and column oriented storage are fairly obvious choices but I still wouldn't expect every implementation to support both. Any idea how you would specify the API? I guess we could simply pass an optional map argument of options, but behaviour would be completely implementation specific. I think the map is the way to go. You’re probably correct about few other implementations having as many options, but adding a map of “preferences” seems like a good option. Creating a sparse matrix might then look like: ;; preferences as a separate arg (new-sparse-array [10 10] :vectorz {:order :row :indexed true}) ;; an alternative, preferences combined with implementation selection (new-sparse-array [10 10] {:impl :vectorz :order :row :indexed true}) Implementations should throw an exception if they don’t support (or understand) the preferences. On Monday, 29 December 2014 02:12:05 UTC+8, Matt Revelle wrote: Glad to see the addition of new-sparse-array to core.matrix. It looks like it defaults to SparseRowMatrix for the Vectorz implementation? Should the API provide a way to specify which sparse matrix representation (e.g., row- vs column-based, indexed vs hashed) should be used? I'd suggest a 3-arity new-sparse-array which takes a keyword indicating the representation to use as well as a new function which returns a list of available representations for a specific implementation. I think at this point you incorporated (looks like we have some duplication too, doh) all the changes I had made for sparse matrix support in Vectorz, but will verify. I definitely haven't covered all the potential code paths - in particular a lot of things aren't yet optimised for sparse operations. So any review / patches would be appreciated! I did some optimization of sparse ops but the code probably needs to be cleaned up before submitting (e.g., generalized and/or moved to the correct level in class hierarchy). Those changes were made hastily when I needed to quickly get a program running fast. A branch containing all performance changes based on an older revision of the develop branch is available here: https://github.com/mattrepl/vectorz/tree/sparse-speed There is a related sparse-speed branch in my forks of vectorz-clj and core.matrix. We should also look into other sparse array representations for Vectorz from: Matlab, MTJ (https://github.com/fommil/matrix-toolkits-java, specifically the LinkedSparseMatrix for row and column ops), etc. -Matt On Saturday, December 27, 2014 4:56:55 AM UTC-5, Mike Anderson wrote: Here is a little belated Christmas present for Clojure data aficionados: ;; setup (use 'clojure.core.matrix) (set-current-implementation :vectorz) ;; create a big sparse matrix with a trillion elements (initially zero) (def A (new-sparse-array [100 100])) ;; we are hopefully smart enough to avoid printing the whole array! A = #SparseRowMatrix Large matrix with shape: [100,100] ;; mutable setter operations supported so that you can set individual sparse elements (dotimes [i 1000] (mset! A (rand-int 100) (rand-int 100) (rand-int 100))) ;; all standard core.matrix operations supported (esum A) = 50479.0 ;; efficient addition (time (add A A)) = Elapsed time: 12.849859 msecs ;; matrix multiplication / inner products actually complete in sensible time ;; (i.e. much faster than than the usual O(n^3) which might take a few thousand years) (time (mmul A (transpose A))) = Elapsed time: 2673.085171 msecs Some nice things to note about the implementation: - Everything goes through the core.matrix API, so your code won't have to change to use sparse matrices :-) - Sparse matrices are 100% interoperable with non-sparse (dense) matrices - Sparse arrays are fully mutable. Management of storage / indexing happens automatically - It isn't just matrices - you can have sparse vectors,