AtlatestRepositorysigil-fp
1
;;; (sigil fp chain) - Threading Macros (re-exported from core)2
;;;3
;;; The threading macros `chain`, `->`, and `some->` now live in4
;;; `(sigil core)`, where they were before the 2026-03-31 FP extraction.5
;;; They are structural control-flow syntax used throughout idiomatic Sigil,6
;;; not optional combinators, so they belong in core. Since `(sigil core)` is7
;;; auto-imported into every module, any program already has these macros in8
;;; scope without importing anything.9
;;;10
;;; This module re-exports them so existing `(import (sigil fp chain))` and11
;;; `(import (sigil fp))` consumers keep working unchanged. Because the12
;;; re-exported bindings ARE core's bindings (not fresh definitions), a program13
;;; importing both `(sigil core)` and `(sigil fp)` sees no duplicate-binding14
;;; conflict.15
;;;16
;;; The optional combinators (`compose`, `pipe`, `partial`, `partial-right`,17
;;; `flip`, `complement`, `juxt`, `const`) remain in `(sigil fp fn)`.18
;;;19
;;; ## Basic Threading20
;;;21
;;; ```scheme22
;;; ;; Thread-first (no placeholder needed)23
;;; (chain 5 (+ 3) (* 2))24
;;; ; => 16 (same as (* (+ 5 3) 2))25
;;;26
;;; ;; Explicit placeholder with _27
;;; (chain '(1 2 3)28
;;; (map (lambda (x) (* x 2)) _)29
;;; (apply + _))30
;;; ; => 1231
;;; ```32
;;;33
;;; ## Short-Circuit Threading34
;;;35
;;; ```scheme36
;;; ;; Returns #f if any step produces #f37
;;; (some-> user38
;;; (dict-ref _ name:)39
;;; (string-split " " _)40
;;; car)41
;;; ```43
(define-library (sigil fp chain)44
(import (sigil core))45
(export chain -> some->))