Jason Priestley
05/09/2019, 6:54 PMCharlie
05/09/2019, 9:19 PMNiko Autio
05/09/2019, 9:27 PMNiko Autio
05/09/2019, 9:53 PMf1 = a => a + 1
f2 = a => f1(a) * 2
f2(0) -> 2
Now let's change implementation of f1:
f1 = a, b => a + b + 1
f2 wont need to be changed but it now must be called with 2 arguments:
f2(0,1) -> 4
Note that this is essentially pretty much the same as (I don't remember the term):
f2 = a, b =>
f1 = c => c + 1
f1(a,b) * 2
Differences basicly is that f1 is not strictly limited to be used only inside f2.
Implicit returns example:
f1 = a => (a + 1, 'Called with ' + a)
f2 = a => f1(a) * 2
f2(0) -> (2, 'Called with 0')
So f1 is returning "unhandled data" (kind of log in this case) which is then passed up.Niko Autio
05/09/2019, 10:20 PMNiko Autio
05/09/2019, 10:29 PMNiko Autio
05/09/2019, 10:44 PMNick Smith
05/09/2019, 11:02 PMNick Smith
05/09/2019, 11:04 PMNiko Autio
05/10/2019, 2:54 PMNiko Autio
05/10/2019, 3:00 PM