Rationalize converts a list of decimal representations to their closest possible rational expressions, returning a new 2D list.
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
// 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