"functionalize" and "defunctionalize" source code
Just an idea that came up in a discussion: It would be nice if the IDE could show "variations" of source code, where "variations" mean some refactoring that transform source code to other programming styles.
An example:
The functional code in the first place is replaced with some imperative code, that does the same thing.
An example:
def sum(xs: List[Int]) =
xs.foldLeft(0)(_+_)
// this could be transformed to
def sum(xs: List[Int]) = {
var ret = 0
for (x <- xs) ret += x
ret
}
The functional code in the first place is replaced with some imperative code, that does the same thing.
Leave a comment