frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Clojure: Transducers

https://clojure.org/reference/transducers
53•tosh•2d ago

Comments

mannycalavera42•1h ago
transducers and async flow are :chefkiss
bjoli•1h ago
I made srfi-171 [0], transducers for scheme. If you have any questions about them in general I can probably answer them. My version is pretty similar to the clojure version judging by the talks Rich Hickey gave on them.

I know a lot of people find them confusing.

0: https://srfi.schemers.org/srfi-171/srfi-171.html

thih9•1h ago
From (2016) at least.

https://web.archive.org/web/20161219045343/https://clojure.o...

adityaathalye•52m ago
I'd reckon most of Clojure is from ten years ago. Excellent backward compatibility, you see :) cf. https://hopl4.sigplan.org/details/hopl-4-papers/9/A-History-...
whalesalad•7m ago
It's a blessing and a curse that zero innovation has occurred in the Clojure space since 2016. Pretty sure the only big things has been clojure.spec becoming more mainstream and the introduction of deps.edn to supplant lein. altho I am still partial to lein.
adityaathalye•42m ago
May I offer a little code riff slicing FizzBuzz using transducers, as one would do in practice, in real code (as in not a screening interview round).

Demo One: Computation and Output format pulled apart

  (def natural-nums (rest (range)))

  (def fizz-buzz-xform
    (comp (map basic-buzz)
          (take 100))) ;; early termination

  (transduce fizz-buzz-xform ;; calculate each step
             conj ;; and use this output method
             []   ;; to pour output into this data structure
             natural-nums)

  (transduce fizz-buzz-xform ;; calculate each step
             str ;; and use this output method
             ""  ;; to catenate output into this string
             natural-nums) ;; given this input

  (defn suffix-comma  [s]  (str s ","))

  (transduce (comp fizz-buzz-xform
                   (map suffix-comma)) ;; calculate each step
             str ;; and use this output method
             ""  ;; to catenate output into this string
             natural-nums) ;; given this input
Demos two and three for your further entertainment are here: https://www.evalapply.org/posts/n-ways-to-fizzbuzz-in-clojur...

(edit: fix formatting, and kill dangling paren)

eduction•30m ago
The key insight behind transducers is that a ton of performance is lost not to bad algorithms or slow interpreters but to copying things around needlessly in memory, specifically through intermediate collections.

While the mechanics of transducers are interesting the bottom line is they allow you to fuse functions and basic conditional logic together in such a way that you transform a collection exactly once instead of n times, meaning new allocation happens only once. Once you start using them you begin to see intermediate collections everywhere.

Of course, in any language you can theoretically do everything in one hyperoptimized loop; transducers get you this loop without much of a compromise on keeping your program broken into simple, composable parts where intent is very clear. In fact your code ends up looking nearly identical (especially once you learn about eductions… cough).

fud101•14m ago
These sound wild in terms of promise but I never understood them in a practical way.
moomin•9m ago
They're not really that interesting. They're "reduce transformers". So, take a reduction operation, turn it into an object, define a way to convert one reduction operation into another and you're basically done. 99% of the time they're basically mapcat.

The real thing to learn is how to express things in terms of reduce. Once you've understood that, just take a look at e.g. the map and filter transducers and it should be pretty obvious. But it doesn't work until you've grasped the fundamentals.

drob518•3m ago
Transducers work even better with a Clojure library called Injest. It has macros similar to the standard Clojure threading macros except Injest’s macros will recognize when you’re using transducers and automatically compose them correctly. You can even mix and match transducers and non-transducer functions and Injest will do its best to optimize the sequence of operations. And wait, there’s more! Injest has a parallelizing macro that will use transducers with the Clojure reducers library for simple and easy use of all your cores. Get it here: https://github.com/johnmn3/injest/tree/main

Note: I’m not the author of Injest, just a satisfied programmer.

Laws of Software Engineering

https://lawsofsoftwareengineering.com
524•milanm081•6h ago•270 comments

Show HN: GoModel – an open-source AI gateway in Go

https://github.com/ENTERPILOT/GOModel/
77•santiago-pl•3h ago•18 comments

Fusion Power Plant Simulator

https://www.fusionenergybase.com/fusion-power-plant-simulator
65•sam•2h ago•21 comments

Show HN: VidStudio, a browser based video editor that doesn't upload your files

