From f9f8b1cc48212450fd200cc517b8f9ed932e1cb9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 1 Jan 2021 12:11:00 -0800 Subject: New macro: prog2 * eval.c (prog2_s): New symbol variable. (me_prog2): New macro expander function. (eval_init): Initialize prog2_s variable with interned symbol. Register prog2 macro expander. * txr.1: Maintain the documentation for progn and prog1, improving the wording and adding a dialect note . Document prog2. --- txr.1 | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 3ce278ac..c3aac32a 100644 --- a/txr.1 +++ b/txr.1 @@ -15085,16 +15085,20 @@ share any portion of the environment at any level of nesting. .desc The .code progn -operator evaluates forms in order, and returns the value -of the last form. The return value of the form +operator evaluates each +.meta form +in in left-to-right order, and returns the value +of the last form. The value of the form .code (progn) is .codn nil . The .code prog1 -operator evaluates forms in order, and returns the value -of the first form. The return value of the form +operator evaluates each +.meta form +in left-to-right order, and returns the value +of the first form. The value of the form .code (prog1) is .codn nil . @@ -15106,6 +15110,43 @@ of a body of forms, the value of the last of which is returned. These operators are said to feature an implicit .codn progn . +.TP* "Dialect Note:" +In ANSI Common Lisp, +.code prog1 +requires at least one argument. + +.coNP Macro @ prog2 +.synb +.mets (prog2 << form *) +.syne +.desc +The +.code prog2 +evaluates each +.meta form +in left-to-right order. The value is that of the second form, if present, +otherwise it is +.codn nil . + +The form +.code "(prog2 1 2 3)" +yields +.codn 2 . +The value of +.code "(prog2 1 2)" +is also +.codn 2 ; +.code "(prog2 1)" +and +.code "(prog2)" +yield +.codn nil . + +.TP* "Dialect Note:" +In ANSI Common Lisp, +.code prog2 +requires at least two arguments. + .coNP Operator @ cond .synb .mets (cond >> {( test << form *)}*) -- cgit v1.2.3