3 ms·
Hmm, I'm not sure about this at the moment, at least based on the available documentation - the first thing I tried to do was extend the "parallel fib" example
by coolreader18 6y ago
Hmm, I'm not sure about this at the moment, at least based on the available documentation - the first thing I tried to do was extend the "parallel fib" example to be fully parallel inside `fib` itself[0] but I wasn't able to figure out how to create a `sum :: [int] -> int` function at first (it wasn't clear that arrays are just JS Arrays, and I can just call methods on them) and I'm still not sure why my code doesn't output anything.
[0]: https://clio-playground-pouyae.vercel.app/ https://clio-playground-pouyae.vercel.app/ with code:
fn fib n:
if n < 2: n
else: [n-1 n-2]
-> * await |fib|
-> *
console.log
sum
fn sum arr:
arr.reduce add 0
fn add a b:
a + b
export fn main args:
[5 6]
-> * await |fib|
-> * item: console.log item