What is the neatest way to compute a Mandelbrot fractal in APL? The fact
that you have to break out of the loop as soon as the absolute value of Z
is >2 makes it a bit ugly. Is there a neater way to do this?

This is what I came up with that works in GNU APL:

" #"[⌊0.5+50÷⍨ { (n ⊣ {(x+⍵×⍵) ⊣ n←n+1}⍣{(2<|⍺) ∨ n≥50} n←0) ⊣ x←⍵ }¨
(0J1×r) ∘.+ r←¯2+25÷⍨⍳100]

Any suggestions for improvements?

Regards,
Elias

Reply via email to