Skip to content

Instantly share code, notes, and snippets.

@uokesita
Created October 12, 2013 03:10
Show Gist options
  • Save uokesita/6945331 to your computer and use it in GitHub Desktop.
Save uokesita/6945331 to your computer and use it in GitHub Desktop.
1.8.7 :009 > k = 1
=> 1
1.8.7 :010 > [1,2,3].map {|x| 1-(x/k).to_f }
=> [0.0, -1.0, -2.0]
# Or
1.8.7 :011 > [1,2,3].map {|x| 1.0-(x/k) }
=> [0.0, -1.0, -2.0]
1.8.7 :012 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment