Hacker News new | past | comments | ask | show | jobs | submit login
Erlang FizzBuzz Showdown (Part 2): Transferring PHP/Ruby/Python to Erlang (joelhughes.co.uk)
10 points by rudenoise on May 14, 2009 | hide | past | favorite | 1 comment



Always had a fondness for this FizzBuzz in Perl...

    use List::Enumerator qw/E/;

    my $fizzbuzz =
        E(1)->countup
            ->zip(
                E("", "", "Fizz")->cycle,
                E("", "", "", "", "Buzz")->cycle
            )
            ->map( sub {
                my ($n, $fizz, $buzz) = @$_;
                $fizz . $buzz || $n;
            });

    $fizzbuzz->take(20)->each(sub {
        say $_;
    });




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: