frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

AI Overviews are killing the web search, and there's nothing we can do about it

https://www.neowin.net/editorials/ai-overviews-are-killing-the-web-search-and-theres-nothing-we-c...
2•bundie•5m ago•0 comments

City skylines need an upgrade in the face of climate stress

https://theconversation.com/city-skylines-need-an-upgrade-in-the-face-of-climate-stress-267763
2•gnabgib•6m ago•0 comments

1979: The Model World of Robert Symes [video]

https://www.youtube.com/watch?v=HmDxmxhrGDc
1•xqcgrek2•10m ago•0 comments

Satellites Have a Lot of Room

https://www.johndcook.com/blog/2026/02/02/satellites-have-a-lot-of-room/
2•y1n0•11m ago•0 comments

1980s Farm Crisis

https://en.wikipedia.org/wiki/1980s_farm_crisis
3•calebhwin•11m ago•1 comments

Show HN: FSID - Identifier for files and directories (like ISBN for Books)

https://github.com/skorotkiewicz/fsid
1•modinfo•16m ago•0 comments

Show HN: Holy Grail: Open-Source Autonomous Development Agent

https://github.com/dakotalock/holygrailopensource
1•Moriarty2026•24m ago•1 comments

Show HN: Minecraft Creeper meets 90s Tamagotchi

https://github.com/danielbrendel/krepagotchi-game
1•foxiel•31m ago•1 comments

Show HN: Termiteam – Control center for multiple AI agent terminals

https://github.com/NetanelBaruch/termiteam
1•Netanelbaruch•31m ago•0 comments

The only U.S. particle collider shuts down

https://www.sciencenews.org/article/particle-collider-shuts-down-brookhaven
2•rolph•34m ago•1 comments

Ask HN: Why do purchased B2B email lists still have such poor deliverability?

1•solarisos•34m ago•2 comments

Show HN: Remotion directory (videos and prompts)

https://www.remotion.directory/
1•rokbenko•36m ago•0 comments

Portable C Compiler

https://en.wikipedia.org/wiki/Portable_C_Compiler
2•guerrilla•38m ago•0 comments

Show HN: Kokki – A "Dual-Core" System Prompt to Reduce LLM Hallucinations

1•Ginsabo•39m ago•0 comments

Software Engineering Transformation 2026

https://mfranc.com/blog/ai-2026/
1•michal-franc•40m ago•0 comments

Microsoft purges Win11 printer drivers, devices on borrowed time

https://www.tomshardware.com/peripherals/printers/microsoft-stops-distrubitng-legacy-v3-and-v4-pr...
3•rolph•40m ago•1 comments

Lunch with the FT: Tarek Mansour

https://www.ft.com/content/a4cebf4c-c26c-48bb-82c8-5701d8256282
2•hhs•44m ago•0 comments

Old Mexico and her lost provinces (1883)

https://www.gutenberg.org/cache/epub/77881/pg77881-images.html
1•petethomas•47m ago•0 comments

'AI' is a dick move, redux

https://www.baldurbjarnason.com/notes/2026/note-on-debating-llm-fans/
5•cratermoon•48m ago•0 comments

The source code was the moat. But not anymore

https://philipotoole.com/the-source-code-was-the-moat-no-longer/
1•otoolep•48m ago•0 comments

Does anyone else feel like their inbox has become their job?

1•cfata•48m ago•1 comments

An AI model that can read and diagnose a brain MRI in seconds

https://www.michiganmedicine.org/health-lab/ai-model-can-read-and-diagnose-brain-mri-seconds
2•hhs•52m ago•0 comments

Dev with 5 of experience switched to Rails, what should I be careful about?

2•vampiregrey•54m ago•0 comments

AlphaFace: High Fidelity and Real-Time Face Swapper Robust to Facial Pose

https://arxiv.org/abs/2601.16429
1•PaulHoule•55m ago•0 comments

Scientists discover “levitating” time crystals that you can hold in your hand

https://www.nyu.edu/about/news-publications/news/2026/february/scientists-discover--levitating--t...
3•hhs•57m ago•0 comments

