Generating Church Numbers with Haskell, Clojure, OCaml, StandardML

Sat, 07 Mar 2009 02:32:04 +0000

A few further implementations, which are rather boring, since made using functional languages.

Haskell (Thanks to Rincewind and Lambdabot):

let church = (foldl (.) id .) . replicate


(defn churchZero [y] (fn [x] x))
(defn churchSucc [n] (fn [f] (fn [x] (f ((n f) x)))))
(defn getChurchNumber [n]
 (loop [i n, r churchZero]
  (if (= i 0) r (recur (- i 1) (churchSucc r)))))
(((getChurchNumber 10) inc) 0)

OCaml (Thanks to m^3, posted in a former comment):

type Church = {C : 'a.('a -> 'a) -> ('a -> 'a)};;

let  zero = {C = fun f x -> x};;
let  succ n = {C = fun f x -> f (n.C f x)};;


fun churchZero y = fn x => x;
fun churchSucc n f x = f (n(f)(x));
fun getChurchNumber 0 = churchZero | getChurchNumber n = churchSucc(getChurchNumber (n-1));
getChurchNumber 10 inc 0;

I’d be interested in an Implementation especially in Perl and XSLT if possible. Also in PostScript, it should be possible, iirc. If someone can do that, please do it.


Boss of the week: Super Mario World – Bowser

Sat, 07 Mar 2009 02:18:23 +0000

He had to come someday: Bowser! The main enemy of Mario, being a character in almost as many games as Mario himself. Here in its form in Super Mario World. (I first wanted Super Mario 64, but I think its hard to make a Video really showing the Boss to someone who doesnt already know it – and I didnt find one.)

I think the game Super Mario World kind of belongs to background education meanwhile. Anyone should have played it at least once, it is basic historical knowledge in my opinion.

Bowser sits inside some … sort of helicopter with a clown face … throwing mechanic enemies and huge balls at Mario. Mario must defeat him by throwing these mechanic enemies back at Bowser. In the mean time, Princess Toadstool appears out of the helicopter throwing a mushroom. Some flames appear.

On the whole, it is a quite strange boss for a Mario game. I actually didnt see this form of Bowser in other Mario Games except Super Mario RPG.

The following video was – as the many times before – not made by me. I just found it on youtube. It lacks of quality, but was the best I could find which mainly shows this boss. Enjoy!