cats icon indicating copy to clipboard operation
cats copied to clipboard

`NonEmptyList` lacks def `updated` at index

Open mcanlas opened this issue 4 months ago • 6 comments

Both NonEmptySeq and NonEmptyVector currently have this method; as does the underlying List

mcanlas avatar Aug 20 '25 10:08 mcanlas

I believe these were not included because it is very inefficient for NonEmptyList compared to something like NonEmptyVector. Though you could argue to include it anyway and give a warning via the scaladoc or something along those lines.

LukaJCB avatar Aug 20 '25 22:08 LukaJCB

I think it is quite odd that NonEmptySeq does have updated whereas NonEmptyList does not. Apparently, NonEmptySeq can wrap List under the hood, therefore updated may or may not be efficient depending on the underlying implementation type.

satorg avatar Aug 20 '25 22:08 satorg

While I agree updated is not efficient, List and NonEmpty list has many O(N) operations. I think realistically we have to expect that people understand this. I'd favor consistency in this case and add the method.

johnynek avatar Aug 21 '25 03:08 johnynek

Hi I’m Queen Jessa, a first-time contributor. I’d love to take on this issue (#4763) and implement the updated method for NonEmptyList. Could I please be assigned to this?

QueenJcloud avatar Oct 10 '25 08:10 QueenJcloud

Hey @QueenJcloud, I don't think anyone is actively working on this so please feel free.

valencik avatar Oct 10 '25 14:10 valencik

Hey @QueenJcloud, I don't think anyone is actively working on this so please feel free.

okay, thanks

QueenJcloud avatar Oct 10 '25 14:10 QueenJcloud