Slide V08_page 33_Continuations example

vikumar
Neuling
Neuling
Beiträge: 4
Registriert: 16. Mai 2016 16:07

Slide V08_page 33_Continuations example

Beitrag von vikumar » 3. Mär 2017 12:26

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.

MrGumby
Mausschubser
Mausschubser
Beiträge: 65
Registriert: 16. Apr 2013 15:07

Re: Slide V08_page 33_Continuations example

Beitrag von MrGumby » 3. Mär 2017 16:29

I think it doesn't at all. At least I wrote in my slides, that the result is just 'done'.

vikumar
Neuling
Neuling
Beiträge: 4
Registriert: 16. Mai 2016 16:07

Re: Slide V08_page 33_Continuations example

Beitrag von vikumar » 3. Mär 2017 21:47

Thanks for the response. Could you explain your reasoning a bit.

Benutzeravatar
prabhjot
Erstie
Erstie
Beiträge: 11
Registriert: 5. Aug 2016 16:30

Re: Slide V08_page 33_Continuations example

Beitrag von prabhjot » 4. Mär 2017 14:10

"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.

Antworten

Zurück zu „Archiv“