Re: core.async: implementing pi.go

2015-08-03 Thread Divyansh Prakash
> > does maya automatically handle operator precedence? > maya always evals from left to right. (maya 1 + 5 :as six, six * 2 :as twelve, twelve / 3 * 2) ;=> 8 > > - Divyansh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Re: core.async: implementing pi.go

2015-08-02 Thread Mark Engelberg
I agree that there's value to making math expressions look like the way they are written in actual math -- it is much easier to tell at a glance that you've entered the correct formula. I think your maya library is a nice contribution. (I think Incanter has a similar macro, but it is nice to have

Re: core.async: implementing pi.go

2015-08-02 Thread Divyansh Prakash
Makes sense. By the way - I've refactored my code to not use a go block inside 'term', and made it much more readable (IMO) than before using my maya library . I'm telling you this because I'm

Re: core.async: implementing pi.go

2015-08-02 Thread Mark Engelberg
On Sun, Aug 2, 2015 at 4:38 AM, Divyansh Prakash < divyanshprakas...@gmail.com> wrote: > I have one more question, though: how does one work in ClojureScript > without > This use case is a little weird because the http://groups.google.com/group/clojure?hl=en --- You received this message becaus

Re: core.async: implementing pi.go

2015-08-02 Thread Divyansh Prakash
Hey, puzzler! Thanks for the detailed response. Just changing (chan) to (chan n) actually worked! I get your displeasure with how 'term' is implemented. That's not how I generally code. I'm very new to core.async and was aiming for a direct translation of the Go code. I do get a little carrie

Re: core.async: implementing pi.go

2015-08-02 Thread Mark Engelberg
Clojure's async is built around the opinion that you, the programmer, should be required to think about what sort of buffer you want to have on your channel, and think about what should happen if that buffer overflows. Your code spins off 5000 little go blocks that are each trying to write to a ch

core.async: implementing pi.go

2015-08-02 Thread Divyansh Prakash
I came across pi.go in the examples for go-lang. I've been trying to replicate it with core.async, and this is what I have till now: (defn term [ch k] > (go (>! ch (-> 4.0 > (* (Math/pow -1 k)) > (/ (-> k (* 2) (+ 1))