diff options
Diffstat (limited to 'operators.c')
-rw-r--r-- | operators.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/operators.c b/operators.c index 17ba76e..1ecb8aa 100644 --- a/operators.c +++ b/operators.c @@ -101,8 +101,14 @@ opPower(Datum *lefto, Datum *righto, Array *left, Array *right) else code = L"next←⍶⍵ ⋄ next⍹⍵:⍵ ⋄ ∇next"; }else if(righto->tag == ArrayTag){ - if(righto->array->type != AtypeInt || righto->array->rank != 0 || righto->array->size != 1 || righto->array->intdata[0] < 0) + if(righto->array->type != AtypeInt || righto->array->rank != 0 || righto->array->size != 1) throwerror(L"right operand to ⍣", EDomain); + vlong times = righto->array->intdata[0]; + if(times < 0){ + lefto->func = inverse(lefto->func); + times = -times; + } + righto->array->intdata[0] = times; if(left) code = L"⍹=0:⍵ ⋄ ⍺ ⍶⍙(⍹-1)⊢⍺⍶⍵"; else |