Alternative way of querying coll

May 20, 2010 at 3:33pm

Alternative way of querying coll

I was wondering if it is possible to query data from a coll using symbol other than the index.

For example, I have data stored in a coll :

1, alpha beta gamma
2, omega theta zeta

I want to be able to get “beta gamma” when I ask “alpha” and “theta zeta” when I ask “omega”, and still has the Integer index. I presume there is a way of doing this with Javascript…

Anybody has a clue?

Thanks a lot for your help guys!

#50477
May 20, 2010 at 3:37pm

hi

you can try something like this. but i think it needs to be adapted…

– Pasted Max Patch, click to expand. –

cheers

g

#181091
May 20, 2010 at 3:43pm

Yeah it works, the principle is there, but I feel that the dump operation would a bit costly on the CPU usage, since my coll is very very large…
Maybe something with javascript or lua…
Still thanks g!

#181092
May 20, 2010 at 3:45pm

And also, since there is many symbols in each index, I presume it would be problematic of getting any of them using iter and match.

#181093
May 20, 2010 at 3:48pm

yes, not very efficient, and you’ll have a problem too if the same symbol is present at different indexes…

g

#181094
May 20, 2010 at 3:53pm

In fact, I think if I was be sure I could do what I want with coll using Javascript, I would spend some time trying to learn it…
Anybody can confirm this is the way to go?
Merci quand même Guillaume!

#181095
May 20, 2010 at 11:37pm

why don’t you just use the initial data element as an index, instead of ints?
T

– Pasted Max Patch, click to expand. –
#181096
May 21, 2010 at 12:14pm

Because I using the coll content with a jit.cellblock and I need the sorting to be steady and logic. That is why is use a Int as an index. I also use “insert” and renumbering to be sure everything is in the same order, which makes it difficult to change it to symbol indexed coll.

Each line of data is like a cue, containing lines of actions that are parsed when I trigger it. Actually, I’m triggering them sequentially, one at a time, but I really need to be able to trigger them with a symbol.

Please help!

Thanks.

#181097

You must be logged in to reply to this topic.