Emacs Backstage: Transducers (publ. 2024-11-19)

Another gem you'll want to tune into or download is Woodbury's presentation on transducers:

Transducers: finally, ergonomic data processing for Emacs!

He ported transducers to Elisp. The presentation gives an explanation of what transducers are and demonstrations in Elisp. Basically, transducers are a (system? mechanism?) that allows you to do data transformations in a way that is efficient but still easy to understand. Each call to t-transduce requires three things:

- operations to apply, composed if more than one

- a reducer function, which does something with the results

- a data source, such as an infinite list of numbers

Here is an example:

Here are results from evaluating the above:

You can change the output simply by changing your reducer to #'t-vector. On the next evaluation, this gave

I'll refer you to the presentation itself for more explanations and examples.

This work © 2024 by Christopher Howard is licensed under Attribution-ShareAlike 4.0 International.

CC BY-SA 4.0 Deed

Proxied content from gemini://gem.librehacker.com/gemlog/starlog/20241119-0.gmi

Gemini request details:

Original URL
gemini://gem.librehacker.com/gemlog/starlog/20241119-0.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.