Handbook
Glossary
d^ ( d n -- d^n )
Vocabulary
units
Inputs
d
an
object
n
an
object
Outputs
d^n
an
object
Definition
USING:
combinators
kernel
math
;
IN:
units
:
d^
( d n -- d^n )
dup
integer?
[
dimensioned-power-op-expects-integer
]
unless
{
{
[
dup
0
>
]
[
1
-
over
[
d*
]
curry
times
]
}
{
[
dup
0
<
]
[
1
-
abs
over
[
d/
]
curry
times
]
}
{
[
dup
0
=
]
[
2drop
1
scalar
]
}
}
cond
;