Created
January 29, 2019 11:04
-
-
Save chadochan/8707d99317c1a43f031c24f5eac1d2da to your computer and use it in GitHub Desktop.
Rationalize converts a list of decimal representations to their closest possible rational expressions, returning a new 2D list.
This file contains hidden or 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