Bill Allombert on Thu, 07 Sep 2023 20:11:39 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Questions on PARI/GP formatting
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Questions on PARI/GP formatting
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Thu, 7 Sep 2023 20:06:47 +0200
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1694110007; c=relaxed/relaxed; bh=vReNS764bRjXf5OBWTQgSeBiiyl2uopyr51vJUAh8Ao=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=Nd7dlTSFUw0oc/wyS7mi5x6ibXPPGjaVQZTxrp+Y1yb3aQDBFMATNj2yx4UPy/1ddciRMpjWk+o2coJ4XKmd7rngORF9Yx7z/4zQ9bGOb3UI0/yxhdC5/QUAqO9ZRYYniEFWnmCU6ftnANKkIcBsRUYwpJfDtOEYn2oZTv0HO6AqjNkXblk7ybCCx134BgtaL0z4p3CVGC8ndw3QjcNM90jb1o4eQVXr0U6R4Dg3hJUjKtP9hbUmW0qPeirfVl2YF+RgkSFKym/OLvhEt6naSCiwm11/94ydJ0eDkTV27wGdwfrzumdCz/66ab6iW31satJ7+9thBCGEc4fSFZUSn2pwlL9cLt5RFnSTRdGl3iLzcwwtRWr00vdW+tHyg578lpEaCU6stOYI2Zx5RVyIEavHH7Pl0VPFvbj82NK22Y+Dq2Kd2rpMgRhZrKQxZ3gGqcRWEQK5xBTIEVS4z9CuAViQFcE9qbu7Rbo36d62oEAzLg9TRhlq40GvzhWV93tZ9KnZlTAB01eVrQBgVf2BxRGdbb3HD91mhGfbeRxhpR33zKbBmjdgjfg3E/1SoYJ73OoxXZkGhGPfAO1Mxw6ju8mPeXXpHsWgRh1xHlPA71LD/liUMd9B/O8HQfKv3u+4yuIOKfSEW9gbnBNsYUT1Rf40jZk17A3PhyZ+BJmqmc4=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1694110007; cv=none; b=I7cFbmbI2fnJBAH11C/XrFsAWanoMSeaUPZ1hGz8AsftHRDLowXtHLjz91LKVv5qxxLp1F+yOntkzRnAUWv/aqyNsP+FQCKhXrrZ7REKgtdyz5v9gGvRmoYSfSE7Rs2sFmZfx7Hcim9TPUb9om+LohTXURo9iO2vKY9RPTtpgsgDNjWcZg4LYt0N6O66ejEcmd4UfYHn8hzG6B+bTA89/v+RMZlfwl4ZXkNAeL1DYEMr7n+BnDPy6A75lUCerl6g5aDIjDYxNzH1FJSSijUJu75wxJTmtBlO1ryBEACmjH0qTGX1X7gb55u3X4+/GwyyiLBEjlUhE0J+a7qOQy1IJLMF7gDlMPX5OPL0Vz2jaaU3SGRrzEhACYVXUZfRbibUoueTcGGCE3qmzR+CfUreS9LyCN0BZ/3GICFI/9QfGXKoPXK9wG/D/HvtHx1LfWCblhYBGUdQl2qlptsdv6/JBIRDfJRoCvWUSe8A4SynNqDUnTrq0oOlUYHTLjccMs4L5oK2iotbjx7nlTLERptpoj2o1rh3iH94vFcQcBrpIwfgYfKMWrWm5Mg5YuMBbrbFLCmYJfTMwmwjH48noEnABgKdB6Z5qgNIuYxAKMXcXjvozXNg/NAWrpsxboKwcnc19ESmDl90wjGAAAjG+4J01X7CiHjtTRh+QVwrbNvLWjQ=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Thu, 07 Sep 2023 20:11:39 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1694110007; bh=vReNS764bRjXf5OBWTQgSeBiiyl2uopyr51vJUAh8Ao=; h=Date:From:To:Subject:References:In-Reply-To:From; b=EcqWBNhPClbeQri7lCwiSsXg5rb3APQd/GoOHBZPNQ3eMMMUEwTojSCauBue8u9l3 Y5ZXZPPkMqTjCNBeh5geK4sAt3iLm0m5fQ9GCrMnCMUNXt7kcc0UEDHXAL47omX+V/ Blij74R2+j8wU90Q953QM0r0lpHibPLJvPZTJiu+h6vZK5JIb7Ac6oMRX/gBlZ6gBl vT+3kOkaVPVYHGf8WI9V97gL7gc1xNjte9mqBROw0dCscqDtEjQAds2Z1sok+jVxH8 +RmMUp2SzRp1exLZiaQ9vaLYkUUrG02adxUXo2aahtrPGLO+1ViDsNTXCuBzDEkiL6 kOVil4U6cJzd9urbd7hWBBtuhG/YBpTDuioAKSR3hgl8O46UAlz78Ze5Gmav5CdQje gB6lB0Enf6/AIuJuUoMAzjpsIeredqsKZBZBfaIrHmeo579HDj1BOm9jJyQkeVII3E bJC6wwchtsOXmfmFYwQ8NnzNYkqFaIkW5xKtrJNkQcr1kwNDLX6nlqtRMxxJgRCxhB F5ubhhZa8P0rLKH61xszRR+G9MFDfp9/BbJiiwFuIye9vQPXWV0PJAO6u/Hf+q05b4 bOFwZ2eYgeVOll1A85rYb7ESUl21vLlsDCvrcGkC1iZHoF6NywuAn2fVu6ER0tZQT8 G0PXKlvq4pCf4Cw/PRNSsDv4=
- In-reply-to: <97e83bd6819e75dedb0eb1776f7fd60d@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <3357699e64c1e16204299ca9cd4da775@stamm-wilbrandt.de> <ZPdVvMtiqcMzgck1@seventeen> <97e83bd6819e75dedb0eb1776f7fd60d@stamm-wilbrandt.de>
On Tue, Sep 05, 2023 at 09:24:02PM +0200, hermann@stamm-wilbrandt.de wrote:
> On 2023-09-05 18:22, Bill Allombert wrote:
> > We offer this tutorial:
> >
> > <https://pari.math.u-bordeaux.fr/Events/PARI2019b/talks/prog.pdf>
> >
> Thanks, looks good.
>
> > > I added whitespace where it helped me, but overall it is not
> > > consistent.
> > > Are there best practices wrt GP optional whitespace use?
> > >
> Examples seem to indicate mostly not to use optional whitespace.
GP ignores whitespaces anyway, so feel free to pick the whitespace
policy you prefer.
> > > I use "break", should it be "break()" instead?
> >
> > Yes, because break has an optional argument.
> >
> I added "()" to my script breaks -- tutorial example on page 8 misses "()"
> as well.
I did that due to vertical space constraint (I would have needed to add a
newline to avoid the difficult to read 'break()));' ).
> I changed my gist, should now look mostly like the examples in tutorial:
> https://gist.github.com/Hermann-SW/50514eaf06b4d91ec6bcee5e49732dff
>
>
> Few followup questions:
>
> 1)
> I cannot put "my()" in first line of function, because in some cases need to
> break() before.
> Is that OK?
Sure.
> 2)
> Multi assignment seems to work in "my()", is that OK?
> ...
> test(v)=
> {
> if(#v<4,
> break());
> my([l,n,p,q]=v,pnr,qnr,sqrtm1);
> ...
Sure.
> 3)
> Variable "n" is not used, but needed for multi assignment to work.
> Are there anonymous variables to indicate that?
No, but you can omit n:
my([l,,p,q]=v,pnr,qnr,sqrtm1);
> 4)
> "for*" loops work multiline only inside "{...}".
> I had to put braces around last loop calling "test()" to get multiline
> foreach working.
> Is that OK?
>
> ...
> };
>
> {
> foreach(rsa,v,
> test(v));
> }
Sure!
Cheers,
Bill