Comments (8)
@msaelices it's ongoing changes, you can take a look at #2335
from mojo.
I propose to use 'NTuple[2, Int]' as the type alias for 'Tuple[Int, Int]', and 'NTuple[N, T]' in general, so that it can be easily dispatch on 'N'.
from mojo.
I propose to use 'NTuple[2, Int]' as the type alias for 'Tuple[Int, Int]', and 'NTuple[N, T]' in general, so that it can be easily dispatch on 'N'.
Can you elaborate on the value of the type alias? I'm not sure I understand the full value yet. Are there places you have in mind in the library that would benefit from this?
from mojo.
NTuple[2, Int] = Tuple[Int, Int]
NTuple[3, Int] = Tuple[Int, Int, Int]
Or In general I should be able to write
alias NTuple[N, T] = Tuple[VariadicPack[T, N]]
Then I can dispatch on NTuple[5,Int]
instead of Tuple[Int, Int, Int, Int ,Int]
, it's just shorter.
from mojo.
@JoeLoser while working on this I found a potential issue, StaticIntTuple is imported in builtin/int.mojo which exposes it everywhere as all builtins, is exposing stuff in this way intentional?
from mojo.
@JoeLoser while working on this I found a potential issue, StaticIntTuple is imported in builtin/int.mojo which exposes it everywhere as all builtins, is exposing stuff in this way intentional?
Maybe we should open an issue to have a new mechanism in the stdlib to define what exactly does not need import and what needs imports.
This issue has bitten me quite a few times.
EDIT: Created the issue and proposed a fix that must be implemented partly on the compiler side:
from mojo.
Seems like StaticIntTuple
is used a lot in the tests, for those cases it should be possible to replace it once Tuple
conforms to the Stringable
trait
from mojo.
Off-topic: Why _divmod
instead of the Python __divmod__
?
from mojo.
Related Issues (20)
- [BUG] Reinitializing mlvalue with itself introduces leaks HOT 1
- [BUG] address not mapped to object (fault address: 0x0).
- [BUG] Compiler bug in while loop HOT 2
- [Feature Request] returning values in `__del__` overload HOT 1
- [BUG] [mojo] Lazy evaluation of default parameters leads to fn Self signatures not matching HOT 4
- After run modular install max , I can not run max CLI
- [BUG] Reassign dict in a closure results in "Double free of object" HOT 1
- [BUG] Copying null `String`/`List` introduces bugs
- [BUG] [LSP] stderr logs have invalid encoding
- [BUG] "use of unknown declaration" on misuse of `@nonmaterializable`
- [Feature Request] Detect unconditional infinite recursion in parameters
- [Docs] Typo in K-Means Clustering Guide Posted May 20, 2024
- [BUG] using walrus operator needs variable declaration
- [BUG] [stdlib] Unicode escape sequences are interpreted as utf8 and misrepresented.
- [BUG] [stdlib] String's `UnsafePointer` does not give correct UInt8 values HOT 2
- [BUG] Inferred parameter bug when nesting parameters
- [BUG] Compiler and language server crash on the last use of a bytes slice
- [Feature Request] Add Type-checking when initializing Tensor/TensorShape with Tuple
- [BUG] Compiler optimization causing SIMD load to perform incorrectly
- [BUG] casting certain SIMD into a float32 requests 18446744073709518848 bytes of memory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mojo.