Or laid out like a sane person instead of a madman:
Or laid out like a madman afflicted with a different disorder:
sqrt = lambda n: step(prep(1,n),0,n)
prep = lambda s,n: s if s>n else prep(s<<2,n)
step = lambda s,l,r: step(*chop(s>>2,l+(s>>2),l>>1,r)) if s>1 else l
chop = lambda s,m,l,r: (s,l,r) if r<m else (s,l+s,r-m)
which (somewhat) illustrates that as far as formal methods are
concerned, the difference between imperative or functional expression
is not as important as the presence or absence of aliasing.
-Dave
cf http://www.cs.toronto.edu/~hehner/aPToP/aPToP-C.pdf
--
To unsubscribe: http://lists.canonical.org/mailman/listinfo/kragen-discuss