apl: enclose ⊂ / disclose ⊃; 82/82 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 19:17:30 +00:00
parent ad914b413c
commit e06e3ad014
3 changed files with 65 additions and 4 deletions

View File

@@ -732,3 +732,24 @@
(define apl-grade-up (fn (arr) (apl-grade arr true)))
(define apl-grade-down (fn (arr) (apl-grade arr false)))
(define apl-enclose (fn (arr) (apl-scalar arr)))
(define
apl-disclose
(fn
(arr)
(let
((shape (get arr :shape)) (ravel (get arr :ravel)))
(if
(= (len shape) 0)
(let
((inner (first ravel)))
(if (= (type-of inner) "dict") inner (apl-scalar inner)))
(if
(= (len shape) 1)
(apl-scalar (first ravel))
(let
((inner-shape (rest shape))
(inner-size (reduce * 1 (rest shape))))
(make-array inner-shape (take ravel inner-size))))))))