Can any case of using call/cc be rewritten equivalently without using it?
For example
In
(g (call/cc f)), is the purpose offto evaluate the value of someexpression, so thatgcan be applied to the value?Is
(g (call/cc f))always able to be rewritten equivalently withoutcall/cce.g.(g expression)?In
((call/cc f) arg), is the purpose offto evaluate the definition of some functiong, so that functiongcan be applied to the value ofarg?Is
((call/cc f) arg)always able to be rewritten equivalently withoutcall/cce.g.(g arg)?
If the answers are yes, why do we need to use call/cc?
I am trying to understand the purpose of using call/cc, by contrasting it to not using it.
Of course anything that is written with
call/cccan be written without it, because everything in Scheme is ultimately written usinglambda. You usecall/ccbecause it is more convenient than writing the equivalent expression usinglambda.