Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Works of fiction that have inspired you to solve programming problems?
27 points by marttt 45 days ago | hide | past | favorite | 14 comments
Often times, programmers turn to music to get their brain ready for coding. Have you ever felt the same kind of inspiration after reading works of fiction by certain authors?

In other words, I wonder if the structure, language, composition etc in a novel might "open up" the reader's brain in a similar way that e.g. musical works by Bach or Philip Glass seem to get some coders "in the zone".

The second part of your question is thought-provoking. There are a lot of works of fiction that have inspired me due to broad themes, but there are a lot fewer whose inherent "structure, language, [and] composition" have inspired. So I'll try and focus my answer on this latter idea.

Also, I'm going to list these from 1 to 2, but the first is an order of magnitude better then the second, so think of them on an inverse log scale.

1. David Foster Wallace's short story "The Awakening of My Interest in Annular Systems". DFW is a brilliant writer in general, but his writings on math and logic have always been so unique and powerful to me. This one is my favorite. There's this combination of melancholy, and mathematical precision that was one of the first times I started to think about the beauty of analysis, and in particular, abstracting n-dimensional geometric space.

2. Peter Watt's novel "Blindsight". Blindsight has a very different mathematical feel to it, compared to DFW's stories. It's almost the opposite. Very sloppy (stylistically, not in terms of accuracy), filled with jargon, and always slightly outside the limits of my comprehension, (actually a lot of times just plain outside the limits of my comprehension). But that layer of overwhelming, rapid-fire technical description ends up creating this very interesting, frenetic, cyberpunk/dystopian aesthetic, as the plot builds momentum.

Honorable Mentions/Other stuff:

- Watt's "Echopraxia" (sequel to Blindsight)

- Neal Stephenson's "Anathem"

- Arthur C. Clarke "Rendesvous with Rama"

- Greg Egan's "Permutation city" and "Diaspora"


- Philip Beesley's Hylozoic Soil installations (my advisor in uni!)

- All of Junya Ishigami's installations/architecture.

- All of Rafael Moneo's buildings & writings.

This is the most interesting Ask HN I've seen in some time, but I'm afraid I have no good answer to it. I don't listen to Bach, I listen to absolute trash dance music while programming, and lately the pandemic has seemingly killed my desire to read fiction. I have no idea why.

I have occasionally wondered about writing a programming language optimised for spoken word; not just the basics of trying to avoid sigils and punctuation, and of course significant whitespace, but also trying to make it possible to write code that has "metre" and rhyme to it.

I have had a strange intellectual interest in the "human-language-likeness" of programming languages for a long time. (In a way, I suppose it is the core of my original question.) Which existing languages seem to be closest to that "metre and rhyme" point in your opinion? Lisp, Forth, Perl, Rebol?

I found an interesting recent discussion on Lambda the Ultimate about human cognition, coding, and programming language syntax:


The MIT neuroscience research that this LtU thread refers to was also discussed on HN:


And another HN thread on perceiving code vs written word:


> Which existing languages seem to be closest to that "metre and rhyme" point in your opinion? Lisp, Forth, Perl, Rebol?

Perl can be close to this, and Larry Wall was fond of this aspect of the language, but it's also one of the most sigil-infested languages that isn't APL. APL itself stands proudly at the other end of the spectrum, for pure mathematicians.

Lisp has the problem that brackets aren't readily pronouncable and deeply-nested clauses aren't idiomatic English. Although I have noticed that programmers are far more likely to speak English with nested clauses than non-programmers.

Forth relies too heavily on the stack for my taste; ideally for me languages specify the variables they operate on by name, although an English-like language could clearly use "it" in the way that Perl uses "$_".

Rebol, like LOGO, is clearly Lisp with square brackets. Tcl is another candidate in this area that I have a soft spot for, but its reliance on string operations means it needs escape characters a lot.

Ironically I think the closest may be COBOL and its predecessor, Grace Hopper's FLOW-MATIC. These languages "correctly" end statements with a full stop "." rather than the unnatural semicolon ";" or the invisible newline. The problem is that COBOL pre-dates structured programming and object orientation by a long way. I don't think attempting to adapt them directly would be a good idea, but building something with some of the same principles might work.

For what it's worth, the following three stories/novels have that effect on me. There's something about them that seems surreal and foreign, a little magical.

- The Machine Stops, E.M. Forster

- Erewhon, Samuel Butler

- The Alchemist, Paulo Coelho

The styles and formats are completely different. The only common thing I can think of is that there's this invisible guiding force in all of them, whether it's good or bad. The Machine Stops is a dystopia about technology in absence of a soulful humanity. Erewhon is wild. Truly wild. It has to be a genre all its own, something akin to Darwinian technopunk. The Alchemist is probably one of those novels you could riff on with a yoga instructor and have a good conversation :joy:. It's classical magical surrealism, but it's a good story about a person's lifetime journey. Nothing deep, but it's wholesome.

Edit: also will add A Canticle for Leibowitz by Walter Miller Jr., and Titus Groan by Mervyn Peake.

I can recommend anything by the Argentine author Jorge Luis Borges. He's primarily an author of short stories. Of those, The Library of Babel is how I was introduced to him.

There's a cool programming project already based on this short story that I've enjoyed exploring: see https://libraryofbabel.info/

And looks like there's a link to the story on archive.org: https://archive.org/details/TheLibraryOfBabel/

White Light by Rudy Rucker illustrates set theory in a way I found very inspirational.

You might be thinking of nonfiction, particularly nonfiction about programming.

I think I'm most interested in works with a clearly mathematical, complex, multi-layered structure or language usage. Like the experiments of Georges Perec [1], for example.

I wonder how would reading this kind of stuff actually stimulate our brain, as compared to solving coding or maths puzzles.

E.g. the book linked above, Perec's "Life: A User's Manual", was "heartly recommended" by Don Knuth [2].

1: https://en.wikipedia.org/wiki/Life:_A_User%27s_Manual

2: https://www-cs-faculty.stanford.edu/~knuth/retd.html

People such as yourself get a hard-on about Godel, Escher, Bach. Myself? If I want to learn about basic number theory and recursion, I'll google it. Verbosity is an existential threat.

GEB is pretty dense. Comparing GEB to short stories by Borges, I feel like Borges is able to capture the same ideas (recursion, infinite permutations) in a more engaging way and at a fraction of GEB's length.

Or... just read about fixed point recursion. It's hard enough hitting a nail on the head, much more so when you've limited yourself to a socket wrench for its "abstract, literary" qualities.

This is anecdotal, can't find the reference, but I think Hofstadter himself later considered "I Am a Strange Loop" (2007, a mere 412 pages) a better explanation of the ideas he had laid out in GEB.

> Verbosity is an existential threat.

.. maybe I likes the verbosity?

Asteroids are an existential threat. Verbosity is a style that some people enjoy.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact