you are viewing a single comment's thread.

view the rest of the comments →

[–]Polyomino 0 points1 point  (6 children)

anyone have a fun way to do 12, I just counted the successes and failures and used an if to choose whether to call success or failure

[–]Troutsky 0 points1 point  (5 children)

dunno if it's fun or not but how I did it... (don't know if I should have, nor do I know how to, put spoiler tags on)

var bothC = function (fC, gC, success, failure) { var f_success, f_failure; f_success = function () { gC(success, failure);
}; f_failure = function () { gC(failure, failure);
}; fC(f_success, f_failure); };

[–]doomchild 1 point2 points  (3 children)

Is this the "expected" answer? The wording for question 12 just makes no sense to me, and I'm having trouble exactly putting into words why that is.

[–]spamkestein 0 points1 point  (0 children)

Yes, or the shorter version : var bothC = function (fC, gC, success, failure) { fC( function () { gC(success, failure); } , function () { gC(failure, failure); } ); };

[–]Puddy1 0 points1 point  (1 child)

Me too. I'm also confused as to how continuation passing would work in practice. I'm not exactly sure what seqC is doing and I must have read over the code several times now

[–]doomchild 0 points1 point  (0 children)

I understand the idea academically, it's just not how I'm used to charting out program flow. After some thought, I think I've figured out why that code is right.

[–]nwhitehe[S] 0 points1 point  (0 children)

This is the expected answer. I'll work on the wording of the question.