Words and Buttons
wordsandbuttons.online · Personal blog · on HN since 2017
Words and Buttons is a site of interactive explanations on programming, C, numerical methods, and code readability.
What HN saysHN commenters like its lexical differential highlighting idea and the "So You Think You Know C?" quiz and book, which illustrate undefined behavior.
50HN people shared it
23linked it in comments
101stories submitted
3.7Kstory points
1 year agolast shared
2017people per year2026
Most-shared posts
- 1Lexical differential highlighting instead of syntax highlighting9 people · 257 points · first shared 2019 · 68 comments on HN
- 2Free e-book (~2 MB): So You Think You Know C? [pdf]6 people · 56 points · first shared 2020 · 8 comments on HN
- 3Fortran is still a thing5 people · 417 points · first shared 2018 · 243 comments on HN
- 4Words and Buttons Online5 people · 4 points · first shared 2018 · discussion on HN
- 5So you think you know C? (2016)4 people · 530 points · first shared 2019 · 322 comments on HN
- 6The C++ Killers (Not You, Rust)4 people · 118 points · first shared 2024 · 115 comments on HN
- 7APL deserves its renaissance too (2018)3 people · 374 points · first shared 2018 · 219 comments on HN
- 8Quadratic splines are useful too3 people · 9 points · first shared 2018 · discussion on HN
- 9Challenge your performance intuition with C++ magic squares3 people · 6 points · first shared 2017 · discussion on HN
- 10Outperforming LAPACK with C metaprogramming3 people · 2 points · first shared 2018 · 1 comments on HN
- 11Outperforming everything with anything: Python? Sure, why not?2 people · 325 points · first shared 2018 · 96 comments on HN
- 12SymPy makes math fun again2 people · 269 points · first shared 2019 · 59 comments on HN
- 13Outperforming LAPACK with C++ metaprogramming2 people · 157 points · first shared 2018 · 78 comments on HN
- 14Simple Image Vectorization2 people · 134 points · first shared 2019 · 15 comments on HN
- 15If I were to invent a programming language for the 21st century2 people · 121 points · first shared 2018 · 175 comments on HN
What HN people wrote when they linked it
okaleniuk · 2022-05-18
Also, why don't we let users decide which contrast works best for them?
My https://wordsandbuttons.online/ uses default browser colors for anything other than interactive illustrations. For those, I just don't know how to make user choice work with the graphics they show since the graphics is always different from picture to picture, so I impose slightly tinted background as part of the palette.
css · 2025-10-15
I love the concept of lexical differential highlighting [0] (discussed here [1]). It makes reading math so much easier, especially in dense code. However I don't know of any editor that implements a feature like this.
If you paste the following code into the example block in [0] you can see how useful this can be:
while (b - a).abs() > EPSILON { let c = a + (a - b) * f_a / (f_b - f_a); let f_c = J(c); if f_c * f_b == 0.0 { a = b; f_a = f_b; } else { f_a /= 2.0; } b = c; f_b = f_c; } [0]: https://wordsandbuttons.online/lexical_differential_highlighting_inste…
[1]: https://news.ycombinator.com/item?id=20414528
glitchc · 2025-09-04
Any time the language specification is undefined, the compiler behaviour will be probabilistic at best. Here's an example for C:
https://wordsandbuttons.online/so_you_think_you_know_c.html
pockybum522 · 2024-01-20
Programmers annoyed with the 'quiz' might really enjoy this book on that site, which is an excellent read.
https://wordsandbuttons.online/SYTYKC.pdf
zerojames · 2023-09-18
I _love_ your site!
I have a question about https://wordsandbuttons.online/lexical_differential_highlighting_inste… What does this part mean:
> Ideally, the smaller the lexical difference, the greater the color difference should be.
I am fascinated by different ways to represent code visually.
sevensor · 2018-10-03
> Metaprogramming is an antipattern in C.
Yet we often see passionate arguments in its favor, as for instance from Sústrik
(http://250bpm.com/blog:56) and Tatham (https://www.chiark.greenend.org.uk/~sgtatham/mp/) and a person on the internet who recommends replacing LAPACK with preprocessor macros (http://wordsandbuttons.online/outperforming_lapack_with_c_metaprogramm… Would you care to comment on its enduring popularity?
kelas · 2024-01-06
> How do we pick up that writing style.
since the discussion here revolves around "intentionally obfuscated c", i'd like to recommend three sources which elucidate what obfuscated c is:
1. this is not how you want to write c. this is very bad news:
#include <stdio.h> #include <stdlib.h> int main() { int *p = (int*)malloc(sizeof(int)); int *q = (int*)realloc(p,sizeof(int)); *p = 1; *q = 2; if (p == q) printf("%d %d\n", *p, *q); } 2. what follows is five trivial questions about c. correct answer to all five is "i don't know". you don't even need to understand why that is, what you want instead is keep it simple. "Origins of J" from 1989 is infinitely more sane and approachable than any of these five:
https://wordsandbuttons.online/so_you_think_you_know_c.html
3. what amazes me is that no single person in this thread yet illuminated us with a staple wisecrack piece of general form "preprocessor is evil". so, let me do it: preprocessor and fancy macros are EVIL, and they are not your friends. if you don't know when to stop producing them, they will turn on you, and will become deadly.
this effect can be described in less sinister language, sunny side up. if you understand at least 30% of untold sorrow which happens below, you are 100% qualified to use preprocessor:
//!\file adios.h //! first things first #define struct union #define if while #define else #define break //!< what a sweetheart #define if(x) …
solarbreeze · 2023-09-29
Thank you, really happy to hear you enjoyed it!
You can find more short little APL games at
https://github.com/jamescprice/131-APL-Games-for-your-Commodore-64-C12…
It's meant to be a little games book in the spirit of the 1980s books of short little games for the 8bits of the era, and a love letter to APL and the Commodore line. Usually each game brings in a new glyph and you can get a feel for how the language works by looking them over. A work in progress.
Ken Iverson's "Notation as a Tool of Thought" paper/manifesto is a great read and speaks to the philosophy behind APL quite well. He makes a pretty good case for how a programming language without ANY keywords, just symbolic glyphs, is expressive, suggestive, and economic. Classic APL existed as a mathematical notation before it was implemented as a living symbolic maths language, and you can sense that heavy mathematical background in all the crazy glyphs being used.
The wikipedia page on floor and ceiling functions (https://en.wikipedia.org/wiki/Floor_and_ceiling_functions) says "Carl Friedrich Gauss introduced the square bracket notation [x] in his third proof of quadratic reciprocity (1808).[3] This remained the standard[4] in mathematics until Kenneth E. Iverson introduced, in his 1962 book A Programming Language, the names "floor" and "ceiling" and the corresponding notations ⌊x⌋ and ⌈x⌉.[5][6]
The wonderful Words and Buttons site has a nice writeup at…
atum47 · 2024-10-25
I found this neat website with this cool algorithm to erase pieces of a image called darn (darn it) and I just implemented that on my editor as well.
https://wordsandbuttons.online/image_darning.html
youssefabdelm · 2024-09-07
Hm for me interactive visualizations are more illuminating:
https://www.falstad.com/dotproduct/
https://wordsandbuttons.online/interactive_mnemonics_for_dot_and_cross…
In essence then, not as confusing to the beginner who might even know what a dot product 'is' operationally but not what it 'does'.
So level 1 'it's just a normalized dot product', level 2 more immediately intuitive: 'is arrow 1 pointing in the same direction as arrow 2?' or 'how close is arrow 1's direction to arrow 2's direction?'
Now what's left after that is 'Why is it so? Why did we decide on this in embeddings?'
teleforce · 2024-07-04
To beat OpenBLAS is neither suprising nor it's not unheard of, for example D language library Mir for linear algebra did just that many years ago [1]. For C++ and C implementation please check these metaprogramming approaches [2], [3].
What's really surprising is that many modern languages are still depending on OpenBLAS for examples Matlab, Julia, Mojo, etc. But to be fair they probably have their own reasons, right?
[1] Numeric age for D: Mir GLAS is faster than OpenBLAS and Eigen (2016):
http://blog.mir.dlang.io/glas/benchmark/openblas/2016/09/23/glas-gemm-…
[2] Vastly outperforming LAPACK with C++ metaprogramming (2018):
https://wordsandbuttons.online/vastly_outperforming_lapack_with_cpp_me…
[3] Outperforming LAPACK with C metaprogramming (2018):
https://wordsandbuttons.online/outperforming_lapack_with_c_metaprogram…
sergius · 2024-05-03
This was a more interesting comment:
https://wordsandbuttons.online/the_real_cpp_killers.html
deepsun · 2024-05-01
Nitpick: C++ is not. Far from it. Compiled binary -- yes, but try building a barely old C++ project.
"I have no confidence that a C++ application I built last year with CMake 3.21 will build today with CMake 3.25." (c) https://wordsandbuttons.online/the_real_cpp_killers.html
logtempo · 2024-04-05
cylinder714 · 2023-09-12
I'm really enjoying your book of essays, So You Think You Know C [PDF]:
https://wordsandbuttons.online/SYTYKC.pdf
adipginting · 2022-10-08
A ~1/10 part of this book will test your C skill, not quite an introductory book. https://wordsandbuttons.online/SYTYKC.pdf
chriswarbo · 2021-11-24
Syntax highlighting is pretty redundant. Some interesting alternative uses of colour information are given at https://buttondown.email/hillelwayne/archive/syntax-highlighting-is-a-… (e.g. colouring different scopes, or different imports)
I also like the idea of using colour to distinguish different identifiers, e.g. https://wordsandbuttons.online/lexical_differential_highlighting_inste…
https://medium.com/@evnbr/coding-in-color-3a6db2743a1e
https://zwabel.wordpress.com/2009/01/08/c-ide-evolution-from-syntax-hi…
rgoulter · 2020-09-16
Lexical differential highlighting might help for output like this; but I don't know of any editor support.
https://wordsandbuttons.online/lexical_differential_highlighting_inste…
twotwotwo · 2019-11-29
The most intriguing version I've heard of this was also based on the feeling that it's already easy to scan for keywords and structure; they went a different direction, using color to make different things (especially confusable ones) look different: https://wordsandbuttons.online/lexical_differential_highlighting_inste…
I don't feel like I know how/if highlighting helps, so all I can really say is seems interesting.
I think some of the problems commenters are having with the color scheme are because the site has a dark mode and contrast might be worse when it's on. Maybe in that mode text colors meant for a dark background are still getting applied in the white-backgrounded code fragments.
intc · 2019-10-25
* https://wordsandbuttons.online/fortran_is_still_a_thing.html
"Fortran is not, of course, outdated, and it’s not at all complex. In fact, it has grown into these myths exactly because it is that good at what it does."
Just wanted to share some positive FORTRAN vibes...
xorand · 2019-07-05
I enjoyed your https://wordsandbuttons.online/fortran_is_still_a_thing.html