Make any/all rank-agnostic via the reduced ray's ravel head#34
Merged
Conversation
The prior any/all indexed min/max's scalar result with a zero index sized to the *input* rank: ?!(=((get-item (max a) (reap (lent shape) 0)) 0)). That matches the Hoon min/max (which preserve rank via scalar-to-ray), but the min/max jets return a rank-2 scalar even for a 1-D input, so any/all crash on a plain vector under the jets (verified on a live ship: 1-D input bails in get-item-number, 2-D passes). Read the reduced scalar as the head of its ravel instead: any = ?!(=(-:(ravel (max a)) 0)) all = ?!(=(-:(ravel (min a)) 0)) ravel flattens the data directly, so this is independent of min/max's output shape and works for any rank. Validated on a live ship for both 1-D and 2-D. Add a 1-D any/all test (the existing test was 2-D only, which is exactly what hid the rank assumption). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sigilante
added a commit
that referenced
this pull request
May 30, 2026
Regroup the suite from arity-based (single-args / double-args-elementwise + array-utils) to operation-category files: arithmetic, compare-reduce, builders, rounding, linalg, unary, indexing. lagoon-fails and lagoon-unsigned are unchanged. Pure mechanical move: arm bodies are byte-identical and every new file gets the same canonical preamble (the is-equal/is-close helpers and ^| |_ [atol rtol] that all three sources already shared). Done with a script that asserts arm-count conservation and errors on any unrouted arm; one category (indexing) was built and run on a live ship to confirm the new structure compiles. Arm count conserved exactly (983 before and after, including the test-any-all-1d added by #34). File-reorg pass only; de-duplicating the cartesian-product arms is a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #28/#33. The
any/allreductions indexedmin/max's scalar result with a zero index sized to the input rank:?!(=((get-item (max a) (reap (lent shape.meta.a) 0)) 0))That matches the Hoon
min/max(which preserve rank viascalar-to-ray), but themin/maxjets return a rank-2 scalar even for a 1-D input — soany/allcrash on a plain vector under the jets. Verified on a live ship (~nec, old jets): a 1-D input bails inget-item-number, a 2-D input passes. The existing test was 2-D only, which is exactly what hid the assumption.Fix
Read the reduced scalar as the head of its ravel, which flattens the data directly and is independent of
min/max's output shape:Works for any rank; also drops the
reap/dexplumbing.Validation
Ran on ~nec against base's
min/max: the-:(ravel ...)form passes for both 1-D and 2-D all-true / mixed / all-false rays. Added a 1-Dany/alltest to the suite alongside the existing 2-D one.🤖 Generated with Claude Code