Created
July 12, 2011 22:34
Revisions
-
Villane created this gist
Jul 12, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ // apply the function 'f' twice to the parameter 'n' def twice(n: Int, f: (Int) -> Int) = f(f(n)) // add one to the parameter def addOne(n: Int) = n + 1 // return an initial value and a function def getValueAndFunction(): (Int, myFunc: (Int) -> Int) = (1, addOne) // run twice(...) with the initial value and function from getValueAndFunction() // [] is currently used when passing a tuple directly as function parameters def main() = twice[ getValueAndFunction() ]