Fork me on GitHub
#clojure-dev
<
2015-10-07
>
Alex Miller (Clojure team)12:10:14

@danielcompton: I would but I am not sure where to do that :) suggestions welcome...

danielcompton18:10:18

You could either add something directly to the signup page (but that’s a pain), or put it on here? http://dev.clojure.org/display/community/Contributing

danielcompton18:10:55

@alexmiller: would you be open to adding an example on http://clojure.org/transducers below > "As a mnemonic, remember that comp of transducer functions is applied in the same order as ->> with sequence functions.”

(->> (range 10)
     (map inc)
     (filter odd?)
     (take 5))

(sequence
  (comp
    (map inc)
    (filter odd?)
    (take 5))
  (range 10))

danielcompton18:10:29

It took me a while to understand that sentence as I kept expecting comp to be backwards like it normally is

Alex Miller (Clojure team)19:10:40

the text right before that with "builds a transformation stack that runs left-to-right (filtering happens before mapping in this example)" was trying to be explicit about the ordering - did that not connect?

danielcompton19:10:15

Seeing an example makes it all connect

danielcompton19:10:55

If I know what the code is meant to look like then I can understand the explanation

danielcompton19:10:22

Also, the example of (def xf (comp (filter odd?) (map inc))) is in the opposite order from the example above it

danielcompton19:10:38

I know the one above isn’t threading, but it is in close proximity

Alex Miller (Clojure team)19:10:38

well that is confusing :)

danielcompton19:10:44

maybe " equivalent to the sequence transformation order of:”?

danielcompton19:10:37

Although: As a mnemonic, remember that comp of transducer functions is applied in the same order as ->> with sequence functions. The transformation above is equivalent to the sequence transformation order in:

danielcompton19:10:53

comp isn’t applying the transducer functions in order

Alex Miller (Clojure team)19:10:55

"As a mnemonic, remember that the ordering of transducer functions in comp is the same order as of sequence transformations with ->>. The transformation above is equivalent to the sequence transformation:"

danielcompton19:10:33

Yeah that’s good

Alex Miller (Clojure team)19:10:49

I made another slight change but I think that's better, thansk