Rammstein – Deutschland (C64 Cover, Real SID, 8-bit – 2019) [video]

https://www.youtube.com/watch?v=3VReIuv1GFo
1•erickhill•57m ago•0 comments

Tell HN: Yet Another Round of Zendesk Spam

5•Philpax•58m ago•1 comments

Postgres Message Queue (PGMQ)

https://github.com/pgmq/pgmq
1•Lwrless•1h ago•0 comments

Show HN: Django-rclone: Database and media backups for Django, powered by rclone

https://github.com/kjnez/django-rclone
2•cui•1h ago•1 comments

NY lawmakers proposed statewide data center moratorium

https://www.niagara-gazette.com/news/local_news/ny-lawmakers-proposed-statewide-data-center-morat...
2•geox•1h ago•0 comments
Open in hackernews

Transducer: Composition, abstraction, performance (2018)

https://funktionale-programmierung.de/en/2018/03/22/transducer.html
107•defmarco•3mo ago

Comments

dwohnitmok•3mo ago
This is maybe as good a time as any to discuss the usual alternative presentation of transducers that I find is a far gentler introduction.

A transducer is simply a function of the form `a -> List<b>`. Yes this is fully polymorphic, i.e. it holds even for transducers that only operate over just lists.

In this case `mapping` is just

This lens views a transducer through the lens of the `eduction` function as a more souped up `map`. Whereas with a normal `map` you only get to use a function `a -> b`, which means you can't change the underlying structure, with `eduction` you get to use `a -> List<b>` (again a transducer), where you "keep" any elements that are in the output list and you "discard" any elements not in the output list.

So e.g. `mapping` would be:

    (defn mapping [f] (fn [x] [(f x)]))
or in Python

    def mapping(f):
        return lambda x: [f(x)]
and `filtering` would be:

    (defn filtering [f] (fn [x] [if (f x) [x] []]))
or in Python

    def filtering(f):
        return lambda x: [x] if f(x) else []
In my opinion way clearer and easier!

For more details on the full equivalence see https://news.ycombinator.com/item?id=27778423

The current presentation of transducers has always felt like a wart in Clojure.

lispybanana•3mo ago
Nicely done.
jodleif•3mo ago
Did you mean list<a> -> b? To my mind a transducer is a tranform + reducer
dwohnitmok•3mo ago
No I meant `a -> List<b>`. This is because a list is itself a fold (which is a reducer with an additional base case).
lgrapenthin•3mo ago
A transducer transforms a reducing function. Its signature is rfn->rfn. The resulting rfn can then be used to reduce/fold from any collection/stream type into any other collection/stream type.

I don't see what your functions have to do with that.

dwohnitmok•3mo ago
(HN is going to collapse this comment because the code makes it too long).

My functions are exactly equivalent to transducers.

My link in the original comment goes over it at a more theoretical level.

But if you want runnable code, I've included Clojure below that translates between the two representations (there's some annoying multi-arity stuff I haven't handled very rigorously, but that's mainly an artifact of the complection in the traditional Clojure representation of transducers and goes away when you think of them as just `a -> List<b>`).

