Shallow, simple or mild flatten?

Background waffle

When manipluating pixels of costumes - I regularly convert the pixel list into a 2D matrix
e.g a simple 2x2 red green blue white costume


When I'm finished processing, I need to convert back to a standard pixel list and I use flatten to do that

But flatten does a deep flatten (ravel in APL speak) so it ends up like this


when we need this


So I reshape it using


All works but it's a two stage process and you have to work out the length of the pixel list required to use the reshape

Anyway, I decided to make my own "shallow" flatten block but I always like to shorten the block labels as much as I can ...

Which one of these would you prefer to see as a "shallow" flatten reporter compared to the standard flatten reporter that does a deep flatten


Or have you got your own alternative suggestion

I vote for the 'mild' adjective because the rest of them are all 2-syllables long.

I vote for "shallow" because that's the official term everyone understands. (Although in some systems "flatten" by itself means a shallow flatten and you say "deep flatten" if that's what you want.) We don't have a shallow-flatten primitive because you can say
untitled script pic
to get that result.

Are you proposing a new primitive, or just asking for advice about your own projects?

I was asking about what people thought about using a name other than shallow.

Lots of other reporters are shallow ones but none of them use the name.

Shallow doesn't grab me so I was looking to come up with something more appealing.
Simple is a compromise - mild is just nice and short but less computing like :slight_smile:

FYI I'm calling this in my custom reporter


but if using append input list works at a similar speed then I may as well use that :slight_smile:

APPEND is a little different because it requires that its inputs be lists.

That's not a real issue - I'm only trying to flatten lists.

It's more whether if someone saw append input list with just the one variable attached to it - would they guess that it does a shallow flatten?

I don't think its obvious that it would so I might stick to declaring a custom reporter (but that can call the append input list instead of the JS)


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.