From 9b06aa687eac9f681086703b8696d6cb6b2761a0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 31 Jul 2017 05:44:39 -0700 Subject: Evaluate doloop forms in an implicit tagbody. This eliminates one incompatibility between doloop and ANSI CL do. * share/txr/stdlib/doloop.tl (sys:expand-doloop): Wrap body in tagbody form. * txr.1: Documentation updated. --- share/txr/stdlib/doloop.tl | 2 +- txr.1 | 32 +++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/share/txr/stdlib/doloop.tl b/share/txr/stdlib/doloop.tl index 770b7b05..9c404855 100644 --- a/share/txr/stdlib/doloop.tl +++ b/share/txr/stdlib/doloop.tl @@ -45,7 +45,7 @@ ((,(if pllel 'pset 'set) ,*(mappend (ado unless (eq @1 @3) ^(,@1 ,@3)) xvars))) - ,*body))) + (tagbody ,*body)))) (defmacro doloop (:form f vars cexp . body) (sys:expand-doloop f vars cexp body)) diff --git a/txr.1 b/txr.1 index 9e8d25f4..b9a12800 100644 --- a/txr.1 +++ b/txr.1 @@ -15370,7 +15370,7 @@ operator to be used to terminate at any point. .mets ({doloop | doloop*} .mets \ \ ({ sym | >> ( sym >> [ init-form <> [ step-form ])}*) .mets \ \ >> ([ test-form << result-form *]) -.mets \ \ << body-form *) +.mets \ \ << tagbody-form *) .syne .desc The @@ -15387,6 +15387,19 @@ Each .meta sym element in the form must be a symbol suitable for use as a variable name. +The +.metn tagbody-form -s +are placed into an implicit +.codn tagbody , +meaning that a +.meta tagbody-form +which is an integer, character or symbol is interpreted +as a +.code tagbody +label which may be the target of a control transfer via the +.code go +macro. + The .code doloop macro binds each @@ -15416,10 +15429,13 @@ If .meta test-form produces a true value, then .metn result-form -s -are not evaluated. Instead, the -.metn body-form -s -are evaluated. Next, the loop variables are updated by assigning -to each +are not evaluated. Instead, the implicit +.code tagbody +comprised of the +.metn tagbody-form -s +is evaluated. +If that evaluation terminates normally, the loop variables are +then updated by assigning to each .meta sym the value of .metn step-form . @@ -15523,12 +15539,6 @@ the ANSI CL macros do not feature the automatic replication of into the .meta step-form position. -Lastly, -.code doloop -and -.code doloop* -do not implement an implicit -.codn tagbody . .coNP Operators @ block and @ block* .synb -- cgit v1.2.3