app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" } import pf.Stdout # listLen = \list -> # List.len (list) # sumList = \counter, maxLen -> # if counter == maxLen then # 1 # else # newCounter = counter + 1 # ((sumList newCounter maxLen) + 1) sumList : Num *, Num * -> Num * sumList = \counter, maxLen -> if counter == maxLen then 1 else newCounter = counter + 1 ((sumList newCounter maxLen) + 1) plusTwo: Num a -> Num a plusTwo = \i -> i + 2 main = sum = sumList 0 7 Stdout.line! (Num.toStr(sum)) # nums = [1, 2, 3] # ind = 1 # res = List.get nums ind # when res is # Ok value -> value # Err OutOfBounds -> 0 i = plusTwo 4 Stdout.line! (Num.toStr(i)) # sum = sumList(0, 4) # #Stdout.line! (Num.toStr(sumList 2, 3)) # Stdout.line! (sum) # gomus = [1, 2, 3] # gomusLen = List.len( gomus ) # Stdout.line! (Num.toStr(gomusLen))