apl: power f⍣n + fixed-point f⍣≡ (+9 tests, 191/191)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 56s

This commit is contained in:
2026-05-06 23:32:26 +00:00
parent 3d2bdc52b5
commit 4dbd3a0b34
3 changed files with 81 additions and 2 deletions

View File

@@ -1066,3 +1066,20 @@
(define apl-compose (fn (f g x) (f (g x))))
(define apl-compose-dyadic (fn (f g x y) (f x (g y))))
(define
apl-power
(fn (f n x) (reduce (fn (acc i) (f acc)) x (range 0 n))))
(define
apl-power-fixed
(fn
(f x)
(let
((next (f x)))
(if
(and
(equal? (get next :shape) (get x :shape))
(equal? (get next :ravel) (get x :ravel)))
x
(apl-power-fixed f next)))))