Ryulord
Ryulord
MModular
Created by Zbornak on 1/16/2025 in #questions
Problem with simple card shuffle program
it's not clear from the docs but random_ui64 returns a value in the provided range inclusive on both ends so you have some out of bounds indexing happening
5 replies
MModular
Created by Ogarit on 12/27/2024 in #questions
Starting with Mojo
Advent of code is a nice way to get familiar. There's a channel for it so you can check other people's solutions if you get stuck and learn some things that way.
3 replies
MModular
Created by Teszaract on 12/20/2024 in #questions
Single Executable Binary just like Go Lang?
There's nothing stopping you from charging to use your library. People can only legally use your code if you let them or if it's fair use. There are even non-commercial licenses if you want other open-source/non-profit folks to be allowed to use it but businesses
10 replies
MModular
Created by Teszaract on 12/20/2024 in #questions
Single Executable Binary just like Go Lang?
static linking is when the compiler puts the compiled library code inside the executable so that the executable is standalone. The alternative, dynamic linking, has the executable look for other files (.dll or .so) when you start it and it tries to use those, which means you need to be sure that they're installed, the correct version, and in the right path, which is a pain.
10 replies
MModular
Created by Teszaract on 12/20/2024 in #questions
Single Executable Binary just like Go Lang?
Ah, good to know. Static linking would definitely be nice
10 replies
MModular
Created by Teszaract on 12/20/2024 in #questions
Single Executable Binary just like Go Lang?
It already does. mojo build does exactly what you want. Nevermind. See Owen's comment. https://docs.modular.com/mojo/cli/build/
10 replies
MModular
Created by Ivo Balbaert on 12/17/2024 in #questions
Is there a way in Mojo to know the type of a variable/object ?
No but it's very rare you'd need something like that since all types are known at compile time. Can you describe your use case? There's probably a way to do what you want to do.
93 replies
MModular
Created by sean5446 on 12/16/2024 in #questions
Is there a ticket to follow for regex in mojo?
You probably need to verify your account if you haven't already. Otherwise I'm not sure what the issue is
4 replies
MModular
Created by sean5446 on 12/16/2024 in #questions
Is there a ticket to follow for regex in mojo?
Someone built a simple regex lib a while back. I don't recall where exactly I saw it mentioned though. Regex isn't directly related to the business value of Mojo from Modular's perspective so it's not going in the standard lib anytime soon. You could also take the opporunity to learn how to make a regex engine from scratch.
4 replies
MModular
Created by christian_drake on 11/26/2024 in #questions
Bug or Feature
can you provide a code example? While loops should be indented just like in normal python and I've never had the issue you're describing
16 replies
MModular
Created by Shubham on 10/29/2024 in #questions
Using Mojo For Back-end Web Development
You probably wanna check out lightbug https://github.com/saviorand/lightbug_http
5 replies
MModular
Created by aurelian on 10/20/2024 in #questions
why does this String init work without len?
it expects your buffer to be null terminated so if you don't provide a length then it can just scan for the first null to figure out the length itself
52 replies
MModular
Created by Martin Dudek on 10/18/2024 in #questions
List of references in Mojo
The Reference type is usable but still kinda a pain. Arc is also an option
8 replies
MModular
Created by Martin Dudek on 10/18/2024 in #questions
List of references in Mojo
I think you might just want a List[List[Int]]
8 replies
MModular
Created by banananas on 9/25/2024 in #questions
Assigning additional traits to Variants
Adding methods to existing types is a planned feature but not here yet so for now you'll have to do the wrapper type approach as previously mentioned or just make a standalone function
6 replies
MModular
Created by banananas on 9/23/2024 in #questions
Is there a Struct type or something similar?
since that basically is all it would be doing
21 replies
MModular
Created by banananas on 9/23/2024 in #questions
Is there a Struct type or something similar?
I don't think you actually want variant to conditionally conform to every trait. I think that would be better served with dynamic polymorphism when we eventually get it
21 replies
MModular
Created by banananas on 9/23/2024 in #questions
Is there a Struct type or something similar?
not too surprising since it's variant so it would need to conditionally conform to everything
21 replies
MModular
Created by banananas on 9/23/2024 in #questions
Is there a Struct type or something similar?
I guess that technically works for a list but doesn't for set since it isn't hashable
21 replies
MModular
Created by banananas on 9/23/2024 in #questions
Is there a Struct type or something similar?
if you mean something like my_list = List(Int, Float64, Point2d) then this isn't possible atm but I would also like to see it
21 replies