-
Notifications
You must be signed in to change notification settings - Fork 139
Over
Tom Szczesny edited this page Jan 20, 2014
·
6 revisions
f:monad
f/x
Applies the function f
to x
until a fixed point is reached: (f f x) ~ f x
.
%[;2]/50 0.0 {1+%x}/1 / golden ratio 1.618034 _cos/1 0.7390851 ,//(1;(2 3;(4 5;6);7 8);9) / flatten 1 2 3 4 5 6 7 8 9
n f/x n:int
Applies the function f
to x
n
times.
4 (2+)/0 8 (2+)(2+)(2+)(2+)0 8 6 (10*)/1 1000000 {x{x,+/-2#x}/!2} 5 / Fibonacci numbers 0 1 1 2 3 5 8
b f/x
Applies the f
to x
while the expression b
is true.
(1e6>)(2*)/1 1048576 {|/x!'4 5 6 13}(1+)/1 780
f/x f:dyad
Applies the dyadic function f
between the elements of x
.
+/1 2 3 4 5 15 1+2+3+4+5 15 -/1 2 3 4 5 -13 1-2-3-4-5 -13 {y-x}/1 2 3 4 5 3 5-4-3-2-1 3
Applying a function using over on an empty list returns the identity element of the function:
+/!0 0 */!0 1
In the case of x f/y
the x
is the initial value, i.e.:
2+/!6 17f/[x0;x1;x1;...;xn] or {x+y+z}/[a;b;c] or {[a;b;c;d] ...}/[e;f;g;h]