re: 5 Powerful Programming Languages to Stretch Your Brain VIEW POST

FULL DISCUSSION
 

That's a nice list. I'm stretching my brain with some Perl 6 programming. Perl 6 is very expressive and includes features like:

  • Object-oriented programming including generics, roles and multiple dispatch
  • Functional programming primitives, lazy and eager list evaluation, junctions, autothreading and hyperoperators (vector operators)
  • Parallelism, concurrency, and asynchrony including multi-core support
  • Definable grammars for pattern matching and generalized string processing
  • Optional and gradual typing

Here's my version of the FizzBuzz written in Perl 6:

sub fizz($i) {
  print "Fizz" if $i % 3 == 0;
  print "Buzz" if $i % 5 == 0;
  print $i unless $i % 5 | $i % 3 == 0;
  print "\n";
}

fizz($_) for 1..100;
 

My boss is a Perl developer, or at least was before he started writing Ruby, I really appreciate Perl's expressiveness. I've thought about picking it up to build some fun tools before! Thanks for including a code snippet!

 

Perl 6 (perl6.org) belongs to the same family, but it's a totally different language. Much more expressive, too.

code of conduct - report abuse