Modular

M

Modular

This server is the home of the MAX and Mojo community! Join us to chat about all things Modular.

Join

questions

community-showcase

Stackoverflow?

Does anyone know how to use Stack Overflow for mojo questions? The mojo tag on Stack Overflow has the following description: SDK for development of webOS 1.x and 2.x apps using JavaScript and HTML. or... Most commonly used to designate plugin development in Maven (Java build tool). For the Perl web toolkit, use [tag:mojolicious] Mojo is also a programming language and superset of Python. Check https://www.modular.com/mojo for more details....

How to use Modulo?

This works print(10%) but I can't use % in a method: ```def is_prime(n): for i in range(2,n): if (n%i) == 0:...

Thread safety

Mojo looks very interesting! Are there any plans to statically prevent data races like what Rust does with the Send/Sync traits (in combination with the borrow checker)?

string chars to uint8

Any examples on how to access string characters and convert them to something similar to python bytes? In general any examples of types conversion would be helpful

Mojo code to python?

I was baking a project and i saw that including somes mojo code in my app could make it 🔥 but my main app is in python, Question: Is it possible to use mojo in python ? I know its possible to do python to mojo though...

How to type a callback?

as in, var callback: whatGoesHere?

newbie needs help with error messages

the code: ``` @register_passable("trivial") struct Item: var name: StringLiteral...

Print statement stops working after array instantiation

I created a custom array here with the help of the devs at one point and when messing around with it noticed that after instantiating it with a trivial int type that it stopped the program without any errors.

Can I call a (compiled) Mojo function from Python?

Otherwise, do we have any ETA for when that is going to be available? It seems like the killer feature for Mojo.

What is the correct way of serving restful api in short and long term in mojo?

Should we keep on using python for that? If we should do it from scratch, or there are already mojo way of doing it, how?

how do you disambiguate function calls

also, can you disambiguate between these two: ```Rust fn mul(self, other: MY_SIMD[type,1]): // splat multiply fn mul(self, other: MY_SIMD[type,simd_width]):...

What kind of list should I use to add struct instances

Example struct: ``` struct Item: var name: StringLiteral fn init(inout self):...

please add support for spacy and fastapi

please add support for spacy and fastapi

GUI related stuffs

I'm wondering if we can use other gui framework like PySide6, PyQt6 since I saw an example in docs using matplotlib, is there any future realease for gui framework easy to integrate with Mojo? any feature like plotting realtime data with pyqtgraph and reach fast fps?

How to add an instance of a struct to a DynamicVector

A total newbie question. Example: struct Item: var name: StringLiteral fn init(inout self):...

__moveinit__ and __del__

When the __del__ method is not implemented, the __moveinit__ method is less likely to be invoked. Why is this the case? Consider the following example code: ```mojo struct Pair: var x: Int...

interoperability for calls from Python to Mojo

As of now, I've only seen examples that demonstrate interoperability from Mojo calling Python. When will Mojo support interoperability for calls from Python to Mojo?

`llvm.add` is interpreted as `llvm.addrspacecast`

./std/primitive.mojo:71:64: error: 'llvm.addrspacecast' op requires a single operand
value: __mlir_op.`llvm.add`[_type: __mlir_type.i32](self.value, rhs.value)
./std/primitive.mojo:71:64: error: 'llvm.addrspacecast' op requires a single operand
value: __mlir_op.`llvm.add`[_type: __mlir_type.i32](self.value, rhs.value)
This feels like it's not working correctly, considering add is documented as something else....

Add documentation for Runtime

In a Mandelbrot notebook, we have seen examples of using Runtime, but as for now there is no documentations about arguments, use cases, etc. Any plans to provide more information? Thank you.