http://qs321.pair.com?node_id=137849

It just occurred to me that what I like most about Perl is the number of compact features and idioms that it makes available.

What originally got me hooked on Perl was its regular expressions: sure, they looked hairy to a beginner, and the more I find out about them, the hairier they look, but they're an excellent compact way of matching patterns, or pulling information out of a formatted string. What once took me 150 lines of (albiet non-optimal) C can now be done with 50 characters. Wow!

The next idiom to hit me like that was map and friends (join, grep, split, and so on). List operations that I'd originally spent dozens of lines on can now be done with just one or two. And don't get me started on the Schwartzian Transform.... Wow again!

Now I look at Perl 6, especially Apocalypse 3, and especially its hyper operators, and my hands start to twitch, and my eyes glaze a bit. And I write some Prolog, and I look at the binding operator, and the backtracking, and the other features that might make imperative Perl practical and worthwhile, and it looks even better.

This gives the impression that I really like compact, even golf-ish, constructs. I do, but that's not the point. I like being able to express myself tersely and easily, with a high ratio of semantics to syntax. (Writing featureful, functional code that makes other programmers grimace at its density is also kind of fun, of course.)

I'm sure that I've missed something: some other idiom that collapses many operations into something terse, compact, and expressive. That's one reason why I'm writing this meditation: to find out what I've missed. Another reason is to get a discussion going on compactness in Perl (and programming languages in general): do the benefits to an experienced programmer outweigh the hairiness involved? Thoughts?

--
:wq