nevalang / neva

🌊 Dataflow programming language with static types and implicit parallelism. Compiles to machine code and Go
https://nevalang.org
MIT License
124 stars 7 forks source link

reimplemented iter #565

Closed dorian3343 closed 6 months ago

dorian3343 commented 6 months ago

Finally finished iter, which gives us new capabilities when it comes to using lists. A nice example of using iter looks like this,

Print each character on a new line in Neva using Iter


component Main(start any) (stop any) {
    nodes {print Println<string>,iter Iter<string>,unw Unwrap<string>,del Del,split Split}
    net {
        :start -> [
                    ($s -> split:data),
                    ('' -> split:delim)
                ]
        split:res -> iter-> unw:data
        unw:some -> print -> del
        unw:none -> :stop
    }
}