See Continuation Frames and Marks and Prompts, Delimited Continuations, and Barriers for general information about continuation marks.
The list of continuation marks for a key k and a continuation C that extends C0 is defined as follows:
If C is an empty continuation, then the mark list is null.
If C’s first frame contains a mark m for k, then the mark list for C is (cons m lst), where lst is the mark list for k in C0.
If C’s first frame does not contain a mark keyed by k, then the mark list for C is the mark list for C0.
The with-continuation-mark form installs a mark on the first frame of the current continuation (see Continuation Marks: with-continuation-mark). Procedures such as current-continuation-marks allow inspection of marks.
Whenever Racket creates an exception record for a primitive exception, it fills the continuation-marks field with the value of (current-continuation-marks), thus providing a snapshot of the continuation marks at the time of the exception.
When a continuation procedure returned by call-with-current-continuation or call-with-composable-continuation is invoked, it restores the captured continuation, and also restores the marks in the continuation’s frames to the marks that were present when call-with-current-continuation or call-with-composable-continuation was invoked.
Returns an opaque value containing the set of continuation marks for all keys in the continuation
cont(or the current continuation of
contif it is a thread) up to the prompt tagged by
prompt-tag. If
contis
#f, the resulting set of continuation marks is empty. If
contis an escape continuation (see
Prompts, Delimited Continuations, and Barriers), then the current continuation must extend
cont, or the
exn:fail:contractexception is raised. If
contwas not captured with respect to
prompt-tagand does not include a prompt for
prompt-tag, the
exn:fail:contractexception is raised. If
contis a dead thread, the result is an empty set of continuation marks.
Returns an opaque value containing the set of continuation marks for all keys in the current continuation up to prompt-tag. In other words, it produces the same value as
Returns a newly-created list containing the marks for
key-vin
mark-set, which is a set of marks returned by
current-continuation-marksor
#fas a shorthand for
(current-continuation-marks prompt-tag). The result list is truncated at the first point, if any, where continuation frames were originally separated by a prompt tagged with
prompt-tag. Producing the result takes time proportional to the size of the continuation reflected by
mark-set.
Changed in version 8.0.0.1 of package base: Changed to allow mark-set as #f.
Returns a newly-created list containing vectors of marks in
mark-setfor the keys in
key-list, up to
prompt-tag, where a
#fvalue for
mark-setis equivalent to
(current-continuation-marks prompt-tag). The length of each vector in the result list is the same as the length of
key-list, and a value in a particular vector position is the value for the corresponding key in
key-list. Values for multiple keys appear in a single vector only when the marks are for the same continuation frame in
mark-set. The
none-vargument is used for vector elements to indicate the lack of a value. Producing the result takes time proportional to the size of the continuation reflected by
mark-settimes the length of
key-list.
Changed in version 8.0.0.1 of package base: Changed to allow mark-set as #f.
Like
continuation-mark-set->list*, but instead of returning a list of values, returns a functional iterator in the form of a procedure that returns one element of the would-be list and a new iterator function for the rest of the would-be list. An iterator procedure returns
#finstead of a vector when no more elements are available; in that case, the returned iterator procedure is like the called one, producing no further values. The time required for each step is proportional to the length of
key-listtimes the size of the segment of the continuation reflected by
mark-setbetween frames that have keys in
key-list.
Added in version 7.5.0.7 of package base.
Changed in version 8.0.0.1: Changed to allow mark-set as #f.
The result is produced in (amortized) constant time. Typically, this result can be computed more quickly using continuation-mark-set-first than using continuation-mark-set->list or by using continuation-mark-set->iterator and iterating just once.
Although #f and (current-continuation-marks prompt-tag) are equivalent for mark-set, providing #f as mark-set can enable shortcuts that make it even faster.
This function could be implemented with a combination of with-continuation-mark, current-continuation-marks, and continuation-mark-set->list*, as shown below, but call-with-immediate-continuation-mark is implemented more efficiently; it inspects only the first frame of the current continuation.
The optional sym argument, if provided, is used when printing the continuation mark.
Returns a list representing an approximate “
stack trace” for
mark-set’s continuation. The list contains pairs if
realms?is
#f, where the
carof each pair contains either
#for a symbol for a procedure name, and the
cdrof each pair contains either
#for a
srclocvalue for the procedure’s source location (see
Counting Positions, Lines, and Columns); the
carand
cdrare never both
#f. If
realms?is true, the list contains 3-element vectors, where the first two elements are like the values for a pair, and the third element is a realm symbol.
Conceptually, the stack-trace list is the result of continuation-mark-set->list with mark-set and Racket’s private key for procedure-call marks. The implementation may be different, however, and the results may merely approximate the correct answer. Thus, while the result may contain useful hints to humans about the context of an expression, it is not reliable enough for programmatic use.
A stack trace is extracted from an exception and displayed by the default error display handler (see error-display-handler) for exceptions other than exn:fail:user (see raise-user-error in Raising Exceptions).
Examples:
'(mark)
'((mark1) (mark2))
'(mark2)
'((mark2 mark1))
'(1)
Changed in version 8.4.0.2 of package base: Added the realms? argument.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4