https://vidstudio.app/video-editor
180•kolx•5h ago•66 comments

Kasane: New drop-in Kakoune front end with GPU rendering and WASM Plugins

https://github.com/Yus314/kasane
13•nsagent•1h ago•0 comments

Running a Minecraft Server and More on a 1960s Univac Computer

https://farlow.dev/2026/04/17/running-a-minecraft-server-and-more-on-a-1960s-univac-computer
109•brilee•3d ago•19 comments

Trellis AI (YC W24) Is hiring engineers to build self-improving agents

https://www.ycombinator.com/companies/trellis-ai/jobs/SvzJaTH-member-of-technical-staff-product-e...
1•macklinkachorn•16m ago

Tindie store under "scheduled maintenance" for days

https://www.tindie.com/
78•somemisopaste•4h ago•26 comments

A type-safe, realtime collaborative Graph Database in a CRDT

https://codemix.com/graph
106•phpnode•6h ago•31 comments

Original GrapheneOS responses to WIRED fact checker

https://discuss.grapheneos.org/d/34369-original-grapheneos-responses-to-wired-fact-checker
164•ChrisArchitect•2h ago•91 comments

The Vercel breach: OAuth attack exposes risk in platform environment variables

https://www.trendmicro.com/en_us/research/26/d/vercel-breach-oauth-supply-chain.html
3•queenelvis•3m ago•0 comments

Clojure: Transducers

https://clojure.org/reference/transducers
54•tosh•2d ago•10 comments

Edit store price tags using Flipper Zero

https://github.com/i12bp8/TagTinker
90•trueduke•2d ago•94 comments

Tim Cook's Impeccable Timing

https://stratechery.com/2026/tim-cooks-impeccable-timing/
200•hasheddan•5h ago•271 comments

MNT Reform is an open hardware laptop, designed and assembled in Germany

http://mnt.stanleylieber.com/reform/
202•speckx•1d ago•82 comments

Anthropic says OpenClaw-style Claude CLI usage is allowed again

https://docs.openclaw.ai/providers/anthropic
392•jmsflknr•13h ago•224 comments

Show HN: Mediator.ai – Using Nash bargaining and LLMs to systematize fairness

https://mediator.ai/
115•sanity•1d ago•60 comments

As oceans warm, great white sharks are overheating

https://e360.yale.edu/digest/great-white-sharks-climate
108•speckx•2h ago•91 comments

Anthropic takes $5B from Amazon and pledges $100B in cloud spending in return

https://techcrunch.com/2026/04/20/anthropic-takes-5b-from-amazon-and-pledges-100b-in-cloud-spendi...
156•Brajeshwar•4h ago•153 comments

Leonardo, Borgia, and Machiavelli: A Fateful Collusion

https://www.historytoday.com/archive/leonardo-borgia-and-machiavelli-fateful-collusion
23•apollinaire•5d ago•0 comments

Slava's Monoid Zoo

https://factorcode.org/slava/monoids.html
40•luu•1d ago•8 comments

Show HN: Ctx – a /resume that works across Claude Code and Codex

https://github.com/dchu917/ctx
11•dchu17•1d ago•4 comments

Recommended GPU Repairshop in Europe (Germany)

12•DogRunner•2d ago•0 comments

Salmon exposed to cocaine and its main byproduct roam more widely

https://www.science.org/content/article/cocaine-pollution-gives-salmon-wanderlust
113•1659447091•11h ago•67 comments

A History of Erasures Learning to Write Like Leylâ Erbil

https://thepointmag.com/criticism/a-history-of-erasures/
5•lermontov•23h ago•0 comments

Expansion Artifacts

https://mattstromawn.com/writing/expansion-artifacts/
4•tobr•22h ago•0 comments

Show HN: Daemons – we pivoted from building agents to cleaning up after them

https://charlielabs.ai/
13•rileyt•1h ago•7 comments

The Beauty of Bonsai Styles

https://longwoodgardens.org/blog/2023-05-17/beauty-bonsai-styles
169•lagniappe•12h ago•31 comments

Colorado River disappeared record for 5M years: now we know where it was

https://phys.org/news/2026-04-colorado-river-geological-million-years.html
10•wglb•1d ago•3 comments

Less human AI agents, please

https://nial.se/blog/less-human-ai-agents-please/
93•nialse•10h ago•111 comments