rebellion icon indicating copy to clipboard operation
rebellion copied to clipboard

Trimming transducer

Open jackfirth opened this issue 5 years ago • 0 comments

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:

(trimming-where [trimmable-element? predicate/c]) -> transducer?

Example:

> (transduce "   Hello  \n   \n world!  \n"
             (trimming-where char-whitespace?)
             #:into into-string)
"Hello world!"

Open questions:

  • What about regular expression-based trimming?
  • What about the various keyword arguments on string-trim?
  • Should this be encapsulated in some sort of trimmer? object?
  • What's the relationship to #328 and to #353?

jackfirth avatar Nov 15 '19 10:11 jackfirth