Well...

it's certainly appropriate, given the data structure you are working with.

That said, you could rephrase it to eliminate that artifact:

validIds ([ ((alpha i. ]) { alpha |.~ [) each '-' cut ]) each validCodes

This saves construction of two boxes at the expense of slightly more parsing.

Thanks,

-- 
Raul


On Mon, Jan 9, 2017 at 8:47 AM, Joe Bogner <[email protected]> wrote:
> I'm back to working on Advent of Code. I'm on day 4, a bit late I know.
>
> I have "each each" in my solution which doesn't feel right to me.
>
> Here's a reproducible case:
>
> validCodes =:
> ('mvhkvbdib-kmjezxodgz-mvwwdo-omvdidib';'zydfxpc-rclop-qwzhpc-lnbftdtetzy')
> validIds=: 837 171
> alpha =: 'abcdefghijklmnopqrstuvwxyz'
>
> validIds ((alpha i. ]) { alpha |.~ [) each each '-' cut each validCodes
>
>
> ┌──────────────────────────────────────┬──────────────────────────────────┐
> │┌─────────┬──────────┬──────┬────────┐│┌───────┬─────┬──────┬───────────┐│
> ││rampaging│projectile│rabbit│training│││onsumer│grade│flower│acquisition││
> │└─────────┴──────────┴──────┴────────┘│└───────┴─────┴──────┴───────────┘│
> └──────────────────────────────────────┴──────────────────────────────────┘
>
> Does the "each each" feel out of place? If so, how would it be eliminated?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to