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

Cannot run a Fibonacci sequence function in the Playground.

I just copied a simple Python function to a playground cell, and the code won't run, and gives me the error:
expression failed to parse (no further compiler diagnostics)
The function is a run-of-the-mill array based Fibonacci sequence generator. ...

Range of SIMD[DType, 1]

Will the range function ever be extended to work for values of SIMD types? This question can also expand to the various methods and functions that expect other datatypes that are inherently similar to SIMD types. I know I can use the to_int() method on the SIMD type, but that just makes the code larger and potentially loss performance.

majo packages

I was wondering if mojo has any packages outside the ones that has been preinstalled with it. And if so how do I download them?.

VScode plug-in :the path to the modular_home containing the mojo sdk installation

I use macos , I can't find the path . I'm new in programming , how to solve this problem ? thanks :mojo:
No description

Mojo in llm?

Hello, guys! I am currently investigating the capabilities of the Mojo, especially in the context of pretraining large-scale models. Does anyone know if Mojo provides support for this kind of extensive pretraining? Additionally, I am looking for any recent research or case studies that discuss the use of Mojo for pretraining large models. If there are benchmarks or any comparisons with other frameworks, that would be particularly helpful. If you've had experience with Mojo in this area or know o...

Differences between class and struct

I know classes aren't implemented yet and structs aren't complete, but do we have a sense what they are going to look like when they're done and what their differences will be? I have a few specific questions: 1. Will classes be a high-level pythonic version of structs (like def is to fn) or will classes have low-level performance? 2. I know structs will eventually work with traits and will probably be able to use extensions in a way similar to inheritance. Will classes work with traits or will they have to inherit from other classes? 3. Given that Mojo is aiming for python compatibility, I imagine classes are going to have to support multiple inheritance. Since it can be a pretty controversial feature, will structs support anything like multiple inheritance through multiple extensions?...

Outputting Items in a tensor

I there ant way to print all the items in a tensor at once rather than iterating through the tensor index by index.

Examples of Python code that will never work with Mojo?

Hello, afaik, Mojo is intended to be a Python superset (a sort of Python++), but at the same time, Modular has made it very clear that Mojo won’t be a “Python compiler”, implying that some of the more dynamic Python features won’t work as expected in Mojo (that’s what I understood from some of the Q&A sessions and interviews). Do you have any specific examples of Python features that will never work with Mojo, not because they aren’t supported yet, but because by design Mojo won’t be able (or willing) to compile them? For example, redefining intrinsics/builtins? Walking and modifying its own AST and semantics (as some Python-based DSLs do)? Deleting and redefining class methods or attributes? C extensions, C++/Rust bindings?...

My code is not working

let builtins = Python.import('builtins'); let array = Python.import('array'); the import on both of these is red and swiggly, the full code is ...

Error debugging Mojo in Visual Studio Code

I'm getting the following error when trying to debug a mojo file in vscode using latest version of Mojo on WSL and latest version of the Mojo extension in vscode: "(debugConfiguration.env || []) is not iterable" I notice an issue has been raised in Github very recently so may be a new problem. ...

How to Implement Recursive data type

I want to Implement abstract syntax tree in mojo, so far no luck, Something simple as this in C : https://github.com/orangeduck/mpc/blob/master/mpc.h#L291 ``` struct ast {...

Fastest Matrix Multiplication

I have read somewhere in this discord that the matmul function showcased in the matmul notebook is not the fastest implementation possible in Mojo. When will the Mojo language include the fastest implementation, if ever?

Where are the types documented?

The programming manual has a section on strong types, but it doesn't actually enumerate the primitive types there. Where can I find a full enumeration of the available primitives?

Inspect and modify AST (eg of a simple function)

Hi is it possible to inspect or modify the ast of a function within my program?

SQL Database support

hey guys. i wanna know mojo have any library like sqlalchemy in python? i rather to use a full mojo library instead of python library...

is it wise to start with Modular as your first language?

I want to know if it is wise to start with Mojo or elsewhere first. If starting with Mojo is the way to go what documents do we have to share or work with as we learn? Thanks...

How run python code in mojo ?

I am using django run code to un models in the mojo

Compile time properties?

Is it possible to make compile-time properties for structs? Mojo doesn't seems to support @property right now. So the only way to implement custom properties in mojo right now is to use the __getattr__() function, which isn't a performant solution. I want to make some vector classes that support "swizzling" like in GLSL (e.g. Vec3(1,2,3).xz gives Vec3(1,3)). I achieved this in Cython by generating every possible combinations (about 50k lines). But I think with advanced parameterization in mojo, this can potentially be much simpler while keeping maximum performance....

Iterables

Have trying out iterables (iter(self)) and for most part they already work. The only thing is that they are supposed to throw a "StopIteration" exception when done. Seems that exception is not yet exposed in the Mojo SDK. Also when raising an exception, Mojo forces you to catch them at the caller side, which is not what you want when iterating. ...