Seite 1 von 1

Slide V08_page 33_Continuations example

Verfasst: 3. Mär 2017 12:26
von vikumar
In the code given in the slide:

Code: Alles auswählen

println(reset {shift { k: (Int=>Int) => k(k(k(7))); "done" } + 1})
How would the instruction "done" affect the answer of the computation? I could reason the answers of other questions in the slide, but having difficulty with this one. Any help would be appreciated.

Re: Slide V08_page 33_Continuations example

Verfasst: 3. Mär 2017 16:29
von MrGumby
I think it doesn't at all. At least I wrote in my slides, that the result is just 'done'.

Re: Slide V08_page 33_Continuations example

Verfasst: 3. Mär 2017 21:47
von vikumar
Thanks for the response. Could you explain your reasoning a bit.

Re: Slide V08_page 33_Continuations example

Verfasst: 4. Mär 2017 14:10
von prabhjot
"done" being the last statement after the computation, so result evaluated till then (i.e. 10) is thrown away and just a string is returned.