On Thu, May 16, 2024 at 02:09:21AM +0200, Grégory Vanuxem wrote:
> Hello Waldek,
> 
> Exactly what I was looking for. Thanks.
> 
> I thought only integer based indexing was allowed, and since Record is
> a FriCAS primitive I thought indexing by Symbol, or whatever, was not
> possible.

Note that hash tables have keys which can be of type Symbol,
so "indexing" is easy.  But if different symbols need different code,
than user would need to implement appropriate runtime dispatch.
'setelt!' can be overloaded, and that is used to invoke different code
for each selector.

If you want to use 'a.type := x' declare 'setelt' like:

   setelt! : (%, "type", N) -> N

Matching 'elt' would be:

   elt : (%, "type") -> N


-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZkVVER6XL4nlgH7t%40fricas.org.

Reply via email to