Tips for golfing in Nim What general tips do you have for golfing in Nim? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Nim (e.g. "remove comments" is not an answer).

Please post one tip per answer.
Use the future module

The future module contains two main byte-saving features: lambdas and list comprehensions. Lambdas are extremely useful.

For example, this:

proc f(s:any):any=s&amp;", world!"


can be shortened to this:

import future
s=&gt;s&amp;", world!"


which saves a byte. Note, however, that lambdas can't be used outside of a parameter list -- so to test your code, you'll have to do something like this:

import future
proc test(f: string -&gt; string) = echo f "Hello"
test(s=&gt;s&amp;", world!")


As well, list comprehensions can be used with the future module. For example, this code prints a seq (@[...]) of all squares less than 100 divisible by 4:

import future
echo lc[x*x|(x&lt;-1..9,x*x mod 4==0),int]