lomeo: (лямбда)
Dmitry Antonyuk ([personal profile] lomeo) wrote2007-05-03 06:25 pm
Entry tags:

Натуральные числа и Нео

Тут подумал, что [livejournal.com profile] thesz в рамках

data Nat = Z | S Nat


читается как The (S Z), т.е. The One.

[identity profile] palm-mute.livejournal.com 2007-05-03 02:34 pm (UTC)(link)
Лучше так:
{-# OPTIONS -fglasgow-exts #-}
data Z = Z
data S a = S a

z = Z
s = S

the :: S Z -> ()
the _ = ()


Тогда the (s z) становится действительно избранным - другие применения функции the не компилятся (кроме the undefined, конечно)

[identity profile] lomeo.livejournal.com 2007-05-03 03:23 pm (UTC)(link)
Супер!