; feed/api — ergonomic API over the stream layer for non-APL callers.
; A single mutable activity log; post appends, all returns it as a stream.
;
; Requires: lib/feed/normalize.sx, lib/feed/stream.sx (loaded by harness).

(define feed/-log (list))

; post — normalize then append. Returns the stored activity.
(define
  feed/post
  (fn
    (raw)
    (let
      ((a (feed/normalize raw)))
      (begin (set! feed/-log (append feed/-log (list a))) a))))

; all — the whole log as a stream (insertion order)
(define feed/all (fn () (feed/stream feed/-log)))

; reset! — clear the log (test hygiene)
(define feed/reset! (fn () (begin (set! feed/-log (list)) nil)))

; size — number of posted activities
(define feed/size (fn () (len feed/-log)))