There's a line in the original article that the author doesn't go far enough on. "Everything is a fold." Yes more than that, folding is not just a function over a list, a fold is a list and vice versa (this holds for any algebraic datatype). Transducers are just one example of this, where Clojure has decided to turn a concrete data structure into a higher order function (wrongly I believe; although I haven't gone to the effort of truly specializing all my functions to verify my suspicions that you can actually get even better performance with the concrete data representation as long as you use specialized data containers with specialized behavior for the zero and one element cases).

  (defn tmap
    "Map transducer"
    [f]
    (fn [x] [(f x)]))

  (defn tfilter
    "Filter transducer"
    [f]
    (fn [x] (if (f x) [x] [])))

  (defn ttake
    "Take n elements"
    [n]
    (let [n-state (volatile! n)]
      (fn 
        [x]
        (let [current-n @n-state]
          (if (pos? current-n) 
            (do (vswap! n-state dec) [x]) 
            [])))))

  (defn simple-transducer->core-transducer
    [simple-transducer]
    (fn 
      [rf]
      (fn 
        ([] (rf))
        ([result] (rf result))
        ([result input] 
          (reduce rf result (simple-transducer input))))))

  (defn core-transducer->simple-transducer
    [core-transducer]
    (fn
      [x]
      ((core-transducer #(cons %2 %1)) [] x)))

  (defn catcomp
    ([f g]
      (fn [x] (mapcat g (f x))))
    ([f g & fs]
      (reduce catcomp (catcomp f g) fs)))

  (def example-simple-transducer
    (catcomp 
      (tmap inc) 
      (tfilter even?)
      (tmap inc)
      (ttake 2)))

  (defn example-simple-transducer-manual
    [x]
    (->> ((tmap inc) x)
         (mapcat (tfilter even?))
         (mapcat (tmap inc))
         ;; Stateful transducers are hard to work with manually
         ;; You have to define it outside of the function to maintain the state
         ;; This is true for traditional transducers as well
         ;; (mapcat (ttake 2))
         ))


  (def example-core-transducer
    (comp
      (map inc)
      (filter even?)
      (map inc)
      (take 2)))

  ;; Yields [3 5]
  (into [] (simple-transducer->core-transducer example-simple-transducer) [1 2 3 4 5])

  ;; Also yields [3 5]
  (into [] example-core-transducer [1 2 3 4 5])

  ;; Yields [3]
  (simple-transducer 1)

  ;; Also yields [3]
  ((core-transducer->simple-transducer example-core-transducer) 1)
roenxi•3mo ago
A popular noob error in Clojure is to get really, really excited about using reduce and trying to use it to replace for loops. Maybe someone wants to sum up every other odd number and they build some horrible reducer to do that which manages its own state in the reduction object. It leads to ugly code. Reduce and it's colleague map are most powerful when the underlying collection could have been be shuffled and it wouldn't matter much - or at least where the state to be managed in the reduce is trivial.

So something to note about transduce is that it looks a lot like reduce but suddenly the examples [0] start being more complex functions where some elements of the collection get removed, order matters and state begins to appear during the fold. Functions like `take`, `filter`, `partition`, `interpose`, `dedupe`, etc, etc.

As with many things in the functional world (cough monads) I feel the explanations don't make a lot of sense before meeting the problem they solve in the wild. As with a lot of Clojure's better parts transducers are a state management tool.

[0] https://clojure.org/reference/transducers

jwr•3mo ago
Transducers are IMHO one of the most under-appreciated features of Clojure. If you want a really good intro, watch Rich Hickey's talk about transducers: https://www.youtube.com/watch?v=6mTbuzafcII (Rich is an excellent speaker and most of his talks are really worth watching, even if you don't use Clojure).

The thing about transducers is that once you start using them, the abstractions click in your mind and you start using them more and more in your code. Many things our software does can be looked at as pipelines, and transducers let you write composable functions and put them together into pipelines. As you see more pipelines in your code, you will write those composable functions and reuse them in various places.

Experienced Clojure programmers will rarely use loops, for me transducers are the #1 choice whenever I have to process a collection of any kind.

Their efficiency (no intermediate collections!) is a nice bonus — you get both high-level composable code and efficiency, which is incredible.

One thing I dislike about transducers is when I need a stateful one: these are hard to understand and very difficult to write. I rarely do this, except when I really want to stick to the transducer abstraction and I have a couple of hours to spend on a puzzle. But you rarely need to write your own stateful transducers, usually the built-in ones are enough (things like take/drop).

dwohnitmok•3mo ago
If you rewrite the transducer as a function that outputs a list, stateful transducers get a lot easier to write.

See `ttake` here: https://news.ycombinator.com/item?id=45859831

bjoli•3mo ago
I wrote srfi-171, which inplements transducers for scheme: https://srfi.schemers.org/srfi-171/srfi-171.html

It starting to be quite some time ago, but I can answer some questions if you have any.