// sum weight of items carried by elf
elf_weight := 0;
for weight : elf {
elf_weight += weight;
}
I'm not familiar with Jai syntax.
I'm curious, does Jai have fold/reduce?
e.g. smtg like: `elf_weight := elf.reduce(0, +)`
I apologize if this is already covered in the article, I've only read about half of it. Also I'm sorry if this comes off as criticism of the code or of Jai, I'm just wondering what kind of iteration and array/list ops exist (without watching dozens of videos).
I apologize if this is already covered in the article, I've only read about half of it. Also I'm sorry if this comes off as criticism of the code or of Jai, I'm just wondering what kind of iteration and array/list ops exist (without watching dozens of videos).