User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

====== Special Operator BLOCK ====== ====Syntax==== * **block** //name form''*''// → //result''*''// ====Arguments and Values==== * //name// - a //[[CL:Glossary:symbol]]//. * //form// - a //[[CL:Glossary:form]]//. * //results// - the //[[CL:Glossary:value|values]]// of the //[[CL:Glossary:form|forms]]// if a //[[CL:Glossary:normal return]]// occurs, or else, if an //[[CL:Glossary:explicit return]]// occurs, the //[[CL:Glossary:value|values]]// that were transferred. ====Description==== **block** //[[CL:Glossary:establish|establishes]]// a //[[CL:Glossary:block]]// named //name// and then evaluates //forms// as an //[[CL:Glossary:implicit progn]]//. The //[[CL:Glossary:special operator|special operators]]// **block** and **[[CL:Special Operators:return-from]]** work together to provide a structured, lexical, non-local exit facility. At any point lexically contained within //[[CL:Glossary:form|forms]]//, **[[CL:Special Operators:return-from]]** can be used with the given //name// to return control and values from the **block** //[[CL:Glossary:form]]//, except when an intervening //[[CL:Glossary:block]]// with the same name has been //[[CL:Glossary:establish|established]]//, in which case the outer //[[CL:Glossary:block]]// is shadowed by the inner one. The //[[CL:Glossary:block]]// named //[[CL:Glossary:name]]// has //[[CL:Glossary:lexical scope]]// and //[[CL:Glossary:dynamic extent]]//. Once established, a //[[CL:Glossary:block]]// may only be exited once, whether by //[[CL:Glossary:normal return]]// or //[[CL:Glossary:explicit return]]//. ====Examples==== <blockquote> (block empty) <r>NIL </r> (block whocares ([[CL:Functions:values]] 1 2) ([[CL:Functions:values]] 3 4)) <r>3 4 </r> ([[CL:Special Operators:let]] ((x 1)) (block stop ([[CL:Macros:setf]] x 2) ([[CL:Special Operators:return-from]] stop) ([[CL:Macros:setf]] x 3)) x) <r>2 </r> (block early ([[CL:Special Operators:return-from]] early ([[CL:Functions:values]] 1 2)) ([[CL:Functions:values]] 3 4)) <r>1 2 </r> (block outer (block inner ([[CL:Special Operators:return-from]] outer 1)) 2) <r>1 </r> (block twin (block twin ([[CL:Special Operators:return-from]] twin 1)) 2) <r>2</r> </blockquote> In the below example, we contrast **block** behavior with corresponding example of **[[CL:Special Operators:catch]]**. <blockquote> (block b ([[CL:Special Operators:flet]] ((b1 () ([[CL:Special Operators:return-from]] b 1))) (block b (b1) ([[CL:Functions:print]] 'unreachable)) 2)) <r>1 </r> </blockquote> ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== * **[[CL:Macros:return|Macro RETURN]]** * **[[CL:Special Operators:return-from|Special Operator RETURN-FROM]]** * {\secref\Evaluation} ====Notes==== None.