News for hackers. Stuff that matters.
Re:Is there an algorithm as beautiful as a poem? by 082349872349872 on Sunday June 16, 2024 @02:24AM (#40695059)
a moldy oldy (in the tradition of Dijkstra and Euclid):

  proc gcd(n,m): do n>m ⇒ n:=n-m ⫿ m>n ⇒ m:=m-n od; return max(n,m)
EDIT: note the different levels of abstraction: this is a program which implements a particular GCD algorithm, in a manner attempting to reflect the symmetry of the function which that algorithm calculates.

There are no comments on this comment yet.