In particular you cannot assume that the first element of the array will be preceded by a space. However, you must use the canocical representation of your language, as returned by repr or similar. Since full programs can only take string representations of arrays as input, this is allowed. The truthy and falsy values must be consistent for all inputs, i.e, all arrays for which Ȧ returns 1 must map to the same truthy value, and all arrays for which Ȧ returns 0 must map to the same falsy value. Your submission must abide to the following rules. In a programming language of your choice, write a full program or a function that takes a possibly empty, possibly jagged array of integers as input and prints or returns a truthy or falsy value that indicates if Ȧ would return 1 or 0, respectively. Ȧ takes an array as input and returns 1 if the array is non-empty and does not contain the number 0 (integer, float, or complex) anywhere in the tree structure otherwise, it returns 0.įor example, the array ] is truthy because it is non-empty and contains no zeroes, but ] is falsy because it contains a 0 at the innermost level. Inspired by Octave's (and, by extension, MATL's) very convenient interpretation of truthy/falsy matrices, Jelly got the Ȧ (Octave-style all) atom.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |