From ff0a2bd8a13a1cc6703bff429580e09f6355ba6b Mon Sep 17 00:00:00 2001 From: flaviut Date: Wed, 28 May 2014 22:41:09 -0400 Subject: [PATCH] Get started --- .gitignore | 1 + src/README.md | 19 +++++++++++++++++++ src/SUMMARY.md | 5 +++++ src/book.json | 8 +------- 4 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/src/README.md b/src/README.md index e69de29..d9b8f46 100644 --- a/src/README.md +++ b/src/README.md @@ -0,0 +1,19 @@ +Nimrod is a powerful staticly typed language that allows the programmer expressivness without comprimizing run-time performance. +``` nimrod +import tables, strutils + +var wordFrequencies = initTable[string, int] + +for line in stdin.lines: + for word in line.split(", "): + wordFrequencies[word] += 1 + +var maxFrequency = 0 +var mostFrequentWord: string +for word, frequency in wordFrequencies: + if frequency > maxFrequency: + maxFrequency = frequency + mostFrequentWord = word + +echo "The most frequent word is '", word, "'" +``` diff --git a/src/SUMMARY.md b/src/SUMMARY.md index e69de29..6fd23a8 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -0,0 +1,5 @@ +# Summary + +Nimrod is a statically typed, imperative programming language that gives the +programmer powerful compile-time tools, allowing for expressiveness without +compromising run-time efficiency. diff --git a/src/book.json b/src/book.json index 1fd6d17..6335bfd 100644 --- a/src/book.json +++ b/src/book.json @@ -1,25 +1,19 @@ { "output": "../build/", - "title": "Nimrod by Example", "description": "A book of short examples of Nimrod features", - "github": null, "githubHost": "https://github.com/", - "plugins": [], - "links": { "home": "http://nimrod-lang.org/", - "about": null, "issues": null, "contribute": null, - "sharing": { "google": false, "facebook": false, "twitter": false } } -} +} \ No newline at end of file