Hacker News story: Ask HN: Reversible function definitions

Ask HN: Reversible function definitions
What do computer scientists call a function that allows inference of transformations between two data types from a single definition, and does any language support this and explicit calls or implicit conversions? function convert (rad_t) phi = pi/180 * (deg_t) phi rad_t alpha = convert((deg_t) 45) //explicit deg_t beta = pi/4 + alpha //implicit rad_t and deg_t might be together in a typeclass archs or sumsuch. 0 comments on Hacker News.
What do computer scientists call a function that allows inference of transformations between two data types from a single definition, and does any language support this and explicit calls or implicit conversions? function convert (rad_t) phi = pi/180 * (deg_t) phi rad_t alpha = convert((deg_t) 45) //explicit deg_t beta = pi/4 + alpha //implicit rad_t and deg_t might be together in a typeclass archs or sumsuch.

Hacker News story: Ask HN: Reversible function definitions Hacker News story: Ask HN: Reversible function definitions Reviewed by Tha Kur on October 31, 2017 Rating: 5

No comments:

Powered by Blogger.