Bill Allombert on Fri, 24 Nov 2023 09:21:33 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Lookup Table
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Fri, 24 Nov 2023 09:21:07 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1700814068; c=relaxed/relaxed; bh=1NOcnk6djAh+WGoi2+6lpl+R8pZoZQsW6I1vaNxl3j8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=qsbJRC+n2HEmJrxvXa4NLd4vHc8/sCXfUZ4frQOI60HnSE/r80CIVrWuCzRB6yaAl/cH3gmrNE1zyLKaQNGyIe2WiF1x+6oyIXTyqG+TAR7Ws+fz9X5Jl3x9uxShrtKIGCGZG9qb2kxwE/hmUMiMyjT2rvKArtK9gcVCn20DeeeL8G6qNPlB+nEip2QJFViX2IHaoIjDblp3k5m56+b0fLrd2orlNLjdwSXB/R3oHTi1UMYu/P1zVrji3/XGHY5y+hQ+72nkDWvSCvMYvDKc3rwerC3z65XrSHT7X7NW/d9qmsShcrns+kcR2iSntj+aLZMNrD91XbZjaRF9nMyGNIriZql4BKIx05nTuuKIMWm7FvLYr3dUK+nVAhihIAmTiKyZ/2MkVlG3BYm+kLFZCpCPICNSHpdONLGs1cqTDoS6YkKFBb50ZoWiYByynY/+e7h0fQRTVT6TB1UYdXRAPGcz0S/8YRLu/d9GLh8SKM9wGhVp0qYOkb6EEAVyg8axSMaborepao57dk8uK73wmxZfN/XU+bMCxrkT8zmt+VbJSgCM2izfI1/Akn7YQfukLTcEIyFh6KTKUdQI6W9tYhw4DdSNFV6QELQGcdPn70sM2cKGUujr7OU51egCl4K5l8sycY8RcHjSE7O2G9S2FloZfj06yeGw+hj7xyV40tw=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1700814068; cv=none; b=Lqlt/bUehyQESdPiyVKtvob8kam+uUqL57X+DdB0/c+rn/BB1Gt02pZUbJgiOBTzmbvgHkP14aE13PQLiuXO9Rz5kuiDA/c+v9dRC8ZLrxuZsBxjr++Y4UKr1kw0suPXdgkwKtmGyHabMHUv0yvbQUl4MiNOAcxvGDIU6aZLOVI3/FpEl5vFqpNcZitC0krWIYCwVJ1dVK7oGNwQnIciKyOAk5E9MYLf0aBAKldk2pQi87taECE3jnI4e6DZKhLR0S7XQS3YnEKVhlAs1L2ll/w8D9JS1D1tHgJ9pYLHz61sK5aDHdgvo/PgR0pScIi7ntfXlZqK9y6RK/CePM+D9gee4GwbPW910RqaHK7Uesvqu7cQl28HXpe2etmnykVvP5IEj/YQpGjELgR3uKE5u96LqDIbOGencrNn/aNLag/GGgv6YrkPtDyHX8uyePKrLRSJBsGtH0V+okOK8FMRYWSzkw2QBK8AMJ0NpnqKc3HifcedKAJOVdfXRQyN6FL8yxYpBOrudMKBPW6ixEzcQ6qBWv6BSpD/ap1y9C70MJUgQt1XZacDG2NAVs6FMuzNAZqJ+FnE9ag6ldkxx3AHRN8mvlXKZUO2xLW+uZQM7g6rrBfZwVvidqGsHid4mdJhxcOSppyykjyJWuf6V9M+k/mqLUL9A5rd9IbRhA+I5i0=
- Authentication-results: smail; arc=none
- Delivery-date: Fri, 24 Nov 2023 09:21:33 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1700814068; bh=1NOcnk6djAh+WGoi2+6lpl+R8pZoZQsW6I1vaNxl3j8=; h=Date:From:To:Subject:References:In-Reply-To:From; b=MpVg4LZUuI0+hcma8dRav1iBHWc3w+V9sDA7u0aCtmsb3H5quNpBqEUZfcO7AccAr uui9iERhxSV6kAGGoersR7BOh/QVKeEY4DtA8POt/LtxW2TpXdfR263mc5lshtKPvV PZmCNpuriTLRCDKfl5eGdRIrYi4VZs99MQKNjx9BjukJkoHW5FbJbyyYTw5N/sP3PE qlii4AZTL8pIeyG9AbUs3wDwT9KUUhv/YZKBtmTkkrxzdCZr7+IHeviO4G+GwkW9S2 CjzzfGKdApuD8l9O9RhGx8bLIxl2TEIcgH/pEsn2FUWrVEHLctemAPIzXndwgtwNzM wUGKCrFNSdevz/BZKkaBfTBr/J4oa2q3nAAAPxdL7f5xqoknwJAfHSFzmi8AqObCFW QRZbbzPx9cbCO3jIBzc86ksGwtAU+PZx2zpXJRT18rDJ5mdtyYKqKGdnyK1cLHrC4k KnHyffdrQ6yMoxp/YAwGJJZwqobh0McmBlV+TRNeEss+vV4Vn6natLVMvVaiscA//v TuoI5yFfyboGBeNhmygEmWr+nubE+oU6kHZkv/rIYgqvmpO6U6R45BVev8rEzV8lQt ZbAxTJpu7SwvUzpC9svhSdLGbHjk8zuKcCnUXl6T99BeY6q5CRmTLWuquBy/XHhu65 7jKo17hjpSxDyP3wuy1Moq2A=
- In-reply-to: <efafcc27-2773-40b7-bfa7-bf91fc718095@wavecable.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <efafcc27-2773-40b7-bfa7-bf91fc718095@wavecable.com>
On Thu, Nov 23, 2023 at 11:16:35PM -0800, Thomas D. Dean wrote:
> I want to create a sparse lookup table with a key and value or key and set.
> When I do table[N], or a function call, I want to get back either 1 or 0.
> Another use, I want to return a set, {1,2,3,...} or {}.
>
> For example, I want table[N] to return 0 if entry N exists or 1 if it does
> not.
>
> I tried
> ? M=Map();
> %131 = Map([;])
> ? mapput(~M,7,0)
> ? mapget(M,7)
> %133 = 0
>
> Does mapget(M,7) use pass by value or is M passed by reference?
It is semantically passed by value, but it is not copied.
> ? mapget(M,8)
> *** at top-level: mapget(M,8)
> *** ^-----------
> *** mapget: nonexistent component in mapget: index not in map
>
> Is it possible to do this?
Use mapisdefined(M,8)
Cheers,
Bill.