You sir are nitpicking on me ! On 9/09/2012 02:05, Stephen Compall wrote:
https://gist.github.com/3667614 - (key s))) ;; only works for keyword keys + (key s))) ;; works for arbitrary functions
You of course are right, the key parameter could be a function and this might be useful in some cases. But that is not the *contract* of the fetch-val function. the docstring explicitly says that the state is a map and that the function returns the value corresponding to this key. This does break for a string or integer key. There is no way around it, this is a bug.
As to the second issue, if you're worried about efficiency, a more general solution might be appropriate: one capable of expressing inlining for m-result and m-bind. Right now, you can always get efficiency by writing out your state monadic values rather than using the abstractions.
This function stands alone in the state-m library in showing such an efficiency issue. One can see that great care was taken to make algo.monad efficient. I for one am very pleased about its performances. I'm merely asking to bring this single function up to par with its state-m friends. You'll notice that my preferred solution uses the same coding style as the rest of the state-m functions.
Thanks for the JIRA link, I'm really not in the loop with these things. Sacha -- 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