Clojure - Transducers

#ReleaseSaturday ๐Ÿš€ โ€” Just pushed the new version of https://thi.ng/hiccup-carbon-icons (now a much larger collection of 2200+ icons, mentioned yesterday[1]) and some other smaller updates/additions to other packages...

This is the last release before switching all packages to the recently released TypeScript 6.0, support for which will likely require some restructuring & refactoring and hopefully will be less painful than it might look so far (I'm also waiting for some dependencies to update their TS type definitions, which are currently breaking, e.g. https://github.com/serialport/node-serialport, used for https://thi.ng/axidraw)

I also added some new async operators for https://thi.ng/transducers-async to simplify some stream processing tasks (e.g. collecting and/or consuming stdout/stderr of a child process by rechunking the stream for line-based processing), for example:

```
import { rechunk } from "@thi.ng/transducers-async";
import { spawn } from "child_process";

// launch child process
const child = spawn("ls", ["-l"]);

// split child's stdout into single lines
for await(let line of rechunk(/\r?\n/g, child.stdout)) {
console.log("output", line);
}
```

[1] https://mastodon.thi.ng/@toxi/116422011357971578

#ThingUmbrella #OpenSource #Maintenance #TypeScript #JavaScript #Transducers #Async #Icons

Full set of IBM's Carbon icons in hiccup format

thi.ng/hiccup-carbon-icons

Neither #Affinity nor #Darktable seemingly support 1D LUTs, which would have been too easy and useful for my #DigitalNegative preparation tool... Instead they both insist on using only 3D LUTs. Converting 1D to 3D takes a bit more effort, but thanks to https://thi.ng/transducers, it's still very easy...

#ThingUmbrella #TypeScript #JavaScript #FunctionalProgramming #Transducers #LUT #Photography

Added a new convenience transducer for clipping and binning values, e.g. as preparation step for histogram generation whilst working in the REPL. New release forthcoming. A small code example attached (actually taken from the doc string of the new `binned()` transducer).

#ThingUmbrella #Transducers #FunctionalProgramming #ASCIIArt #DataViz #TypeScript #JavaScript

๐Ÿ”Š Session Highlights ๐Ÿš€

What an insightful session on **Smart Sensors & Transducers** with Mr. Davendra Yadav (Principal, CERT Group of Institutions, Meerut)! ๐ŸŒŸ

From understanding how sensors shape our daily lives to exploring cutting-edge innovations transforming industries, this session was packed with valuable knowledge! ๐Ÿ’กโœจ

#SessionHighlights #SmartSensors #Innovation #TechTalk #CERTMeerut #Engineering #CareerGrowth #Transducers #FutureTech

๐Ÿš€ Join the Brainstorming Session on Smart Sensors & Transducers! ๐Ÿ”โšก
Gain insights into the role of Smart Sensors & Transducers in our Daily Life with Mr. Davendra Yadav (Principal) at CERT Group of Institutions, Meerut.
๐Ÿ“… Date: 27th March 2025
โฐ Time: 02:00 PM
๐Ÿ“ Venue: Smart Board Room, F-Block

๐Ÿ“ข Don't Miss Out โ€“ Be a Part of This Transformative Learning Experience!

#BrainstormingSession #SmartSensors #Transducers #CERTMeerut #TechInnovation #FutureReady #Engineering #Technology

@weavejester I actually think this is probably wrong! "induce" reminds me of induction, and no values are being induced (this is often related to dependent types and having some sort of inductively defined type or value).

I'll play with it some more, it may be that I need to call it transduce-once or transduce-one (onceduce? lol that's terrible).

#Scheme #transducers #Clojure

Had an idea a couple days ago while writing one of the chapters of the transducers book: it would be very useful to be able to transduce over a single value, if only to test that your transducer / collector will do what you expect it to do.

I've called it once: https://gitlab.com/ThatGeoGuy/chicken-transducers/-/blob/jeremy/once/src/transducers.base.sld?ref_type=heads#L187-189

I'm not sure this is the best name for it, so maybe fedi can help me get a better name?

#Scheme #Clojure #Transducers

src/transducers.base.sld ยท jeremy/once ยท Jeremy Steward / Chicken Transducers ยท GitLab

Transducers for working with foldable data types.

GitLab

Someone asked for help on an interesting transducers (functional programming) problem. My initial answer using other existing transducers still had some minor differences to their intended behavior, but writing a small custom transducer then saves the day and now I can already think of a bunch of other uses for it too:

Attempt #1:
https://github.com/thi-ng/umbrella/issues/490#issuecomment-2296276833

Attempt #2 (custom transducer):
https://github.com/thi-ng/umbrella/issues/490#issuecomment-2296349604

#ThingUmbrella #FunctionalProgramming #Transducers #TypeScript

[transducers] Multiplex while retaining most recent values ยท Issue #490 ยท thi-ng/umbrella

Consider this example: console.log([...iterator( multiplex( comp( take(2), map((t) => "a" + t), ), comp( take(3), map((t) => "b" + t), ) ), range(0, 4) )]) This will log: [["a0","b0"],["a1","b1"],[...

GitHub

#ThingUmbrella #ReleaseFriday[1] ๐Ÿš€ โ€” As announced a couple of weeks ago, a lot of my recent work has been centered around async iterables and addressing the conceptual overlap between the various packages related to those, specifically: https://thi.ng/transducers-async, https://thi.ng/rstream, https://thi.ng/csp, https://thi.ng/fibers, and partially related, https://thi.ng/rdom too. Apart from the first package, until recently, none of the others had direct support for async iterables (largely for historic reasons), but they all offer similar operators & functionality (via different means), which I'm slowly consolidating where it makes sense...

Part of this pretty large undertaking has been a complete rewrite of the temporarily deprecated https://thi.ng/csp package for Communicating Sequential Processes[2] (IMHO one of the most elegant & sane ways to structure larger apps via multiple small, reasonable concurrent processes). The package is active again now (as v3+) albeit constituting a new API (new docs still WIP) and removing any direct transducer-related functionality โ€” this is one aspect of the aforementioned consolidation and now simply assumed to be delegated to the https://thi.ng/transducers-async and/or non-async https://thi.ng/transducers packages. I've also included a new small example project showing mixed usage patterns of working with CSP channels and combining them with (async) transducers to create derived views:

Demo:
https://demo.thi.ng/umbrella/csp-bus/

Source:
https://github.com/thi-ng/umbrella/blob/develop/examples/csp-bus/src/events.ts

Hand in hand with these major changes are smaller and still ongoing updates to https://thi.ng/rdom, which recently received partial support for embedded async iterables as reactive values inside a UI/DOM component tree. The goal for this package is to become fully decoupled from https://thi.ng/rstream and focus more on the equally powerful, but more lightweight (since part of the language) async iterables. Adapters from rstream โ†’ asynciter already exists (see docs).

Unrelated, but also part of this week's release: The new version of https://thi.ng/meta-css includes support for CSS `light-dark()`. The base framework now includes ~950 utilities & 70 functions. See readme for full list...

Happy coding! :)

[1] There're actually a lot more frequent release, but these days I'm only mentioning the more notable ones to not spam everyone...

[2] https://en.wikipedia.org/wiki/Communicating_sequential_processes

#ThingUmbrella #CSP #Async #Transducers #Reactive #UI #DOM #CSS #TypeScript #JavaScript #OpenSource

Async versions of various highly composable transducers, reducers and iterators

thi.ng