Skip to content

Implement continuations #1

Open
@scribu

Description

@scribu
  (call-with-current-continuation
    (lambda (return)
      (begin
        (display "One ")
        (return #t)
        (display "Two ")
        #f)))

The lambda-expression evaluates to an anonymous function of one parameter. This anonymous function gets invoked by call-with-current-continuation and the parameter - here called return - gets bound to an escape procedure, i.e. a procedure value that encapsulates the current continuation. The function prints "One " and then returns #t without ever printing "Two " because the second display-expression is part of the abandoned continuation.

http://c2.com/cgi/wiki?CallWithCurrentContinuation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions