;; Guile scheme (call-with-current-continuation ;; Often abbr'd to call-cc. Takes a function as arg. (lambda (fred) (+ 3 4) (do-something 42 fred) (fred 42) )) #### sub call_cc (&) { my $clause = shift; my @fake_returns; my $fake_continuation; $fake_continuation = sub { @fake_returns = @_; die $fake_continuation; }; eval { return $clause->($fake_continuation); }; if ($@) { die $@ unless $@ == $fake_continuation; return @fake_returns; } #NOTREACHED } print STDERR call_cc { my $fred = shift; $fred->(42); return 64; # NOTREACHED }; print STDERR "\n";