Thank you, Ian.
Most helpful.
> On 16 Apr 2017, at 12:36, Ian Clark wrote:
>
> Raul is right: there's no native concept of a "dictionary" in J.
>
> But dictionaries, as you see them used in Python & Swift, are alive and
> well in J. They are employed by the J system itself for just the same
> p
Raul is right: there's no native concept of a "dictionary" in J.
But dictionaries, as you see them used in Python & Swift, are alive and
well in J. They are employed by the J system itself for just the same
purposes as Apple does. (Xcode users: I'm referring to NSDictionary and
Property Lists (.pl
But that can only be an issue in certain contexts.
One possible workaround, for some of those contexts, involves using
sorted keys (and values) and using I. where i. was used in my quicky
example.
Other workarounds are also possible - but my point is that the details
of why these things matter al
The dyad i. primitive contains optimizatins using hash and
should perform much better than linear search, moreover
j806 avx uses hardware crc32 as hash. I suspect simple dyad i.
can out perform some dictionary implementations.
Ср, 12 апр 2017, jprogramming написал(а):
> One potential problem wit
One potential problem with using two arrays, one for keys and one for values,
is that lookup time increases by O(n), whereas it may be desirable for constant
time lookup, or O(log n).
E.g. it makes it difficult to implement some algorithms that require constant
time lookup datastructures.
On
The reason J does not implement dictionaries (and seems to be designed
to discourage their use) has to do with how bad dictionaries can
mangle your architecture.
In my experience you usually want to find multiple different pieces of
information when looking things up. With a dictionary approach th
I created one a while ago.
https://github.com/jonghough/msgpack-j/blob/master/hashmap.ijs
This is a crude implementation of a hashmap, using separate chaining.
Admittedly, it isn't particularly great. E.g. hashing function implementation
isnt very good. It uses symbols to represent inner hashmaps
___
From: Herbert Weissenbaeck // Privat
To: programm...@jsoftware.com
Sent: Wednesday, April 12, 2017 8:34 AM
Subject: [Jprogramming] Dictionary with Strings as Keys
Next beginner's question: What would be an efficient/fast (or the recommended)
J way to implement a dictionary
Next beginner's question: What would be an efficient/fast (or the recommended)
J way to implement a dictionary with strings as keys and arbitrary contents
(nouns, verbs, boxes) as values, which allows inserting, removing, fetching and
editing?
Thank you.
Sent from my iPhone