On Fri, Oct 30, 2015 at 2:39 PM, Kacper Gutowski wrote:
> i←0 ◊ 4×{⍵+(¯1*i+1)÷¯1+2×i←i+1}⍣100⊢0
This is slightly faster and doesn't use global variables:
↑{(+/⍵[1],4÷1↓⍵),4 ¯4+1↓⍵}⍣50⊢0 1 ¯3
Nowhere near “simple and natural,” though.
-k
On Fri, Oct 30, 2015 at 11:01 AM, Elias Mårtenson wrote:
>
> 4×+/{(¯1*⍵+1)÷¯1+2×⍵}¨⍳100
>
> The above expression performs 1 million iterations, but is also allocates a
> 1 million element array to do so.
I don't know GNU APL internals well enough to speak about when and how
memory is al
I was trying out an iterative solution to computing the value of π, being a
sum of a simple formula. I made a straightforward implementation like so:
* 4×+/{(¯1*⍵+1)÷¯1+2×⍵}¨⍳100*
The above expression performs 1 million iterations, but is also allocates a
1 million element array to do so