Weichen-16小時的自由人
Weichen-16小時的自由人
MModular
Created by Nexus-6 on 9/10/2023 in #questions
Windows native SDK support
Agree
110 replies
MModular
Created by ivellapillil on 5/15/2024 in #community-showcase
Online book on Mojo
Thanks for your effort 😊 It's really awesome 👍
34 replies
MModular
Created by Mak on 11/4/2023 in #questions
Encountering problem with the modular install mojo command on windows 10 through ubuntu as shell
Sorry 😟 I don't know. Maybe you can create an issue on Mojo's repository.
4 replies
MModular
Created by Mak on 11/4/2023 in #questions
Encountering problem with the modular install mojo command on windows 10 through ubuntu as shell
As far as I know, windows doesn't support Mojo at the time. But you can install Mojo in WSL2 (Windows subsystem Linus 2).
4 replies
MModular
Created by b4rdarian on 10/24/2023 in #questions
Confusion with owned integers
Thanks for the link. It helps me to get a better understanding of ownership.
32 replies
MModular
Created by b4rdarian on 10/24/2023 in #questions
Confusion with owned integers
So, did you mean it is not a bug?
32 replies
MModular
Created by b4rdarian on 10/24/2023 in #questions
Confusion with owned integers
I'm encountering the same problem. I'm using modular playground. The version of mojo kernel should be v0.4.0 at the time.
According to Argument mutability and ownership I modified the function from the example in the docs.
My modified example:
fn add_owned(owned x: Int, owned y: Int) -> Int:
x += 10
y += 20
return x + y
fn add_owned(owned x: Int, owned y: Int) -> Int:
x += 10
y += 20
return x + y
Situation 1: a and b are declared as var
fn main_1():
var a: Int = 100
var b: Int = 200
print("a: ", a, "b: ", b)
let c = add_owned(a, b)
print("c: ", c)
print("a: ", a, "b: ", b)

main_1()
fn main_1():
var a: Int = 100
var b: Int = 200
print("a: ", a, "b: ", b)
let c = add_owned(a, b)
print("c: ", c)
print("a: ", a, "b: ", b)

main_1()
The result:
a: 100 b: 200
c: 330
a: 100 b: 200
a: 100 b: 200
c: 330
a: 100 b: 200

It works.
Situation 2 a and b are declared as let
fn main_2():
let a: Int = 100
let b: Int = 200
print("a: ", a, "b: ", b)
let c = add_owned(a, b)
print("c: ", c)
print("a: ", a, "b: ", b)

main_2()
fn main_2():
let a: Int = 100
let b: Int = 200
print("a: ", a, "b: ", b)
let c = add_owned(a, b)
print("c: ", c)
print("a: ", a, "b: ", b)

main_2()
The result:
expression failed to parse (no further compiler diagnostics)
expression failed to parse (no further compiler diagnostics)
It looks like Mojo didn't make copies of a and b separately.
32 replies
MModular
Created by Elaid Tebabkha on 9/29/2023 in #questions
Can't find libpython
https://github.com/modularml/mojo/issues/551 This post also helps me a lot.
29 replies
MModular
Created by Elaid Tebabkha on 9/29/2023 in #questions
Can't find libpython
I encountered the same problem. I followed you instructions, then the problem got solved. The only different part is that my libpython is under /usr/lib/x86_64-linux-gnu/ instead of /usr/lib I'm using WSL2. I guess that's why my libpython is under different location. Thank you, Jack.
29 replies