samhuri.net/posts/2007/04/funny-how-code-can-be-beautiful.md
Sami Samhuri 007b1058b6
Migrate from Swift to Ruby (#33)
Replace the Swift site generator with a Ruby and Phlex implementation.
Loads site and projects from TOML, derive site metadata from posts.

Migrate from make to bake and add standardrb and code coverage tasks.

Update CI and docs to match the new workflow, and remove unused
assets/dependencies plus obsolete tooling.
2026-02-07 21:19:03 -08:00

28 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
Title: "Funny how code can be beautiful"
Author: Sami Samhuri
Date: "30th April, 2007"
Timestamp: 2007-04-30T07:07:00-07:00
Tags: haskell
---
While reading a <a href="http://www.haskell.org/tutorial/index.html">Haskell tutorial</a> I came across the following code for defining the <a href="http://en.wikipedia.org/wiki/Fibonacci_number">Fibonacci numbers</a>:
```haskell
fib = 1 : 1 : [ a + b | (a, b) <- zip fib (tail fib) ]
```
After reading it a few times and understanding how it works I couldnt help but think how <strong>beautiful</strong> it is. I dont mean that its aesthetically pleasing to me; the beautiful part is the meaning and simplicity. Lazy evaluation is sweet.
<a href="http://www.haskell.org/">Haskell</a> is the most challenging <a href="http://en.wikipedia.org/wiki/Category:Esoteric_programming_languages"><em>real</em></a> language I have tried to wrap my head around. I havent done much with any functional languages yet but they are truly fascinating. Im beginning to understand monads[1] but Im quite sure I dont see the whole picture yet.
<a href="http://www.erlang.org/">Erlang</a> looks like it may be more suited to real world apps so I would like to learn that some time. The <a href="http://pragprog.com/">pragmatic</a> guys have a <a href="http://www.pragmaticprogrammer.com/titles/jaerlang/">book</a> on Erlang in the works, and I love every book of theirs which I have read.
Going deeper down the functional rabbit-hole youll find things like <a href="http://swik.net/Haskell/del.icio.us+tag%2Fhaskell/A+polyglot+quine+in+Haskell,+OCaml+and+Scheme/41zs">this polyglot quine</a>, which absolutely blows my mind. I used to be impressed by the <a href="http://en.wikipedia.org/wiki/Just_another_Perl_hacker">JAPH</a> sigs or some of the various <a href="http://en.wikipedia.org/wiki/Obfuscated_code">obfuscated</a> contest winners but that first one definitely cleans the rest up with a perfect 10 in geekiness.
[1] The following links have all been helpful while trying to wrap my head around monads.
* <a href="http://www.haskell.org/tutorial/monads.html">A Gentle Introduction to Haskell</a> (link is directly to chapter 9)
* <a href="http://web.cecs.pdx.edu/~antoy/Courses/TPFLP/lectures/MONADS/Noel/research/monads.html">What the hell are Monads?</a>
* <a href="http://en.wikibooks.org/wiki/Programming:Haskell_monads">Monads on WikiBooks</a>
* <a href="http://www.engr.mun.ca/~theo/Misc/haskell_and_monads.htm">Monads for the Working Haskell Programmer</a>