Code Monkey home page Code Monkey logo

nim-basics's People

Contributors

adamarous avatar dom96 avatar glaforge avatar mikemoreno avatar narimiran avatar pmunch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nim-basics's Issues

Change title of "Who is this not for?"

I'm very experienced, and this tutorial really brought up to light quickly the syntax differences of nim. I don't think this is "not for advanced folks". Perhaps there is a better way to say this:

"Looking for something beyond the basics?" perhaps

Mention scalable codebases as a reason for strong types?

In this section:
"Types might seem like a restriction at first, but they allow the Nim compiler to both make your code faster, and make sure you’re not doing something wrong by accident."

Large code bases in particular really are much easier to manage with strong types. Perhaps this is worth mentioning.

I thought this sentence above sounded a little too humble. Strong types are awesome.

Use of counter variable

If we also need to have an iteration counter (starting from zero), we can achieve that by using for , in : syntax. This is very practical if you want to iterate through one iterable, and simultaneously access another iterable at the same offset.

However, as far as I know, this works only with strings, it does not work for iterators in general (for example countTo fails). However, it does work on containers. At least in my Nim 1.4.0.

So I suggest changing the text to:

If we also need to have an iteration counter (starting from zero), we can achieve that by using for , in : syntax. This is very practical if you want to iterate through one container, and simultaneously access another container at the same offset. Containers are explained just a little bit later.

suggest to put epub and pdf in releases

As the epub and pdf are generated files, it makes sense to put them in releases rather than in git - git isn't really made for that, and releases can be associated with tags. For GITenberg, we've actually used travis-ci to build epub and pdf (including from asciidoc source!) whenever a repo is tagged.

Edit to Basic data Types - Integers - 3rd paragraph

Hi Miran, this line in basic data types - Integers - 3rd paragraph:

"The expected mathematical operators — addition (+), subtraction (-), multiplication (*), and division (/) — work as one would expect. The first three operations always produce integers..."

echo 3.5 * 2 #=> 7.0
echo 3.5 + 2 #=> 5.5
echo 3.5 - 2 #=> 1.5

Possible edit:
"The first three operations always produce integers when both operands are integers, and produce a float (floating point number ie decimal) if one or more of the operands is a float, ..."

Reading user input section

This is no longer true:

"VS Code users cannot run this the usual way (using Ctrl+Alt+N) because output window doesn’t allow user inputs. This needs to be run in the terminal."

I just ran the example from vscode and typed my name in the output window and it worked fine.

Hint: c:\Projects\Nim\interaction.exe [Exec]
What is your name?
Robert
Hello Robert, nice to see you.

procedure findBiggest is buggy

because if the argument passed is a sequence of all negative numbers, the result is 0 (which is not an element of the list).
It should be pointed out that proc is like so just for telling about the implicit variable 'result' behavior.

Show an example of importing a module not in current directory

This was a question that went through my mind as modules can be quite complex in various languages.

What character do I use for path separator to get a file in a sub directory?
what happens if I import a directory? what file does it choose first?

changes in Nim 0.19

At result.nim you write: "Beware! The default value of strings and sequences is nil, and when we use them as returning types, the result variable needs to be initialized as an empty string ("") or as an empty sequence (@[])."

It changed in Nim 0.19. The default value of strings and sequences is "" and @[]. See https://nim-lang.org/blog/2018/09/26/version-0190-released.html .

BTW, I love this tutorial. Do you plan a continuation?

Add a section about parsing command line parameters

From discord:

[3:50 PM] yumi: how about a little section on how to parse command line parameters?
[3:50 PM] yumi: i was using commandLineParams().contains because the first result for flag parsing was a stackoverflow question
[3:51 PM] yumi: but then it turned out parseOpt existed

Change the font to not have ligatures

Your font has something weird going on with "fi" sequences. My guess is its because the font you are using has ligatures, usually there's a version of the font without it.

Precedence of Operators

A suggested addition to
Basic Data Types -> floats
(or maybe its own sub-section)

An extended example with two operators of the same precedence, e.g.

5.0 * 3.0 mod 10.0
is evaluated as
(5.0 * 3.0) mod 10.0
because multiplication and modulus have the same precedence level

It might help to include a reference to Precedence Levels at https://nim-lang.org/docs/manual.html#syntax-precedence

How to translate to other language?

How to translate to another language?

I forked original to my GitHub and opened selected russian branch.
Should I send pull requests?
Are any limitations exist related to copyright/left, for example, can I extend translation more than original with extra themes, or change format (LaTeX markup or something like this)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.