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
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 56s
This commit is contained in:
@@ -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)))))
|
||||
|
||||
Reference in New Issue
Block a user