; feed/home — the capstone. A user's home timeline is the whole pipeline as one
; line: fan all activities out over the follow graph, take the events landing in
; the viewer's inbox, dedupe cross-posts, apply the viewer's ACL, rank, take N.
;
; Requires: fanout.sx, dedupe.sx, acl.sx (feed/timeline), rank.sx, stream.sx.

; the activities in a user's inbox, as a stream
(define
  feed/inbox-stream
  (fn (inbox user) (feed/stream (feed/inbox-activities inbox user))))

; fanout ∘ inbox ∘ dedupe ∘ ACL ∘ rank ∘ take
(define
  feed/home
  (fn
    (stream graph viewer permit? score-fn n)
    (feed/timeline
      (feed/dedupe-activities
        (feed/inbox-stream (feed/fanout stream graph) viewer))
      viewer
      permit?
      score-fn
      n)))
