Overflow Checks

2023-03-06 Thread MichalMarsalek
Nim's unsigned ints do not model integers. They model integers modulo 2^width. 
As such, the results are accurate.


Array concatenation

2023-01-07 Thread MichalMarsalek
Makes one wonder why `toSeq` is called `toSeq` and not ``@``...


Nim v2: what would you change?

2022-12-21 Thread MichalMarsalek
Would allowing `div` to be used in both contexts

  * `10 div 3`
  * `div: text "karax"`



create an ambiguity?


Splat operator implementation with macros

2022-12-20 Thread MichalMarsalek
Is it not possible with some term rewriting macros?


Advent of Nim 2022

2022-12-02 Thread MichalMarsalek
Hmm, I feel like compared to last year, not many people are posting their Nim 
solutions to the megathread.


Advent of Nim 2022

2022-11-30 Thread MichalMarsalek
I'm doing AoC in Nim again: 
<https://github.com/MichalMarsalek/Advent-of-code/tree/master/2022/Nim>


convert HSlice to varargs?

2022-01-25 Thread MichalMarsalek
I don't remember if seq can be used in place of varargs. If so, toSeq should 
work.


Advent of Nim 2021

2021-12-01 Thread MichalMarsalek
I guess I'll put my repo here too:

<https://github.com/MichalMarsalek/Advent-of-code/tree/master/2021/Nim>


system.set

2021-01-09 Thread MichalMarsalek
Dammit, I planned to mention I know both hashsets and intsets, this question is 
not about that.


system.set

2021-01-09 Thread MichalMarsalek
Hello, I am missing two features in the system.set type.

1\. Support for larger ranges. set[uint32] would be huge, but I think that 
set[int24] (where type int24 = range[0..<2^24]) would be reasonable (2MB)?

2\. func empty(s: set[T]): bool =

> s.card == 0

But implemented more efficiently (you don't need to know the exact cardinality 
just to check if a set is empty, you can exit looping through the bitvector as 
soon as you find a word with nonzero popcount, right?). I'd like to see other 
functions like

func intersects(a, b: set[T]): bool =
not empty(a*b)

Again implemented more efficiently than that.