From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,T_FUZZY_SPRM autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24274 invoked from network); 13 Nov 2021 18:47:24 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2021 18:47:24 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 59B649BDAE; Sun, 14 Nov 2021 04:47:15 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id B6CE99BA47; Sun, 14 Nov 2021 04:46:16 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=dartmouth.edu header.i=@dartmouth.edu header.b="ttMH4fsq"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 74E019BA47; Sun, 14 Nov 2021 04:46:13 +1000 (AEST) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by minnie.tuhs.org (Postfix) with ESMTPS id 1791D9BA42 for ; Sun, 14 Nov 2021 04:46:12 +1000 (AEST) Received: by mail-wm1-f50.google.com with SMTP id y84-20020a1c7d57000000b00330cb84834fso12466948wmc.2 for ; Sat, 13 Nov 2021 10:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dartmouth.edu; s=google1; h=mime-version:from:date:message-id:subject:to; bh=c0stHujDX1K92CjBcDpaLBqDLhKI+rGBgBVMHU28qtk=; b=ttMH4fsqf9IjmguznZJIPiYN87lgRCBqYPPDlcDbqSsLwUwSyzvdzGBrHwzzKZ1Tl9 ItRKFHhqK6Du5fY5i/XwjuqVxDazC0zSObLk5nKAZzKCvx73XYDyQM3FJEQ+FUgmN3GI 6Lgpw49D0sgtUVwltM0pxiV5lXpiysaVxyZ8JoiU/5hVVnMB6uI8myME1Sg7TWLNUUci AkczxmLX2WGoRAOs0FUgj2D2WdfyNzAmJcnbmjtwAIG7POvbd5OZEVFOEitD9aR02v54 VFic55BZAguYpTdLBMSEftRn9NOQEZG+OxnHyBrC8161GqUn8B8JdGRiQ5YbPjc8PWit 9G4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=c0stHujDX1K92CjBcDpaLBqDLhKI+rGBgBVMHU28qtk=; b=P8oNaKuwGRI3Gjcqw1ZtPNIiCOYLfYXNkklL7wUqUyPVJh3Vn9YFeVkEeLat1xM/uy 9D97SQcrNNQaqyQ5tfP04Cd95zZ8QJtPOgI052IpNv5jfXIMC1NR9/c/fP6UD7quCZHY aoL0o799213wqeLLPokFEgrmHXMZfTK1U3KUhcFLwNAORYuUOYv+2LYBoK8MseMYKD3H k9ibFKwfOJrk+LvXJcn72atlTpqGst5JGgDaoBAhLkBBMQ8Qr48u5CRrDrXiGpKMs/E2 7PdWz23UwVyQ7bymDWNx9drQKYNWCRJsx52vDSnpWTWOcBllfuO3Laxkk3nrL7TfJxQO /kmA== X-Gm-Message-State: AOAM5328WazdVrdUaHZ+4+6gS4I5JMdItHz0ewGrnpu34jOt6dPsLpNg zNyI4WvDeFVtG3r3W4YSBW777OqkUgxFErn2q8Q6DcbKzeI6Tg== X-Google-Smtp-Source: ABdhPJxJZ/GQksonVyMPaD6IIXmz4fcHJQOtGQQif05e+vxSQnBo9nnHsgRrjxZu1ldWrbn1TTwCb94b468rYDTeBLI= X-Received: by 2002:a05:600c:4982:: with SMTP id h2mr28213406wmp.4.1636829170152; Sat, 13 Nov 2021 10:46:10 -0800 (PST) MIME-Version: 1.0 From: Douglas McIlroy Date: Sat, 13 Nov 2021 13:45:54 -0500 Message-ID: To: TUHS main list Content-Type: text/plain; charset="UTF-8" Subject: Re: [TUHS] macro returning a value? X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" > Is there a trick to make a macro or string return a value? I know what you mean. Though a string does return a value, it can't compute an arithmetic result. Alternatively, a macro, which can use arithmetic, can only return the result as a distinct input line. (That might be overcome by a trick with \c, but I don't see one right off.) Though I have no useful advice about this dilemma, it does spur memories. I wrote the pre-Unix roff that was reimplemented on Unix and then superseded by Joe Ossanna's nroff. Joe introduced macros. Curiously, I had implemented macros in an assembler so early on (1959) that I have (incorrectly) been cited as the father of macros, yet it never occurred to me to put them in roff. Joe's work inspired me to add macros to pre-Unix roff. I did one thing differently. A macro could be called the usual way or it could be called inline like an nroff string. The only difference was that a macro's final newline was omitted when it was expanded inline. That implementation might have helped with the dilemma. Doug