the important detail is that m&i. uses a static snapshot of m at the time that & is executed/bound.
A workaround is to optimize SET, ADD, UPDATE, DEL for bulk operations (multiple items processed at once (] F..) super useful), and after bulk operations, "redefine" (just repeat execution of same definition) GET such that any m&i. updates. Also update FILTER functions (GET multiple if they gain from static binding optimization. An approach that just presumes key uniqueness instead of enforcing it, is for GET to be based on i: instead of i. and then any ADD with a duplicate key effectively will return the last updated/added values. Earlier in thread I mentioned a general datastructure framework, and then maybe extending special code for inverted table operations as the enhancement "we" most want. Back to generic datastructure, everything a class can do is possible within a datastructure. All administrative "properties" (names) and their associated values including functions can be encoded in a dictionary, including a string representation dsl for representing "name values" with ease as to function/data. What specializes a datastructure over a "mere" class is the concept of existential data held by the datastructure that a J user would want complete access to that data. In a class based implementation, a universal name data =: holds the core data that the J programmer would want access to. Usually, it is compound greater than atomic data that can be represented as inverted tables of "linked data". And part of the data specifying dsl's purpose is to include descriptions that permit any possible optimizations that include what k/q's attributes do (sorted, unique), but with extensible dsl, any other implications/constraints on the data can use/select a specific implementation of universally named "accessors"/functions So a datastructure contains 2 boxes: 1st holds the name of the datastructure class (for lookup value of any metadata of that classname), and all administrative properties, and specialized functions for GET/ADD/DELETE and other functions expected to have meaning relative to its "existential" data, and the 2nd box holds the (likely compound and so extra boxed) "data" An advantage of a compound datastructure over a class is the user gets to decide whether to overwrite the "permanent" data while still having access to SET/DEL/ADD functionality of their own copy they may want for their application/data needs. It is also possible for generic GET/ADD/DELETE to query the datastructure as to how it can best accomplish its integral functionality, should there not be a specialized version defined in the datastructure, and GET as an adverb that takes either '', datastructure_name, or a specific instance of datastructure can optimize itself as a first step, or one that can be bound to an optimized named function, or if '' is the adverb parameter to GET, then the generic verb "inspect y for datastructure properties" before selecting implementation is returned. Going back to optimizing for bulk update operations, In the early days of computing even up to the 90s, there was a presumed multi user army of data input clerks entering/updating individual table/db data. Not typical today, but it is still possible to optimize for bulk data by sending messages to a separate process (zeromq part of J) that will bulk update if it is unable to keep up with the army of clerks sending individual updates. Today's computers can easily keep up with a mere squadron of data entry clerks. On Wednesday, February 2, 2022, 09:51:11 a.m. EST, Henry Rich <henryhr...@gmail.com> wrote: That's a possibility, but how would you know when x changes, or is assigned to a different name? Henry Rich On 2/1/2022 8:27 PM, Elijah Stone wrote: > On Mon, 31 Jan 2022, Henry Rich wrote: > >> The deficiency in J is that m&i. gives you a hashtable for searching >> m, but if you modify m you have to recalculate the hash from >> scratch. This makes m&i. a good read-mostly Dictionary but slow for >> frequent updates. > > Why not cache the hash table for x when computing x i. y, and update > it in-place when x is updated in-place? That should provide ideal > performance without requiring any changes to language semantics. > > -E > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm -- This email has been checked for viruses by AVG. https://www.avg.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm