Skip to content

Instantly share code, notes, and snippets.

@floere
Created March 17, 2010 21:37
Show Gist options
  • Save floere/335738 to your computer and use it in GitHub Desktop.
Save floere/335738 to your computer and use it in GitHub Desktop.
matrix = lambda { |x| lambda { |y| x*y**2 }}
p matrix[-3][-10] #=> -300
p matrix[0][0] #=> 0
p matrix[3][4] #=> 48
p matrix[10][20] #=> 4000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment