Skip to content

Filter 2d array? #204

Answered by kaikalii
memark asked this question in Learning
Oct 29, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

The problem becomes that the filtered rows may end up being different lengths, so you cannot reform the array normally.
The three main ways of solving this are box, pack, and fill.

  • boxing the result of keep on each row wraps each filtered row in a box
  • pack does the same, but only if it is necessary
  • fill fills in the lengths of each row so that reforming the array works correctly

Here are some examples of how they would be used here.
Notice the difference between using box and using pack on array B.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@memark
Comment options

Answer selected by memark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants