[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: **** SPAM **** [sc-users] indexOf behavior



Andrea Valle schrieb:
Hi to all,

y = [ [\the, \symbol], \collection, \contains, \my, \symbol ];
y.indexOf([\the, \symbol]);

Returns nil.
Shouldn't it return 0?

What am I missing?
hi andrea,

not exactly sure what's happening - it looks like indexOf does a check for identity, not equality:

a = \the;
b = \symbol;

c = [a, b]

y = [ c, \collection, \contains, \my ];
z = [[a, b], \collection, \contains, \my ];
y.indexOfEqual([a, b]); // 0
y.indexOf(c); // 0
z.indexOf([a, b]); // nil
z.indexOfEqual([a, b]); // 0

... as ArrayedCollection inherits from SequenceableCollection which provides indexOfEqual

have a nice weekend

stefan

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/