rebellion
rebellion copied to clipboard
A collection of core libraries for Racket
Key idea: combine a bunch of subtransducers into a single transducer that operates on a stream of `variant?` values, and uses each variant's tag to figure out which subtransducer to...
Like `string-trim`, but as a transducer and generalized via a predicate instead of a regular expression. Should be kind of like a combination of `taking-while`, `dropping-while`, and `deduplicating-consecutive`. Signature: ```racket...
Based on research by @samdphillips in #351. Pretty much everything in `rebellion/collection/list` is already checked by `racket/base` and `racket/list` anyway.
Should be exported by `rebellion/binary/immutable-bytes`. Signature: ```racket (sequence->immutable-bytes [seq (sequence/c byte?)]) -> immutable-bytes? ``` Examples: ```racket > (sequence->immutable-bytes (make-list 5 65)) #"AAAAA" > (sequence->immutable-bytes (in-range 65 70)) #"ABCDE" ```
Half-baked idea: an `entry?` transducer constructor named `partitioning` that's like `grouping`, but instead of combining the values for each key using a reducer, it _transduces_ the values for each key...
Signature: ```racket (splitting-at [pos position?] [before transducer?] [after transducer?]) -> transducer? ``` Example: ```racket > (transduce (in-range 0 100) (splitting-at 50 (taking 5) (taking 3)) #:into into-list) (list 0 1...
Signatures: ```racket (inserting-at [v any/c] [position natural?] [#:mode mode out-of-bounds-insertion-mode? raise-out-of-bounds-error]) -> transducer? out-of-bounds-insertion-mode? : predicate/c raise-out-of-bounds-error : out-of-bounds-insertion-mode? skip-out-of-bounds-insertion : out-of-bounds-insertion-mode? insert-out-of-bounds-at-end : out-of-bounds-insertion-mode? (inserting-at-start [v any/c]) -> transducer?...
Signature: ```racket (multiset-remove-all [set multiset?] [elements (sequence/c any/c)]) -> multiset? ``` Examples: ```racket > (multiset-remove-all (multiset 1 1 1 2 2 3 3 3) (list 1 2 3 2)) (multiset...
The tests for most transducers look like this: ```racket (check-equal? (transduce inputs some-transducer #:into into-list) (list expected-output ...) ``` As discussed in #339, this doesn't test many important aspects of...
Transducers are strictly more expressive than reducers, so it should be possible to lift a reducer into an equivalent transducer. The `batching` transducer constructor kind of does this, but it...