transducer
| Kind | kit |
|---|---|
| Categories | functional-programming data-processing |
| Keywords | transducer functional transformation composition |
Clojure-inspired transducers for composable, reusable transformations
Files
| File | Description |
|---|---|
kit.toml | Package manifest with metadata and dependencies |
src/transducer.kit | Core transducers: map, filter, compose, partition, fold |
tests/transducer.test.kit | Tests for composition, stateful ops, and partitioning |
examples/basic.kit | Core transducers and composition patterns |
examples/data-pipeline.kit | Multi-stage pipelines, batching, and early termination |
examples/word-count.kit | MapReduce-style text analysis with transducers |
LICENSE | MIT license file |
Architecture
Transducer Composition
Transducers are composable transformation pipelines that separate the "what" from the "how":
Transducer vs Traditional
Dependencies
No Kit package dependencies.
Installation
kit add gitlab.com/kit-lang/packages/kit-transducer.gitUsage
import Kit.TransducerLicense
MIT License - see LICENSE for details.
Exported Functions & Types
map
(a -> b) -> Transducer a b
filter
(a -> Bool) -> Transducer a a
remove
(a -> Bool) -> Transducer a a
cat
Transducer (List a) a
mapcat
(a -> List b) -> Transducer a b
keep
(a -> Option b) -> Transducer a b
compose
List Transducer -> Transducer a b
transduce
Transducer a b -> (c -> b -> c) -> c -> List a -> c
into
Transducer a b -> List a -> List b
take-into
Int -> List a -> List a
take-xf
Int -> Transducer a b -> List a -> List b
drop-into
Int -> List a -> List a
drop-xf
Int -> Transducer a b -> List a -> List b
take-while-into
(a -> Bool) -> List a -> List a
take-while-xf
(b -> Bool) -> Transducer a b -> List a -> List b
drop-while-into
(a -> Bool) -> List a -> List a
drop-while-xf
(b -> Bool) -> Transducer a b -> List a -> List b
dedupe-into
List a -> List a
dedupe-xf
Transducer a b -> List a -> List b
distinct-into
List a -> List a
distinct-xf
Transducer a b -> List a -> List b
interpose-into
a -> List a -> List a
interpose-xf
b -> Transducer a b -> List a -> List b
map-indexed
(Int -> a -> b) -> Transducer a b
map-indexed-into
(Int -> a -> b) -> List a -> List b
count
Transducer a b -> List a -> Int
sum
Transducer a Int -> List a -> Int
any?
Transducer a b -> List a -> Bool
none?
Transducer a b -> List a -> Bool
first
Transducer a b -> List a -> Option b
last
Transducer a b -> List a -> Option b
partition
Int -> List a -> List (List a)
partition-xf
Int -> Transducer a b -> List a -> List (List b)
partition-by
(a -> b) -> List a -> List (List a)
partition-by-xf
(b -> c) -> Transducer a b -> List a -> List (List b)
pipe
List Transducer -> List a -> List b