> We had a long discussion on #nim IRC channel about this today, and there are 
> two possible solutions

yes, thank you! I saw the discussion earlier this morning and I was able to fix 
that (I did initialize the HashSet with the defaults...). I pushed the changes 
and also activated the issues. :)

As a first day it was definitely fun.

As far as the learning process went, I struggled a little bit with the types (I 
realize now how much type inference and casting is done in Python) and also I 
still do not get the syntax right at the beginning (in particular when handling 
types, initializing variables and calling functions).

As could have been expected, searching how to do stuff is less easy than in 
python (where, for every "dumb" question - and I had a lot - you find the 
answer on Stack Overflow).

I was impressed by the help from Visual Code in spotting errors (and giving 
hints on what is wrong). Is this because of nimsuggest that I saw mentioned 
around? What exactly is that?

Anyway, Visual Code was even able to tell me that I could not use the built in 
set implementation because my input file contained integer that did not fit in 
16 bits. It would highlight an error over the parseInt below and give me 
instances of illegal conversions:
    
    
    const changes = map(readFile("./inputs/01.txt").splitLines, proc(x: 
string): int16 = int16 parseInt(x))
    
    
    Run

I guess this was due to the fact that I was using the const (I really like the 
idea of compile time constants). In fact when I change the declaration to a 
let, the error disappears (well, it still there, I just do not know about it). 
In order to do that it has to do the compilation on the fly, right? Are there 
mechanism to prevent computations that might take too much time?

I still would like to fire up an interpreter (a couple of times I did use `nim 
secret`). I very much look forward too the REPL that is in the works.

Something in the end I was not able to understand how to do is how to print the 
type of a variable. It is something that in python I do once in a while and I 
realize that it might not make much sense in Nim (where I can just hover over 
the variable in the IDE), but still, what is the correct way to make this work?
    
    
    const instructions = @["+1", "-1"]
    echo type(instructions) # this raises error
    
    
    Run

Reply via email to