Fork me on GitHub
#core-async
<
2017-05-18
>
lmergen13:05:20

so, let’s say i want to enforce a ‘final’ action on a channel (e.g. sending the results to a destination HTTP endpoint), what would be the most idiomatic approach to do this ? my gut tells me this should probably be a reduce operation, but i’m not sure what other approaches are possible

lmergen13:05:49

another approach would be to use a go-loop, but that feels a bit hacky

lmergen13:05:53

the advantage of the reduce approach is that it also automatically closes if there is no input left, and it feels the most “functional” approach

stijn13:05:55

@lmergen I read this the other day, and I like how they are terminating their pipeline https://tech.grammarly.com/blog/building-etl-pipelines-with-clojure

lmergen13:05:07

that’s pretty neat

lmergen13:05:00

i’m assuming you’re talking about that transducer / reduced? trickery

ghadi14:05:10

the reduced? handling is still incorrect in that blog

stijn17:05:42

no, i was talking about sending the output of your pipeline to a closed channel

stijn17:05:20

but you can as well use reduce without building up an accumulator

hiredman17:05:50

that makes me sad

hiredman17:05:22

and the post is using pipeline and not pipeline-blocking

hiredman17:05:45

I mean, it is cool that they are happy with what they did

hiredman17:05:53

also a stateful transducer on a channel 😞

hiredman17:05:34

not on a channel, on a pipeline, and pipeline might do the right thing there, I froget

hiredman17:05:01

the reason the outputting to a closed channel thing makes me sad is they have built this parallel processing pipeline with no way to tell when it is done

hiredman17:05:06

I dunno, on the one hand you want people to be happy with their choice of using clojure, on the other hand what they have shared is flawed in many ways

hiredman17:05:32

anyway, random blog posts on the internet are of dubious quality, who knew

val_waeselynck21:05:37

All work and no play makes Jack a dull boy