apl: enclose ⊂ / disclose ⊃; 82/82 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
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:
@@ -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))))))))
|
||||
|
||||
Reference in New Issue
Block a user