4 ms·
Every time I see code examples for operations like these, it reminds me of how nice Ruby is as a language. The blocks are concise, non-cryptic and could even sh
by VeejayRampay 11y ago
Every time I see code examples for operations like these, it reminds me of how nice Ruby is as a language. The blocks are concise, non-cryptic and could even shortened to .map(&:twitter_handle).compact
- Mithaldu 11y agoThat applies to all dynamic languages with useful list operations, really. Have an example in Ruby's forebear language: sub twitter_handles { my ( $authors, $company ) = @_; grep defined, map $_->twitter_handle, grep $_->company eq $company, @$authors; } This free book goes into the same kind of topic, only much more deep: http://hop.perl.plover.com/ http://hop.perl.plover.com/
- gclaramunt 11y agoThat applies to all languages with useful list operations :) (I don't think dynamic has any relation)