HNHacker News
TopNewBestAskShowJobs

laszlokorte

1,199 karma · joined September 10, 2015

submissionscomments
laszlokorte··on What Is Copilot Exactly?
Isn't the line you quoted about asking a real person co-worker?
laszlokorte··on Combinators
Based on other existing material on the topic (like the excellent code_report youtube channel) I once wrote an introduction to combinators and lambda calculus targetted at javascript developers (mostly targetted at my younger self) [1]

In short a combinator is a pure function that accesses only identifiers that are provided as arguments.

Length(x,y) { sqrt(xx + yy) } is not a combinator because it relies on global definitions for plus, times and sqrt.

But foo(x, y, b, u, v) { v(b(u(x), u(y))) } is a combinator because it only composes functions that are given as arguments.

Foo(3,5,+,square,sqrt) would result in the same value as length(3,5) so foo can be regarded as capturing the compositional structure of the euclidean distance calculation.

[1]: https://static.laszlokorte.de/combinators/

laszlokorte··on Oscar Reutersvärd (2021)
I love Eschers works. A few years ago I watched an documentary about his in the cinema, but I can remember the name.

3Blue1Brown just released an amazing video explaining the geometric transformation for Eschers print gallery. This made me try to reimplement the effect as WebGL shader [1].

It was very much fun especially doing it fully on my own just based on the general idea without looking at actual existing implementations. It highlighted for me how in non-linear transformations even small mistakes on my side can have huge negative effects on the final image that are tricky to pin down due to the non-linearity.

[1]: https://static.laszlokorte.de/escher/

laszlokorte··on TeX Live 2026 is available for download now
With typst its fast enough to update the pdf/png/svg preview while you are typing, instead of waiting 0.x seconds when hitting save :)
laszlokorte··on Typed Assembly Language (2000)
Think of types more as physical units to check your calculation. The position on a chess board and on a checker board are both 2d integer vectors but you might or might not want them able to be summed together, the same way that 5 liters and 5 grams are both real numbers but should not be summed.
laszlokorte··on New layouts with CSS Subgrid
If you nest two grids, the rows and columns of two sibling grids are not forced two align.

With subgrid the rows and columns of two sibling grids are aligned with each other by glueing them to the rows and columns of the parent grid.

laszlokorte··on New layouts with CSS Subgrid
With nested flexbox the nested dimensions are not aligned to each other. With grid the items are aligned across both each row AND each column. With subgrid even nested grids can be aligned across nesting levels.
laszlokorte··on The Future of Programming (2013) [video]
My favorite Bret Victor talk ever is „Drawing dynamic visualizations“ [1] that made me try to reverse engineer [2] the demonstrated tool that he sadly never released.

[1]: https://youtu.be/ef2jpjTEB5U?si=S7sYRIDJKbdiwYml

[2]: https://youtube.com/playlist?list=PLfGbKGqfmpEJofmpKra57N0FT...

laszlokorte··on Lenses in Julia
Say you want to do obj.child.foo[3].bar += 2 but without mutation, but instead all the data is immutable and you need to do a deep copy along the path.

Lenses are an embedded dsl for doing this via syntax that reads similar to to the mutable variant. Additionally it allows to compose many of such transformations.

laszlokorte··on Lenses in Julia
Yes functional lenses are very good at transforming between between schematas.

You can think of it as an functional programming based embedded domain specific language for transforming immutable data structures into each other. Sure there are other ways to do it but its like generalized map/filter/reduce class of functions vs doing the same imperatively by hand or in other ways

laszlokorte··on Lenses in Julia
Yes lenses are pairs of functions that allow bidirectional data transformations. One function acts like a getter and one function acts like a setter. The signatures of the functions are designed to compose nicely. This allows to compose complex transformations from a few simple building blocks.

In the end it is really just function composition but in a very concise and powerful way.

In your cambria example the lens is defined as yaml. So this yaml needs to be parsed and interpreted and the applied to the target data. The rules that are allowed to be used in the yaml format must be defined somewhere. With pure functional lenses the same kind of transformation rules can be defined just by function composition of similar elemental rules that are itself only pairs of functions.

laszlokorte··on UIs Are Not Pure Functions of the Model – React.js and Cocoa Side by Side (2018)
This is a very simple example in svelte [1]

This is very detailed introduction and documetation of a lense-based architecture in react. [2] At the first glance it looks kind of overwhelming but it contains lots of examples.

This is a case study of many rather complex components. [3] The codinsteade is rather quick and dirty hacked together and at the first glance not really readable but thats kind of the point: even complex components can simply be composed locally from many small parts of requiring some global controller managing the state and keeping it consistent.

1: https://svelte.dev/playground/ea842faa235540bba43d7970ecf8ce...

2: https://github.com/calmm-js/documentation/blob/master/introd...

3. https://github.com/laszlokorte/svatom?tab=readme-ov-file

laszlokorte··on UIs Are Not Pure Functions of the Model – React.js and Cocoa Side by Side (2018)
In my experience when applying this architecture to react or svelte, the performance is quiet good, often better than classic alternative approaches (redux, many local useState)

But the main benefit is not only the persistence of the app state, but composable globally consistent state. With most state management solutions at some point you hit a wall where communicating state changes between far away components is really difficult. You need to manually manage eventlistener lifecycles, route events through the application and convert events into state changes and state changes into events, while not causing cycles or unstable feedback loops or race conditions.

