Write an algorithm (or app) in your favorite language of the three. Then port it to a different one of those three.
Now port to Common Lisp or Haskell, and see how your code feels different.
I find that Ruby/Python/Perl basically let you write the same program with different syntax. "$self->foo" instead of "@foo". I find that Haskell changes the way you actually program. Example: Nobody (except me) uses a type like Haskell's Error monad in Perl; they use exceptions.
(Similarly, look for a "web framework" in Perl/Python/Ruby. Perl has Catalyst. Python has Django. Ruby has Rails. They are all different, true, but the idea is the same. If three people each started the same project on those various frameworks, the end result, code-wise, would be very similar.)
sub fib() {
my $fn2 = 1;
my $fn1 = 1;
gather loop {
my $oldfn2;
($fn1, $fn2, $oldfn2) = ($fn1 + $fn2, $fn1, $fn2);
take $oldfn2;
}
}
my @g = fib;
for ^20 -> $i {
say $i, @g.shift;
}
That's untested because lazy evaluation isn't yet supported in Rakudo Perl 6, but my understanding is that feature should be up and running in the next few weeks.
I don't know enough Ruby to make heads or tails of the first example, though...
I don't consider these as being particularly interesting differences. With the right modules, I can write code that looks like that in Perl. (It's not idiomatic, though, so it is worth exploring other languages to see which idioms you'd like to steal. I stole monads and applicative functors from Haskell for Perl in MooseX::Data, for example. Monadic control flow is not a common Perl idiom, but it is perfect for my asynchronous CPAN client.)
I am talking major differences, things that are so fundamental that you can't really steal. Looking at Haskell, I see things like lazy evaluation, purity, static typing and type inference, etc. Very, very different from Perl.
In Scheme, I see the "call stack" as a graph of frames, not as a linked-list as in C. This is quite radical.
But in Ruby and Python all I see are different built-in functions, some with special syntax. (Generators, list comprehensions, etc., etc.)
I know Perl far, far better than I know Ruby or Python. But I can't easily reach for the abstractions in those examples within Perl.
I can. I hope you are considering CPAN as part of Perl, because "core perl" is a very, very outdated and broken programming language. I think I would even prefer Java!
Write an algorithm (or app) in your favorite language of the three. Then port it to a different one of those three.
Now port to Common Lisp or Haskell, and see how your code feels different.
I find that Ruby/Python/Perl basically let you write the same program with different syntax. "$self->foo" instead of "@foo". I find that Haskell changes the way you actually program. Example: Nobody (except me) uses a type like Haskell's Error monad in Perl; they use exceptions.
(Similarly, look for a "web framework" in Perl/Python/Ruby. Perl has Catalyst. Python has Django. Ruby has Rails. They are all different, true, but the idea is the same. If three people each started the same project on those various frameworks, the end result, code-wise, would be very similar.)