trouble with mandelbrot example

Newb here. I've copied code from the mandelbrot example, placing it into the file mandel.mojo, which I've copied here: https://gist.github.com/nbecker/820a6f740e4bad43bb09a52103d5b19b When I run mojo mandel.mojo I get lots of errors:
mojo: /lib64/libtinfo.so.6: no version information available (required by mojo)
/home/nbecker/mojo/mandel.mojo:59:1: error: TODO: expressions are not yet supported at the file scope level
show_plot(compute_mandelbrot())
^
/home/nbecker/mojo/mandel.mojo:36:23: error: use of unknown declaration 'Tensor'
def show_plot(tensor: Tensor[float_type]):
^~~~~~
/home/nbecker/mojo/mandel.mojo:11:26: error: use of unknown declaration 'ComplexFloat64'
def mandelbrot_kernel(c: ComplexFloat64) -> Int:
... more errors
mojo: error: failed to parse the provided Mojo
mojo: /lib64/libtinfo.so.6: no version information available (required by mojo)
/home/nbecker/mojo/mandel.mojo:59:1: error: TODO: expressions are not yet supported at the file scope level
show_plot(compute_mandelbrot())
^
/home/nbecker/mojo/mandel.mojo:36:23: error: use of unknown declaration 'Tensor'
def show_plot(tensor: Tensor[float_type]):
^~~~~~
/home/nbecker/mojo/mandel.mojo:11:26: error: use of unknown declaration 'ComplexFloat64'
def mandelbrot_kernel(c: ComplexFloat64) -> Int:
... more errors
mojo: error: failed to parse the provided Mojo
This is running on fedora 38 linux, using an ubuntu container. Any ideas?
Gist
mandel test
mandel test. GitHub Gist: instantly share code, notes, and snippets.
3 Replies
gryznar
gryznar14mo ago
Probably you should copy it in main() func
fn main():
.... # code goes here
fn main():
.... # code goes here
Mpjo needs an entrypoint and this requires main() function
ModularBot
ModularBot14mo ago
Congrats @gryznar, you just advanced to level 3!
Heyitsmeguys
Heyitsmeguys14mo ago
And I think your code is missing some imports, which is causing the "unknown declaration" errors
Want results from more Discord servers?
Add your server