I have been playing with the idea of adding a call-with-current-continuation primitive (`callcc`

) to the Cat language. The type would be:

callcc : ('A ('A ('A -> 'B) -> 'B) -> 'B)

The formal semantics would be:

[$A [$B] callcc $C] == [$A [$C] $B]

An example usage would be:

>> define do_twice { dup [apply] dip apply }
>> define test { 1 [do_twice] callcc inc }
>> test
stack: 3

My questions are: am I doing this right? Does the type look correct? Is it a good idea to add continuations to Cat? Thanks in advance!

## Recent comments

6 hours 35 min ago

6 hours 46 min ago

1 day 12 hours ago

6 days 19 hours ago

1 week 1 day ago

2 weeks 5 days ago

3 weeks 4 days ago

4 weeks 4 days ago

6 weeks 2 days ago

6 weeks 5 days ago