Initial files
This commit is contained in:
commit
7779e36f86
7 changed files with 47 additions and 0 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
add
|
||||
false
|
||||
nakefile
|
||||
seq
|
||||
sleep
|
||||
true
|
||||
6
add.nim
Normal file
6
add.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import cligen, sequtils
|
||||
|
||||
proc main(integers:seq[int]) =
|
||||
echo integers.foldl(a + b)
|
||||
|
||||
dispatch(main)
|
||||
6
false.nim
Normal file
6
false.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import cligen
|
||||
|
||||
proc main() =
|
||||
system.quit(1)
|
||||
|
||||
dispatch(main)
|
||||
8
nakefile.nim
Normal file
8
nakefile.nim
Normal file
|
|
@ -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")
|
||||
9
seq.nim
Normal file
9
seq.nim
Normal file
|
|
@ -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)
|
||||
6
sleep.nim
Normal file
6
sleep.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import os, cligen, sequtils
|
||||
|
||||
proc main(secs:seq[int]) =
|
||||
sleep(secs.foldl(a + b) * 1000)
|
||||
|
||||
dispatch(main)
|
||||
6
true.nim
Normal file
6
true.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import cligen
|
||||
|
||||
proc main() =
|
||||
system.quit(0)
|
||||
|
||||
dispatch(main)
|
||||
Loading…
Add table
Add a link
Reference in a new issue