Ordinal Numbers and Musical Camelias


I’ve been working on an Numbers::Ordinal module for the past day or so, which turns your cardinals and turns them into ordinals! I’m writing it because I write tests, and tend to use descriptions that say “First block done” for those tests. And I know others use loops to make test-writing easier. So, this little module is born out of making test descriptions easier for those using loops in their tests, and will hopefully find more use later.

Example use:

use Test;
use Numbers::Ordinal;
for 0..9 -> $a {
    ok something($a), "{ordinal($a)} done";

&ordinal will print results such as “first”, “twenty-second”, etc. The companion &ordinal-digit will print “1st”, “22nd”, etc. I’m currently working on &ordinal, although I think &ordinal-digit will be much easier.


Every once in a while, I think about some sort of method of converting Perl 6 code into a musical tune (bear with me, I know it’s crazy). While I certainly don’t plan on working on it anytime soon, I do want to mention the idea in case anyone else out there is willing 🙂 .

I can already see some conversions. ($a + 2) xx 2 would put a repeat around whatever $a + 2 becomes. Maybe one could get away with a straight unicode->Hz conversion (we can hear as low as 20Hz, and the space character is 32 (0x20)). Who knows? It’s an interesting idea to say the least.

(oh great, now I have two ideas that require parsing of Perl 6! Fortunately, one of them could get away with stealing quietly borrowing someone else’s parser. Unfortunately, it’s the music one that can steal borrow someone’s parser)

This entry was posted in Cantina, Progress Happened and tagged , , , . Bookmark the permalink.

One Response to Ordinal Numbers and Musical Camelias

  1. Pingback: Numbers::Ordinals is here! (-ish) | Rakudo Death Star

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s