Fork me on GitHub
#core-async
<
2016-01-31
>
raymcdermott16:01:02

@jgdavey: I fiddled around and got the sliding window working

raymcdermott16:01:27

one thing that - as a newbie - feels wrong is the need to put guards around reading from the channel like this

raymcdermott16:01:36

(defn simple-printer [in]
  (a/go-loop []
    (if-let [item (<! in)]
      (println item))
    (recur)))

raymcdermott16:01:29

I thought - wrongly in my code at least - that <! would only read from the channel when data was available but I had to add a guard as I kept reading nil from the channel

raymcdermott16:01:53

any guidance or tips on what I’m doing wrong here?

sander17:01:29

@raymcdermott: sure you're not writing nil to windowed somewhere?

sander17:01:55

never mind, seems like that could only happen in window-filter and it doesn't. <! should only proceed once there is a value, and if it returns nil that should mean the channel is closed

raymcdermott17:01:39

ah, it’s probably the closed use case - that makes sense

raymcdermott17:01:28

I really should RTFM 😉

jgdavey18:01:23

@raymcdermott: I took a quick crack at it as well. Not sure if it would meet all your needs, but here ya go: https://gist.github.com/jgdavey/d928136d035645bd15ec