Bill Allombert on Sun, 20 Jul 2025 15:57:42 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: question on encapsulating format for a gp pari function
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: question on encapsulating format for a gp pari function
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Sun, 20 Jul 2025 15:57:39 +0200
- Delivery-date: Sun, 20 Jul 2025 15:57:43 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr; s=2022; t=1753019860; bh=wO/C4SHrvJ5AnSwbjPNMV311+fLyUU0iNEdqsq+FlDc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=KubaDOEiwE8zQzpzJ6AM23T2HSh5L+hVLPTB1IhJSmBPrZq1UpeHLd/em98+8BN2+ LgrAUNVxxTvwI4Fra3djulGHyh/Vj7/FhPzt4SUtw2p5767xE35OB7hL35vlDPOW2I AI4cmbBi52pci097lODkhPMgoOEISP4P7F5pUYIvbMoZbG0MYKoVqLv0shP2woltys zJ/VGc2RLKRoUnfjWsrveaLYcIKW9edQjy7vsHf6GtVqdPGUlTyAHFWmCZ8f8rzo/N Obj7Yv1SkJt8yeWcuq26rARJ0lkLC8TOT5mkuwDbIdjfHpYDO1n4G4tiu41bxZnY6a UnR7aiq+5DHL8RlrPaJNEvOEkl9XSPA2Sxne+GQ6EulsK3k3oyYqUllHiLfISR7iaq 7fCWzLVImDeWkSrCCO6ICQI2lhqxKnMxmnGS5MezQnjzO16fyTi2diMZVdOLO/BC+Z GV67dUGOQb2CILf89ahsmhBH25sSqTsl7B1V93cBH0WY939W6Q2SiOTQXL1m0CXsFG yUINxCLmEY4TMsuPzn+vT8FJqZy0Runrr307UxtOihPa/DXgvfA85Nev+6GqrOXJC+ 8eyjzC6EOh19M4nmQIGjzqnYGnTkMpcwd3OtvmLMIBOYkXDtozt5XIGI9DkaD0pY0e hTFLx6zzvKSJv2QDBZyiK4sQ=
- In-reply-to: <447f827e-83fc-48c1-a5a5-7c6e36e89321@gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <447f827e-83fc-48c1-a5a5-7c6e36e89321@gmail.com>
On Mon, Jun 30, 2025 at 09:14:03AM -0700, American Citizen wrote:
> Hello:
> I write my gp pari functions as like this
>
> {fun(a)=
> my(b);
> b=a;
> return(b);
> }
>
> But recently I noticed that someone who I highly respect writes in this way.
> fun(a)=
> {
> my(b);
> b=a;
> return(b);
> }
>
> What is the preferred way of doing this? Is the second to allow the function
> signatures to be visible?
As far as GP is concerned this is equivalent, since GP ignore spaces.
The second form is more modern-looking.
In general we omit return(), which is not necessary.
We provide a tutorial covering this topic:
https://pari.math.u-bordeaux.fr/Events/PARI2019b/talks/prog.pdf
Very old GP scripts (for PARI 1.39.15) were written this way
{fun(a,
b)=
b=a;
b;
}
because local() did not exist yet.
Cheers,
Bill.