in-phase / ph-core

A reimagining of scientific computing with the speed, typing, and flexibility of Crystal.
https://phase.blog/
MIT License
1 stars 0 forks source link

Remove `MultiIndexable[]?(bool_mask : MultiIndexable(Bool))` #35

Closed shinzlet closed 2 years ago

shinzlet commented 2 years ago

Currently we have this:

mask = NArray[true, false]
data = NArray[1, 2]
masked = data[mask]? # => NArray[1, nil]

I don't remember implementing this, and I don't think it's commonly used. Right now, there isn't a pretty alternative, but assuming #34 goes through

masked = data.map_where(mask) { nil }
# or perhaps
masked = data.set_where(mask, nil)

Admittedly those are less pretty solutions, but that's a #34 debate.

shinzlet commented 2 years ago

I removed []? - it's a very simple feature, and it's much easier to add it back later if there is niche demand than it is to remove it once ph-core is at 1.0.