(This is a copy of a Reddit thread I posted yesterday)

I'm a complete beginner in Nim, and I've been trying to learn the basics by solving Advent of Code tasks.

I have previous Python experience and my Python solutions for AoC were my guidelines for solving these tasks.

The things I like in Nim:

  • speed (most of the time, at least one order of magnitude faster than Python)
  • "user-friendly" syntax (it was easy to translate some Python parts to Nim)
  • helpful tutorial
  • helpful community at IRC channel (if you guys are reading this - thank you for all your answers to my (sometimes quite stupid/basic) questions)

My Nim solutions

The thing I noticed - in tasks Day 07 and Day 09, where I use nre module, the speedup compared to Python is much smaller than usual. Is this the expected behaviour? Or can I do something to improve Nim speed there?

But the main reason why I'm posting this (after only 10 tasks) is because I would really like, before I continue with these tasks, if somebody more experienced would take some time to go through my solutions and to correct/improve my Nim.

If something can be done more idiomatically, if I should use different data types, if I didn't use some useful module/function, if there's a better and/or faster way to do some things - please let me know.

Thank you in advance!

2017-10-01 10:50:25

I've added day 12 solution, and updated some earlier tasks.

Any comments on the coding style? Something I could improve?

P.S. Why is this thread visible only if I'm logged in?

2017-10-05 17:09:55
Probably it was on moderation. Now it's visible. 2017-10-05 18:43:49

Probably it was on moderation. Now it's visible.

Yeah, it was fixed in the mean time.

Any comments/tips on the code maybe?

2017-10-08 06:00:18