Mandelbrot set: Difference between revisions

add Ruby
(added BASIC)
(add Ruby)
Line 410:
 
createmandel(-2-1i, 1+1i)</lang>
 
=={{header|Ruby}}==
{{needs-review|Ruby|This example does not use raster graphics operations.}}
Text only, prints an 80-char by 41-line depiction. Found [http://www.xcombinator.com/2008/02/22/ruby-inject-and-the-mandelbrot-set/ here].
<lang ruby>require 'complex'
 
def mandelbrot(a)
Array.new(50,a).inject(a) { |z,c| z*z + c }
end
 
(1.0).step(-1,-0.05) do |y|
(-2.0).step(0.5,0.0315) do |x|
print mandelbrot(Complex(x,y)).abs < 2 ? '*' : ' '
end
puts
end</lang>
 
=={{header|Tcl}}==
Anonymous user