Hi, 
I am aware of philosophical differences of Scala and Clojure
but functional programming should be a pretty common ground :)
Thus I need help, I am trying to mimic Scala's for comprehension in Clojure.

Hopefully someone will be able to aid me with the following (perhaps more 
familiar with Scala):

Scala for comprehension is errr how to say "de-sugared" to series 
of map and flatMap calls... thus, it is possible to use plain functions in 
for-comprehension
like:
*val *ns: Conv[List[Int]] = *for *{ // Conv is just alias for functions of 
type B => (B, A)
    x <- int // int is function again of type Conv
    y <- int
    xs <- ints(x) // this is just sequence of numbers
} *yield *xs.map(_ * y)

I don't need all the nuts and bolts, just some guideline for achieving 
something similar
in Clojure.

I am not lazy :) I've already eagerly researched a bit and got to this: Scala 
for-comprehension to Clojure 
<http://stackoverflow.com/questions/25655132/how-to-convert-this-map-flatmap-into-a-for-comprehension-in-clojure>

But as you can see that is not really about having kind of generator 
function which is wrapped into flatMap
call. Perhaps this is not in Clojure's spirit at all, perhaps there is some 
Clojure idiom to achieve something similar.

Any tip, suggestion, critic is welcome and appreciated.

If someone is wondering how in the world I came up to this, I am doing some 
f-p exercises which I've got Scala solution for
however I am not very interested in Scala and I am doing Clojure so I just 
need to grasp concepts...

Thanks in advance...

-- 
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.

Reply via email to