Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
753 B
Plaintext
25 lines
753 B
Plaintext
; 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)))
|