Skip to content

Instantly share code, notes, and snippets.

@chadochan
Created January 29, 2019 11:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Rationalize converts a list of decimal representations to their closest possible rational expressions, returning a new 2D list.
// Rationalize converts a list of decimal representations to their closest possible rational expressions,
// returning a new 2D list
Rationalize {
*new { |decimal_list|
var rational_list = List();
decimal_list.do { |item, i|
rational_list.add(item.asFraction);
};
^rational_list
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment