From kry|ov@r00t @end|ng |rom gm@||@com  Sat Dec  5 08:27:55 2020
From: kry|ov@r00t @end|ng |rom gm@||@com (Ivan Krylov)
Date: Sat, 5 Dec 2020 10:27:55 +0300
Subject: [Rd] [External] Re:  New pipe operator
In-Reply-To: <alpine.DEB.2.21.2012042001540.3003@luke-Latitude-7480>
References: <e55c2093-0bb5-5f9b-5521-0ca8bdf35953@gmail.com>
 <CALyqOb8c1hHOSaMV+fqXTwpeOsP--KJ_t-oeqMYYafVXeNpqZg@mail.gmail.com>
 <7586e034-e287-0970-6480-f82d747b5445@gmail.com>
 <b98cf6d4-b856-2963-1882-9341384d141d@kogentum.hu>
 <alpine.DEB.2.21.2012041310130.3003@luke-Latitude-7480>
 <d03c6867-4aa8-fa82-fe98-e706994dad3a@gmail.com>
 <alpine.DEB.2.21.2012042001540.3003@luke-Latitude-7480>
Message-ID: <20201205102755.0bd0a627@Tarkus>

On Fri, 4 Dec 2020 20:11:17 -0600 (CST)
luke-tierney at uiowa.edu wrote:

> We did try a number of variations; the code is in the R-syntax branch.
> At the root of that branch are two .md files with some notes as of
> around useR20.

Thanks for the information!

Can I make a suggestion? If the variation of the pipe that allows
a symbol on the RHS to be interpreted as the name of a function to call
does get chosen, may it also allow fully-qualified symbols?

Index: src/main/gram.y
===================================================================
--- src/main/gram.y     (revision 79567)
+++ src/main/gram.y     (working copy)
@@ -1242,7 +1242,11 @@
     if (GenerateCode) {
        /* allow for symbols or lambda expressions */
        if (TYPEOF(rhs) == SYMSXP ||
-           TYPEOF(rhs) == LANGSXP && CAR(rhs) == R_FunctionSymbol)
+           TYPEOF(rhs) == LANGSXP && (
+               CAR(rhs) == R_FunctionSymbol ||
+               CAR(rhs) == R_DoubleColonSymbol ||
+               CAR(rhs) == R_TripleColonSymbol
+           ))
            return lang2(rhs, lhs);
                    
        if (TYPEOF(rhs) != LANGSXP)

Or is this feature creep?

-- 
Best regards,
Ivan

P.S. This lambda function is waving at us: \ (O,o) `/`



[Rd] [External] Re: New pipe operator
Ivan Krylov