TheBeege
TheBeege
MModular
Created by TheBeege on 4/13/2024 in #questions
What's the proper way to use List?
Anytime I use List, I hit issues with Reference. Looking through docs, I see that Reference is related to unsafe memory operations. I'm looking into how to avoid variable-length collections using parameters, but I'd like to get this working first, at least. Any ideas?
from collections import List

fn main():
var my_list: List[Int] = List(1, 2, 3)
for member in my_list:
for i in range(member):
# failed to infer parameter 'type', argument type 'Reference[Int, 1, my_list]' does not conform to trait 'IntableRaising'
print("counting: " + i)
from collections import List

fn main():
var my_list: List[Int] = List(1, 2, 3)
for member in my_list:
for i in range(member):
# failed to infer parameter 'type', argument type 'Reference[Int, 1, my_list]' does not conform to trait 'IntableRaising'
print("counting: " + i)
Edit: I tried adding a var count: Int = member.value in there but to no avail.
4 replies