Created
January 9, 2009 18:15
-
-
Save bdotdub/45207 to your computer and use it in GitHub Desktop.
Comparison between perl and ruby code. Ruby wins in my book
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tuples = sort { $a->[0] <=> $b->[0] } @tuples; | |
my $dates = map { $_->[0] } @tuples; | |
my $values = map { $_->[1] } @tuples; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tuples.sort!{ |first, second| first[0] <=> second[0] } | |
dates = tuples.map{ |tuple| tuple[0] } | |
values = tuples.map{ |tuple| tuple[1] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment