Re: Scala for-comprehension to Clojure

2015-11-26 Thread Mark Engelberg
Most Scala `for` examples translate over to Clojure's `for`. The biggest difference is that Scala produces a collection matching the type of the first generator, whereas Clojure produces a lazy sequence, which you can "pour" into the collection of your choice with `into`. It looks like your speci

Re: Scala for-comprehension to Clojure

2015-11-26 Thread Rastko Soskic
Hi, I am not sure if it will serve point the best but that is what I have received as a koan style problem with Scala solution, now I am trying to comprehend it fully and convert to Clojure. Like I said I am by no means Scala expert. Let's say we have some Val container which is capable to hold

Re: Scala for-comprehension to Clojure

2015-11-26 Thread Chris Murphy
It is the same thing in Clojure. It is called a 'list comprehension' even although for form for it starts with `for` I wouldn't worry too much about the flatmap / mapcat stuff, as I think the translation should be quite direct at the higher 'comprehension' level. On Nov 26, 2015 10:12 PM, "Rastko

Re: Scala for-comprehension to Clojure

2015-11-26 Thread Gary Verhaegen
It's a bit hard (at least for me) to see what you're actually trying to do here that would precent a direct translation of your snippet to Clojure's for. Could you perhaps post a complete, self-contained code example in Scala? On Thursday, 26 November 2015, Torsten Uhlmann wrote: > Hi Rastko, >

Re: Scala for-comprehension to Clojure

2015-11-26 Thread Torsten Uhlmann
Hi Rastko, One way of doing that would be to use the mlet macro from the Cats library: http://funcool.github.io/cats/latest/#mlet Also, there are several if-lets or when-lets out there that allow multiple bindings, I used one from https://github.com/ptaoussanis/encore I use Scala's for most of