Created
October 8, 2012 16:27
-
-
Save jeremywrowe/3853416 to your computer and use it in GitHub Desktop.
id-tap-that-3
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
def top_three_scores | |
[2,1,4,3].tap{|a| a.sort! }.tap{|a| a.reverse! }.tap{|a| a.select!{|s| s > 1}} # => [4,3,2] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Isn't that the same as without tap?
[2,1,4,3].sort!.reverse!.select!{|s| s > 1} # => [4,3,2]