30 January 2007

Erlang fizzbuzzery: Project Euler Problem 1

Another excercise in solving a simple problem using multiple programming idioms in the same language, Erlang. This time the simple problem is Problem 1 from Project Euler: "If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000." In particular, the solutions presented are (1) a simple single-function loop which uses if to check for termination and matching numbers, (2) a simple loop using Erlang's guard syntax, and (3) a few solutions using some of the functions of the lists module, one using Erlang's list comprehension syntax.

[More]

25 January 2007

Erlang fizzbuzzery

Herein, a few different ways of implementing "a" solution to the FizzBuzz problem, showing examples of some different programming styles in Erlang solving the same problem.

[More]

23 January 2007

Erlang example: "parallel primes"

The code for this example is fairly simplistic and does many things wrong. Nevertheless it does provide some examples of several Erlang constructs. Hopefully this little example is self-explanatory enough to be useful on its own for now, but I hope to now add some commentary as to its construction and flaws. First, it is obviously by far not a good way to generate a list of primes. The point is not to generate primes well, but to demonstrate, using a fairly easy-to-understand problem domain, how one might write a simple program that (1) spawns a set of worker processes to operate upon work items from a queue, (2) accumulate results from their work in an accumulation process, and (3) retrieve those results.

[More]

07 October 2006

More trumpet.

A long practice session with the old horn, really starting to get the range, endurance, and tone control back. Most of the rest of it (fingering, reading music) is like riding a bike, and it's fairly silly how much I still remember from the old days.

Some guitar work, too.

Borrowed some microphones from a friend at work to experiment with new sounds, and just in time as the MOTU finally arrived -- missing all of the advertised audio cables, but I guess that is par for the course when buying used off of eBay. But wow, what a difference in sound when I plugged the MOTU in -- I guess that's what people are talking about when they say that your A/D converters matter, because it was not much short of an amazing difference.

I still don't understand sampling rates, sample size, and most of the driver settings. But hey, that's what a copious amount of free time is for... [More]

02 October 2006

Dusting off the trumpet.

Practice time today was on the trumpet. Apparently the last time I played it, I thought that I would be picking it back up soon, because I left it half-covered with fingerprints. But that doesn't hurt the sound. Anyway, as I suspected it is mostly my range and endurance which are still the most hurt -- it's actually fairly interesting how much I still remember. Some more practice and I should be back up to snuff enough to get through any bits I come up with for the album. [More]