0

I have an array of arrays of lists allvals and would like to check to see if any of the allvals[i][j] are empty.

The following works, but isn't easy to read: I thought the following worked, but I don't think it actually does...

some(lambda([anarrays], some( lambda([alist], some(lambda([e], e = true), alist) = true), anarrays ) = true), allvals)

Is there a better approach? I tried playing with map and apply but that was even worse, for me.

Any suggestions for a better workflow would be greatly appreciated.

EDIT: the following does work:

map(lambda([anarray], apply('some, [emptyp, anarray])), allvals);
Rax Adaam
  • 790
  • 3
  • 11
  • 1
    I know, I am old fashioned. But in this case, I would suggest to write 2 or 3 lines instead of one (map a list and then map an array of lists). This way you can test one, then the other and you need not guess as much where the problem might be. – BitTickler Jan 16 '22 at 22:22
  • Thank you -- I'm really not a programmer, so don't have any real preferences in terms of style: I just thought it was best to complete an operation in a single step, but I too find multiple lines clearer. Thanks for taking the time to share your suggestion. Having found a solution that works that is not very long or complicated, I think I need to focus on learning how to think about these tasks, more clearly... – Rax Adaam Jan 17 '22 at 17:13
  • It sounds like you are working with a list of lists of lists. Be careful to distinguish arrays and lists when you describe stuff in Maxima -- Maxima treats them differently. – Robert Dodier Jan 18 '22 at 19:33
  • Looks like you got something working, that's great. You can make it a little clearer by writing the test as `some(emptyp, anarray)` instead of the equivalent `apply('some, [emptyp, anarray])`. (Aside from saying, e.g., `alist` instead of `anarray`, as I was saying before.) – Robert Dodier Jan 18 '22 at 19:38

0 Answers0