Karim Belabas on Sun, 12 May 2024 09:56:51 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Using builtin PARI operators in gp
|
- To: Ilya Zakharevich <nospam-abuse@ilyaz.org>
- Subject: Re: Using builtin PARI operators in gp
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Sun, 12 May 2024 09:56:46 +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=1715500608; c=relaxed/relaxed; bh=QOdNfUoUj+vWqSgAKVEhzZi4X/VwyJAYW/Gevgu5uCk=; h=DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=PMKnyCw4OSJZW28mEKHgeiW+ask5DiesvlCcBZEMyvOEYEUXbZgTH39U6lwXIEGfcadFqUS+2X684ChhOUHRjY9gnC1HNtlXSEF71MBF+Sj/IX0Wz65ulEdT+8ZJQ1EM9F6GTdopql0q4wwfh25WbpKX+IvGULD5uIUEu6oIKPSHdAUuY5+Fyxa3HLTRhqJmirv0l28vJYOZhD9rVJygxfpvb0K94bOpli21fuBMU9c+/sGx/XKJH6xosUmhpGf8ucxGIFYNcsQcEYcOd4jIkRE3MCjcCNnag6JnNgHyzCImKbjT3BbiIhaMtbIRtMcz/hU7iKQWLPqwDLHno/vL2CvySDlgJLcAojyHiTFhjVm3OjC/26MrRyBXckoNhhT6xKeAE5nBk7uXdFsXBJbjoMIUtl+dk3lIxEIf2f2e8NACOoqHy0m+Mf/RyKLMrXIY3MUNngBbRCRYXPcqWt1nOK8XPMPbutemrNk7vl2e8VrZVreKkw+b1rrGoGaRFEMP+aISwJwStbctPj6+eI2obIDad0JQpyYPLRNMZbkcfh2baflSM3q8GCMir1baP1WggL4u9KZJGZeItr4tuD4pyArRJB1sy277wd/b62l6DRtisaxQxv2WfG5ylSK3i6IwUtZV3lztx0ecOZVjDruhnCbusDoPZ/QISFhzC3jixmQ=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1715500608; cv=none; b=WbmTkC5dXrhy0UbPAu42hvCaYw1rAsBc2LbkPc0jlm+YxiaZ/E1U+qo/ZVTKqfZosQ4S9//G6eEkQ8/CwXIcIRi3zRyRmovCXoqU+ggfjaHhBKgWIUXqWOSFO0Lp72m/TKtEKiRQDQ8Vao7G7w7+UrIE9DHeayRC+7JFV/adnhGmSYYjHKcUhbYN3pz26r3m4vdW80IlxwH9557//4zyNecc0g2me9n86wrlaxm20IZ+PFRzCPQoHjBxljGgc4DDE691Y0Iz1aAIkY31dklopHZv7lNAqy8GtiikklbayBh6QrLh+w/in5WB1zxrG0NkE3fR3IpnKi2wGGPXndEzCNob8Ozcjt3mqBqSUdUOvt3XMwwJa7ESqTSIBZk0ueWz9RmelQn/da7pt/hMngAEktDjXAsWitOzMG50wgys8K2TBHBun8+NIaEnxlXRHdCt9syCEePPhjIdpJ7axBPgpaJ2uOu+HKalobAbcNzlVOzwEnQkVAMfxR95WWncBk3ltVJF8dR503ul08gGlPOffYEn/gwOvfNkpum7qFHtVT7XOeyiSgXnBS4hXAoxPRtL/oynsYSsdLP2tcTarpKFVn5SMPb1dcFhIzCk8r8sqWTwGWtsy4ZXS9Xg17Nw146/bA/5mlO/dFYfUniItCBKbF/O+U3jdc6802tg4eI/IsQ=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Cc: Pari Developers Mailing List <pari-dev@pari.math.u-bordeaux.fr>
- Delivery-date: Sun, 12 May 2024 09:56:51 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1715500608; bh=QOdNfUoUj+vWqSgAKVEhzZi4X/VwyJAYW/Gevgu5uCk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WMcUd7cGw5zHKw5vwBlgw/cD6TMz2aipjIBnhn5iC+d/BOStdtdRlBrR9vaA4w7Zs ThJkQ8VrZvF+nNY+eZChRn8oZpRsxIc8bVchAlgn0dvgfwpAh/QuZi2zR/x3f8JZpj HX+PSH7AhMjONYgh4/bH/3Hck8ANHb5H1fAC60iH6Q87BQu4INsR/9QZM6SS9OxdEK klwE6zibclzuu+8TcY3AzyYQFqZa3oHIkj+NM7NhsDzcF3D1oL/PJy9clgn0DXFKTE 3pU12pNncYtiMi5VGHqgzU4MXrNAA8rXQTLwbhqPpiE5Gk89A1GljXhMHhE2sR15K6 QjwbII9o3ykoJ+4AAVq+seF2OTur9WMPiXSaa3l0fkfIYukZgu5aRI8bJcajofVD5X z0GYwWhug0DEbMNEHJBIUgsQFxBUG6Scqyks1taHHnVHsh//sAQ+QJa1pX1XtCEdIi Wzi4DxcOZSNohONZHGTqJJdIcmGTKueSqVS7VypBcQFHb0wLsMRLfZQsiYMo0jedNT lzaCp/B7buuvFk/cjQscVd4/TIHGDGpZ0K/bpuEJIBJG4qY86WcFnzKmvfM1gzo69E xz3m0zKBaxYuEHXdlPLH4jemZK+M+XKIN3XuWGPvLYUyVdxrx1//kimtUiu+VRbfe3 zwbD/uGLCbJKCZoSvgvyMxhU=
- In-reply-to: <ZkAyF4s7OuJNURgh@debian.attlocal.net>
- Mail-followup-to: Ilya Zakharevich <nospam-abuse@ilyaz.org>, Pari Developers Mailing List <pari-dev@pari.math.u-bordeaux.fr>
- References: <ZkAyF4s7OuJNURgh@debian.attlocal.net>
* Ilya Zakharevich [2024-05-12 05:06]:
> Up to some extent, one can “reach” the builtin PARI operators in gp:
>
> (20:25) gp > ?_+_
> x+y: sum of x and y.
>
> (20:00) gp > ?+_
> +_: copy and return its argument
>
> Should not there be a way to specify these functions as arguments to
> other gp functions? Something like
>
> SUM = fold(array, `"_+_");
>
> ?
There is one already:
? alias(plus, "_+_")
? fold(plus, [1,2,3])
%2 = 6
It's even (sort of) documented:
? ???_+_
alias
? ??alias
Defines the symbol newsym as an alias for the symbol sym:
[...]
You are not restricted to ordinary functions, as in the above example: to
alias (from/to) member functions, prefix them with `_.'; to alias operators,
use their internal name, obtained by writing _ in lieu of the operators
argument: for instance, _! and !_ are the internal names of the factorial
and the logical negation, respectively
Cheers,
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/