/nim-cookbook

Nim Programming Cookbook

Primary LanguageNimOtherNOASSERTION

Nim Programming Cookbook

The cookbook can be seen here: http://nim-cookbook.btbytes.com/

This cookbook is aimed at Nim programmers who have familiarity with the language and want to write programs in it. We, the authors and contributors of this cookbook would like this to be a useful resource for questions like — "How to do X with Nim?".

Writing new recipes, enhancing, proofreading, fixing bugs in the code are all a community effort. Please send your recipes, improvements and suggestions. Pull Requests are open.

Note to Recipe Writers

  • The Markdown files are processed into HTML by Pandoc.

  • The Nim code exists under the [code](code) directory.

  • Code files follow a "topicNN.nim" pattern. Eg: files01.nim.

  • There is a Makefile in the code directory that compiles all source files. Run make after you complete a recipe to make sure your program compiles. The Makefile has a build step to run all the programs and capture their output to $prog.output files.

  • Code is embedded into markdown files using this syntax:

```{.input include=code/ds01.nim startLine=1 endLine=7}
```
  • where:

    • .input is a CSS class directive. (use .output for showing proram output.)

    • include directive references the Nim source file to embed

    • startLine and endLine limit the lines of code embedded into the final HTML document on processing. Omitting these would include the entire file into the final document.

  • If you are looking to contribute to the project, see the Things to do kanban board!

License

This code and text are dedicated to the public domain. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

You may copy and paste any code here verbatim into your codebase, wiki, blog, book or dance production as you see fit. The Markdown and Nim source is available on Github. Pull requests are always accepted for changes and additional content. This is a living document.