[Cuis-dev] ifPresent/ifAbsent methods in SequenceableCollection (and other minimal improvements)
Facundo Javier Gelatti
javiergelatti at gmail.com
Sat Apr 4 10:41:30 PDT 2026
In some work I'm doing, I needed to use the #at:ifPresent:ifAbsent: on
a SequenceableCollection, which I (wrongly) assumed was implemented (in a
similar way in which it is available for Dictionaries). A
SequenceableCollection only understands #at:ifAbsent:.
I'm not sure if we want to add them, but I attach some changes to add
#at:ifPresent: and #at:ifPresent:ifAbsent: to SequenceableCollection. The
changes are based on the current methods of SequenceableCollection
and Dictionary.
I also corrected the method comment on Dictionary>>#at:ifPresent:ifAbsent:,
and made minor style changes to SequenceableCollection>>#at:ifAbsent:.
Note: I didn't know if it was better to implement both #at:ifPresent:
and #at:ifAbsent: in terms of #at:ifPresent:ifAbsent:. I left them separate
because I saw that in Dictionary they are not implemented that way.
Cheers!
Facu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20260404/5a9339fc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifPresentifAbsent_improvements-FJG.001.cs.st
Type: application/vnd.sailingtracker.track
Size: 1861 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20260404/5a9339fc/attachment.st>
More information about the Cuis-dev
mailing list