this post was submitted on 11 Feb 2024
3 points (100.0% liked)

Programmer Humor

32047 readers
1534 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

Hacker News post about this: https://news.ycombinator.com/item?id=39309783 (source available)

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 7 months ago

I've written some magic templates that I assume are not easy to read by those who don't know.

But this is seemingly unmaintainable... terrifying... and kind of neat.

[–] [email protected] 1 points 7 months ago* (last edited 7 months ago)

After 5 minutes of staring at it: Its typesystem sudoku. Each row and each col in the grid must add up to 15 (T<>), bit each number in the grid must be different (Df<>).

Grid will only be a type alias for the value true (google "Dependent types") only if all Type Parameters (wich are values) hold up to the Sudoku conditions).

The file would not compile with "true as Grid" when grid type-aliases to false.

Fun to understand.

EDIT: too late

[–] [email protected] 1 points 7 months ago

I like to think I can usually look at code in languages I don't know and still get the gist of what it does but I am drawing a complete blank. Is this even slightly legible to anyone and if yes please explain