mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
Add more Nim examples (#2265)
* Add more Nim examples * Newlines :P * Replace it with openArray * Remove march, seq * fix typo
This commit is contained in:
@@ -89,3 +89,4 @@ From oldest to newest contributor, we would like to thank:
|
|||||||
- [Kale Blankenship](https://github.com/vcabbage)
|
- [Kale Blankenship](https://github.com/vcabbage)
|
||||||
- [George Gribkov](https://github.com/GeorgeGribkov)
|
- [George Gribkov](https://github.com/GeorgeGribkov)
|
||||||
- [Artem Akatev](https://github.com/aakatev)
|
- [Artem Akatev](https://github.com/aakatev)
|
||||||
|
- [Danil Yarantsev](https://github.com/Yardanico)
|
||||||
|
|||||||
5
examples/nim/Max_array.nim
Normal file
5
examples/nim/Max_array.nim
Normal file
@@ -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]
|
||||||
4
examples/nim/Sum_over_array.nim
Normal file
4
examples/nim/Sum_over_array.nim
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# For best results compile with -d:danger
|
||||||
|
proc sumArray(data: seq[int]): int {.exportc.} =
|
||||||
|
for elem in data:
|
||||||
|
result += elem
|
||||||
Reference in New Issue
Block a user