diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index eddc5dd68..0fc3d9e17 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -89,3 +89,4 @@ From oldest to newest contributor, we would like to thank: - [Kale Blankenship](https://github.com/vcabbage) - [George Gribkov](https://github.com/GeorgeGribkov) - [Artem Akatev](https://github.com/aakatev) +- [Danil Yarantsev](https://github.com/Yardanico) diff --git a/examples/nim/Max_array.nim b/examples/nim/Max_array.nim new file mode 100644 index 000000000..52e3e79f2 --- /dev/null +++ b/examples/nim/Max_array.nim @@ -0,0 +1,5 @@ +# For best results compile with -d:danger +proc maxArray(x: var seq[float], y: seq[float]) {.exportc.} = + for i in 0 ..< x.len: + if y[i] > x[i]: + x[i] = y[i] diff --git a/examples/nim/Sum_over_array.nim b/examples/nim/Sum_over_array.nim new file mode 100644 index 000000000..fe55708d7 --- /dev/null +++ b/examples/nim/Sum_over_array.nim @@ -0,0 +1,4 @@ +# For best results compile with -d:danger +proc sumArray(data: seq[int]): int {.exportc.} = + for elem in data: + result += elem