Cannot create a `DTypePointer` from `pointer<scalar<...>>`
how do I cast a
pointer
(btw, what is this? a MLIR type?) to a Pointer
or preferably a DTypePointer
? Inspired by this code,
``py
out_arr.data = DTypePointer[dtype](
__mlir_op.
pop.index_to_pointer[
_type : __mlir_type[
!kgen.pointer<scalar<f32>>`]...Bug, while loop Re-setting values?
for some reason , the while loop is resetting the value of the variable state.is it a bug?
var state = "dumb path"
print("state assigned dumb path outside of loop", state)
let v_sync_enable =glfw.swap_interval(1)...
What is difference between `__init__(...) -> Self` vs `__init__(inout self, ...)`?
I'm familar with the later which is similar to what we typically write in Python. But what is the former one? It seems compile time with
@register_passable
structs always use that pattern.Printing the type of a variable in Mojo
is there a way to print the variable type in mojo?
var state = open_file_explorer()
print(type(state))...
Cross-directory Imports
Simply put, how do I import
Array
defined in src/array/array.mojo
from src/vector/vector.mojo
?Global variable definition from a function?
creation of global variable from a function , with keyword like global. is there any plan to add such a feature?
Catch22 Support?
How can MOJO implement catch22 support like c does with function prototypes where foo and bar could both call each other?
Pass variadic arguments or parameters?
Is there a way to do this currently?
```Rust
from utils.list import VariadicList
fn func1(*a: Int):...
Will Mojo be a multipurpose language?
I’ve seen this debate come up a few times now and I’d like to get an official reading on the question: “Is Mojo a multipurpose language or an AI specific language?” In other words: “Are the design features built with AI in mind or * focused on AI*?”
Does Mojo already have a place to find libraries to install and use? Like a crates.io but f
How can I install packages to Mojo?
Core Library Conversions - What has/will been done?
Disclaimer: I'm kinda new to this; but I know python well enough to create dashboards for work and private.
My objective is to assist with converting preexisting Python 3.10 libraries to Mojo using this daring project:
https://github.com/msaelices/py2mojo...
Module loading error
I have a module with a following file structure as shown in the attached images.
In the types folder there is an
__init__.mojo
file that imports the main type/function in the submodules for pretty importing by the user. The submodules similarly contain an _init_.mojo
that imports the associated type/function so the main init can also cleanly import said type/function. This, however, is an issue according to Mojo.
Attempting to compile this gives the following issue:...Is there a way to simulate stdin in Mojo?
I wrote a basic
input()
function and created an automated test script on GH but want to add tests to the input()
function. Because of this, I'd like to be able to feed a pre-made answer into the stdin, is this possible?
The input()
function:
```mojo
from python import Python, PythonObject...Mojo Binary Sizes?
Are compiled binaries in mojo lighter in size compared to c, c++, or rust? I’m asking because I’m really interested in the embedded systems aspect of using this language and I’m curious on how lean it is.
Installing mojo in ubuntu only works with root
Hi, I am trying to install mojo in my ubuntu server following different guides and tutorials. I always see that people can install it in their home folder, but for me only works with root. I guess this is something related with my user permissions or configuration, rather than mojo, but I've already tried different workarounds and nothing works. Appreciate help, since having to run mojo as root all the time is a little bit inconvenient.
Yolov8 support with mojo
Hi all,
I am working on an object detection project and after seeing videos online I knew I HAD to try mojo.
It uses open cv and yolo to mask a video feed, either from a webcam or recorded video, and then detects the number of objects. ...
GitHub Actions/Runner - Mojo
I created a GH Action that would download and run Mojo here. Unfortunately, even after running
modular clean
, re-installing, using GITHUB_PATH, running in an Ubuntu container (cause the runners are just containers), and attempting to add mojo
to the normal PATH both ways (bash and zsh) it still gives the error mojo: command not found
. What am I missing?Calling mktime from mojo
I'm trying to call C's mktime from mojo but I seem to get a negative number.
Here's the code, is the external call correct? mktime returns a
time_t
which should be a positive int, but I see a negative value.
https://github.com/sa-/mo-time/blob/02cf8d1ccdd92ab1ca0863f1538d342d48b18f59/mo_time/date_time.mojo#L73...