Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

wow fizbuz

Name: Anonymous 2015-04-27 1:55

the programming reddit is still talking about fizzbuzz

how fucking miserable is the programming scene?

Name: Anonymous 2015-04-29 13:49

Start with the following generalization

data Q a b
= L a
| R b
| B a b


For which Q `Fizz `Buzz records the original data type from >>3

(note, I'm using ` to lift an ADT from the value to type level, this is a new GHC extensions called data primes which makes haskell closer to a research language)

Now following the work of Hutton and Wouter let's invert this statagorically to emephor it into using category theoretic idioms:

Q "=" Mu (KEEP :& DROP :+ DROP :& KEEP :+ KEEP :& KEEP)

There are a few things happening here that deserve some explanation. First of all Mu is the recursive endotensor which GHC pushes deeper into the functor.

+ and & are the usual sums and products which we know are bifunctors. This gives us a true functorial description of fizzbuzz once and for all. Furthermore, it's possible to do this generalically for any number of "buzzes" in a dependently typed language.

Once agains we've seen that haskell is the nothing of thing-in-itself which enables truly abstract mathematical thought and programing to blend beautifully!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List