With lenses the state tree is composed declaratively and locally. each component does not need to care if the parent state is locally constructed or coming from further away.

/edit: Actually using this approach you are not forced to have a single global state but instead each component can simply decide to embed its child components state into its own state or not. If all components decide to embed their children state you get a single global state. But if all components decide to not embed their children state you get only local state with no communication. But the unified Interface gives you the choice.

laszlokorte··on UIs Are Not Pure Functions of the Model – React.js and Cocoa Side by Side (2018)
With lenses its possible to create component interfaces that make local and global state interchangeable. Even for focus, selection, scrollposition components use local state by default but that can replaced by a lense into a global state. This make stuff like synching two scroll positions or selectiom ranges super easy and allows for consistent manual focus management across components.
laszlokorte··on Clojure Zippers (2021)
Yes if List is immutable and the interface for stepping through the slides ist designed accordingly
laszlokorte··on Typst 0.14
Typst is such a pleasure to work with! Especially compiled to wasm in the browser, super fast
laszlokorte··on Elixir 1.19
php
laszlokorte··on Why I Chose Elixir Phoenix over Rails, Laravel, and Next.js
Yes because Elixir is such a nice language.

In every language there are sharp edges or dirty corners that are just annoying once you hit them. JavaScript and Php are full of inconsistencies, Ruby and Python are nice and the surface but once you dive into meta programming, OOP and mutability complex code bases are just impossible to trust/reason about their correctness. Rust, C++, C#, F#, Java... I could go on.

In my opinion Elixir just hits the sweet spot of good design. After multiple years using it there comes nothing to my mind that I find ugly or annoying.

Sure there are other languages that are quiet nice on paper but often they lack the ecosystem to let you just build production ready stuff. The Elixir ecosystem is also not that large, but large enough for quickly building a web app or composing useful automation pipelines.

laszlokorte··on I built ChatGPT with Minecraft redstone [video]
Are these kind of projects actually build manually inside of minecraft block by block or is there some verilog/vhdl to minecraft-level compiler toolchains used?
laszlokorte··on The key to getting MVC correct is understanding what models are
No, because they dont define the >>= operator (which is the one to be associative) in the first place.
laszlokorte··on What Is the Fourier Transform?
I am glad you are enjoying it! :)
laszlokorte··on What Is the Fourier Transform?
Look great! I was already thinking about reimplementing mine as TUI
laszlokorte··on What Is the Fourier Transform?
Looks amazing! Thank you
laszlokorte··on What Is the Fourier Transform?
I am glad you like it!

Yes the simplest way to think of it is to exponentiate the dft matrix to an exponent between 0 and 1 (1 being the classic dft). But then the runtime complexity is O(n^2) (vector multiplied with precomputed matrix) or O(n^3) opposed to the O(n log n) of fast fourier transform. There are tricks to do a fast fractional fourier transform by multiplying and convolving with a chirp signal. My implementation is in rust [1] compiled to web assembly, but it is based on the matlab of [2] who gladly answered all my mails asking many questions despite already being retired.

[1]: https://github.com/laszlokorte/svelte-rust-fft/tree/master/s...

[2]: https://nalag.cs.kuleuven.be/research/software/FRFT/

laszlokorte··on What Is the Fourier Transform?
Shameless plug: If you are interested in Fourier Transform and signal processing you might enjoy my somewhat artistic 3D visualisation of the fourier transform as well as the fractional fourier transform [1]

(Fractional fourier transform on the top face of the cube)

And for short time fourier transform showing how a filter kernel is shiftes across the signal. [2]

[1]: https://static.laszlokorte.de/frft-cube/

[2]: https://static.laszlokorte.de/time-frequency/

laszlokorte··on Show HN: I made a 3D SVG Renderer that projects textures without rasterization
The implementation shown in the video is actually particularly slow because all the geometric transformations are implemented in terms of lenses/optics ([1]) and ramdajs ([2]). So the whole mess is a gigantic stack of nested, composed and curried functions, instead of raw linear algebra (just becaus I could).

I later optimized the hotpath and it is significantly faster (still miles behind webgl/webgpu obviously). You can try yourself if you scroll alll the way to the veeeerrrry bottom here [3].

[1]: https://github.com/calmm-js/partial.lenses [2]: https://ramdajs.com/ [3]: https://static.laszlokorte.de/svatom/

laszlokorte··on Show HN: I made a 3D SVG Renderer that projects textures without rasterization
Very cool! Just just implemented an SVG 3D renderer a few weeks ago [1]. But I did not implement texturing yet and wondered how one could do this.

[1]: https://youtu.be/kCNHQkG1Q24?si=3VxfVFtG2MiEEmlX

laszlokorte··on Rhombus Language
What would be the corresponding syntax for matching and flipping only the first Posn?

If I had to guess:

  fun flip_all([Posn(x, y), rest]):
    [Posn(y, x), rest]
If I am correct then the only difference between flipping all and flipping just the first is `...` vs `rest`
laszlokorte··on Introducing a terms of use and updated privacy notice for Firefox
So what about synced bookmarks?
laszlokorte··on A drill bit that can also drive screws
Except emacs
← PreviousPage 2 of 12Next →