Live data from Hacker News

Ask HN: What is the most beautiful piece of code you've ever read?

news.ycombinator.com

341–350 of 394 posts

Re: Ask HN: What is the most beautiful piece of code you've ever read?

#342
post #7

John Carmack's Fast Inverse Square Root: https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overv... . The first time I really and truly felt that people approach problems differently from how I, by default, go about them.

If you enjoy this sort of thing, this book is full of bit twiddling algorithms you never thought possible: https://www.amazon.com/Hackers-Delight-2nd-Henry-Warren/dp/0...

Re: Ask HN: What is the most beautiful piece of code you've ever read?

#344
post #304

Earlier quoted context omitted.

He mentioned on a podcast that he even uses his own text editor.

Wow! Do you remember which podcast? Now I am interested in this interview!

https://changelog.com/podcast/201

Re: Ask HN: What is the most beautiful piece of code you've ever read?

#345

I really appreciated and missed Scala's `Some`/`None`/`Option` [1] and `lazy` constructs, so much so that I brought them with me to TypeScript. Option provides an elegant way to handle parameters or results that may or may not be defined. Here's a simple Option implementation: https://gist.github.com/mceachen/75598510275865b8cf88bb2ef80... With this you can write something like Opt(possiblyNullResult).flatMap(ea => f…

You might want to look into fp-ts. Has plenty of constructs like those, although it now favors piping calling conventions over a fluent API.

Re: Ask HN: What is the most beautiful piece of code you've ever read?

#346
post #334

Earlier quoted context omitted.

> I see a maze it means it's a maze :) I'd suggest to not go bar-hopping in Thailand with that mindset...

Nice to see a bit of casual transphobia on hackernews.

Nice to see confusing a joke reference to a regional fact (as to things that can seem X but be Y) with transphobia. Anybody told you that merely referencing trans women in Thailand is opposing them? Projecting much?

Re: Ask HN: What is the most beautiful piece of code you've ever read?

#347
https://rosettacode.org/wiki/99_Bottles_of_Beer#World_model_...

https://en.wikipedia.org/wiki/The_Complexity_of_Songs

https://en.wikipedia.org/wiki/Generative_music

https://en.wikipedia.org/wiki/Repetitive_song

|>~~~https://en.wikipedia.org/wiki/E%3DMC2_(song)

https://genius.com/Big-audio-dynamite-e-mc2-lyrics

https://www.youtube.com/watch?v=cHTDkJ-bQqM

Re: Ask HN: What is the most beautiful piece of code you've ever read?

#348
post #334

Earlier quoted context omitted.

Nice to see a bit of casual transphobia on hackernews.

Nice to see confusing a joke reference to a regional fact (as to things that can seem X but be Y) with transphobia. Anybody told you that merely referencing trans women in Thailand is opposing them? Projecting much?

I'm amazed that you're defending that comment.

Re: Ask HN: What is the most beautiful piece of code you've ever read?

#349
post #297
post #281

Earlier quoted context omitted.

So this would be more of a labyrinth than a maze?

No, a labarynth is a single twisting route without branches. A maze has branches and thus can have dead-ends. Both must have an entry and exit point (technically mazes may have more than one exit and entry, but most don't).

That’s open for debate. https://en.wikipedia.org/wiki/Labyrinth:

”Although early Cretan coins occasionally exhibit branching (multicursal) patterns

[…]

both logic and literary descriptions make it clear that the Minotaur was trapped in a complex branching maze

[…]

In English, the term labyrinth is generally synonymous with maze. As a result of the long history of unicursal representation of the mythological Labyrinth, however, many contemporary scholars and enthusiasts observe a distinction between the two.”

Post reply on HN