Re: Map holds on to element being processed

2014-11-10 Thread Andy Fingerhut
At least in your particular case, replacing map with map2, defined below as a small modification to a subset of map, seems to do the trick: (defn map2 [f coll] (lazy-seq (when-let [s (seq coll)] (let [r (rest s)] (cons (f (first s)) (map2 f r)) (map2 count [(repeat 1e8 "stuff

[ANN] Fence - effortless way to avoid manual extern files when doing javascript interop from Clojurescript

2014-11-10 Thread myguidingstar
This library provides a `..` macro that can be used in place of its counterpart in `clojure.core`. Use it for all your javascript interop forms to avoid adding extern files manually. More details here: https://github.com/myguidingstar/fence Hopefully this will save people some extra keystrokes

Map holds on to element being processed

2014-11-10 Thread 'Matt Bossenbroek' via Clojure
Ran into an interesting problem today. In short, this works: (count (repeat 1e8 "stuff")) But this doesn't: (map count [(repeat 1e8 "stuff")]) To be fair, given sufficient memory, it would eventually complete. (If the second example does work for you, change it to 1e10 or something higher).

Re: Mutable local variables

2014-11-10 Thread Ashton Kemerling
Mutation is not a bad performance optimization, and is super useful when the algorithm in question just works better with it. --Ashton Sent from my iPhone > On Nov 10, 2014, at 11:11 AM, Jacob Goodson > wrote: > > I like the map suggestion but there are still those times when mutation makes

[UPDATE] Spring/Clojure integration / changing Clojure references via JMX attributes

2014-11-10 Thread henrik42
Hello again, just in case anybody is following this - I added stuff that lets you publish your mutable references (atom, ref, var) as JMX attributes so that you may use jconsole to change things at runtime. https://github.com/henrik42/spring-break#changing-mutable-state-references-via-jmx-attr

Re: [ClojureScript] Re: ANN: Om 0.8.0-alpha2

2014-11-10 Thread David Nolen
You'll have to work around this yourself for now. There are quite a few things slated for removal on the way to 1.0. I'd like to trim Om to the bare essentials. On Mon, Nov 10, 2014 at 2:33 PM, Todd Berman wrote: > So, one issue for me is I am using rendering? in order to work around some > issu

Re: Mutable local variables

2014-11-10 Thread Gary Trakhman
@Jacob, your specific use-case is much cleaner with cond-let: http://crossclj.info/fun/flatland.useful.experimental/cond-let.html Example: (cond-let [b (bar 1 2 3)] (println :bar b) [f (foo 3 4 5)] (println :foo f) [b (baz 6 7 8)] (println :baz b) :else

Re: Mutable local variables

2014-11-10 Thread Jacob Goodson
I like the map suggestion but there are still those times when mutation makes for a cleaner hack(imo of course). On Monday, November 10, 2014 5:44:25 AM UTC-5, Thomas Heller wrote: > > @Jacob: If you get too many arguments in a loop I found it best to use a > map. > > (loop [{:keys [a b c] :as s

Idiomatic way to return a single value from an async function

2014-11-10 Thread Mike Haney
Eric Normand has an interesting article on this here: http://www.lispcast.com/core-async-code-style -- 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 mod

New Functional Programming Job Opportunities

2014-11-10 Thread Functional Jobs
Here are some functional programming job opportunities that were posted recently: Senior Software Engineer at McGraw-Hill Education http://functionaljobs.com/jobs/8760-senior-software-engineer-at-mcgraw-hill-education Cheers, Sean Murphy FunctionalJobs.com -- You received this message

Idiomatic way to return a single value from an async function

2014-11-10 Thread Alexander Kiel
Hi, what is the most idiomatic way to return a single value from an async function in Clojure? A: return a channel which conveys the result later; also closes the channel (defn f [x] (let [c (chan)] ; put result onto c and close c later c)) B: take a channel onto which the result is

ANN: Om 0.8.0-alpha2

2014-11-10 Thread David Nolen
This release fixes issues discovered in 0.8.0-alpha1 around reference cursors and no local state components. This release also does away with checks around cursor consistency - cursors may be handled the same way whether in render or async contexts. After exploring cursor consistency I came to the

Re: Mutable local variables

2014-11-10 Thread Thomas Heller
@Jacob: If you get too many arguments in a loop I found it best to use a map. (loop [{:keys [a b c] :as state} a-map] (cond (and (= a 1) (= b 2)) (recur (update state :a inc)) ;; 1.7+ only, otherwise use update-in ...)) Working with named arguments (vs. positional) is a lot more user-