Prelude is a very fun language, whose source code consists of several "voices" which are executed in parallel and which I really enjoy solving problems in I really enjoy solving problems in. It is meant to be the ASCII representation of its sister language Fugue, which actually takes .midi files as its source code and encodes the instructions found in Prelude as intervals in the melodies of the voices.
This is "just" an iterative implementation of the Euclidean algorithm. But modulo in Prelude is a bit annoying, mostly because you can't easily check if a number is positive or negative. This code makes use of a signum implementation I wrote a while ago I wrote a while ago. I.e. a large part of the code just turns a number into -1, 0 or 1. This can then easily be turned into a condition for positive or negative numbers by adding or subtracting 1.
Prelude is a very fun language, whose source code consists of several "voices" which are executed in parallel and which I really enjoy solving problems in. It is meant to be the ASCII representation of its sister language Fugue, which actually takes .midi files as its source code and encodes the instructions found in Prelude as intervals in the melodies of the voices.
This is "just" an iterative implementation of the Euclidean algorithm. But modulo in Prelude is a bit annoying, mostly because you can't easily check if a number is positive or negative. This code makes use of a signum implementation I wrote a while ago. I.e. a large part of the code just turns a number into -1, 0 or 1. This can then easily be turned into a condition for positive or negative numbers by adding or subtracting 1.
Prelude is a very fun language, whose source code consists of several "voices" which are executed in parallel and which I really enjoy solving problems in. It is meant to be the ASCII representation of its sister language Fugue, which actually takes .midi files as its source code and encodes the instructions found in Prelude as intervals in the melodies of the voices.
This is "just" an iterative implementation of the Euclidean algorithm. But modulo in Prelude is a bit annoying, mostly because you can't easily check if a number is positive or negative. This code makes use of a signum implementation I wrote a while ago. I.e. a large part of the code just turns a number into -1, 0 or 1. This can then easily be turned into a condition for positive or negative numbers by adding or subtracting 1.