commit 7779e36f864fc2c559195cc72fcff719c8424ed5 Author: joachimschmidt557 Date: Thu Mar 7 14:10:32 2019 +0100 Initial files diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85b4331 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +add +false +nakefile +seq +sleep +true diff --git a/add.nim b/add.nim new file mode 100644 index 0000000..46c67d2 --- /dev/null +++ b/add.nim @@ -0,0 +1,6 @@ +import cligen, sequtils + +proc main(integers:seq[int]) = + echo integers.foldl(a + b) + +dispatch(main) diff --git a/false.nim b/false.nim new file mode 100644 index 0000000..fbc72bf --- /dev/null +++ b/false.nim @@ -0,0 +1,6 @@ +import cligen + +proc main() = + system.quit(1) + +dispatch(main) diff --git a/nakefile.nim b/nakefile.nim new file mode 100644 index 0000000..43a373f --- /dev/null +++ b/nakefile.nim @@ -0,0 +1,8 @@ +import nake + +task "compile", "Compile nimbase": + discard shell(nimExe, "c", "true.nim") + discard shell(nimExe, "c", "false.nim") + discard shell(nimExe, "c", "sleep.nim") + discard shell(nimExe, "c", "seq.nim") + discard shell(nimExe, "c", "add.nim") diff --git a/seq.nim b/seq.nim new file mode 100644 index 0000000..60d10a1 --- /dev/null +++ b/seq.nim @@ -0,0 +1,9 @@ +import cligen + +proc main(last:int, first=1, increment=1) = + var i = first + while i <= last: + echo(i) + i = i + increment + +dispatch(main) diff --git a/sleep.nim b/sleep.nim new file mode 100644 index 0000000..cd23deb --- /dev/null +++ b/sleep.nim @@ -0,0 +1,6 @@ +import os, cligen, sequtils + +proc main(secs:seq[int]) = + sleep(secs.foldl(a + b) * 1000) + +dispatch(main) diff --git a/true.nim b/true.nim new file mode 100644 index 0000000..4d6b8e4 --- /dev/null +++ b/true.nim @@ -0,0 +1,6 @@ +import cligen + +proc main() = + system.quit(0) + +dispatch(main)