Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Learning Jai via Advent of Code (forrestthewoods.com)
17 points by forrestthewoods on Feb 14, 2023 | hide | past | favorite | 1 comment


Day 01 example >

    // 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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: