mojo
mojo copied to clipboard
[Feature Request] len(DynamicVector[T]) is not defined
Simple reproduction:
alias Vec2 = SIMD[DType.f32, 2]
var points = DynamicVector[Vec2]()
points.push_back(Vec2(0,0))
points.push_back(Vec2(1,0))
points.push_back(Vec2(2,2))
points.push_back(Vec2(3,1))
print(len(points))
output:
error: Expression [10]:23:14: no matching function in call to 'len':
print(len(points))
~~~^~~~~~~~
/.modular/Kernels/mojo/Stdlib/Len.mojo:20:1: candidate not viable: argument #0 cannot be converted from 'DynamicVector[SIMD[f32, 2]]' to 'String'
fn len(value: String) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:32:1: candidate not viable: argument #0 cannot be converted from 'DynamicVector[SIMD[f32, 2]]' to 'StringRef'
fn len(value: StringRef) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:44:1: candidate not viable: argument #0 cannot be converted from 'DynamicVector[SIMD[f32, 2]]' to 'StringLiteral'
fn len(value: StringLiteral) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:56:1: candidate not viable: callee expects 2 input parameters but 0 were provided
fn len[size: Dim, type: DType](value: Buffer[size, type]) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:68:1: candidate not viable: callee expects 1 input parameter but 0 were provided
fn len[type: AnyType](value: VariadicList[type]) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:80:1: candidate not viable: callee expects 1 input parameter but 0 were provided
fn len[type: AnyType](value: VariadicListMem[type]) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:93:1: candidate not viable: argument #0 cannot be converted from 'DynamicVector[SIMD[f32, 2]]' to 'ListLiteral[[]]'
fn len[*types: AnyType](value: ListLiteral[types]) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:106:1: candidate not viable: argument #0 cannot be converted from 'DynamicVector[SIMD[f32, 2]]' to 'TupleLiteral[[]]'
fn len[*types: AnyType](value: TupleLiteral[types]) -> Int:
^
/.modular/Kernels/mojo/Stdlib/Len.mojo:118:1: candidate not viable: callee expects 1 input parameter but 0 were provided
fn len[size: Int](value: StaticIntTuple[size]) -> Int:
Thank you for filing an issue. This is a glaring omission which has been fixed internally and will be rolled out ASAP
This has been fixed and will be part of the next release