I did not use `set` for today's AOC (I probably should have), but in that case 
I probably would have implemented a simple pop for built-in set, like there is 
[one for HashSet](https://nim-lang.org/docs/sets.html#pop%2CHashSet%5BA%5D) 
([playground](https://play.nim-lang.org/#ix=2IhP)):
    
    
    var s = {1, 2, 3}
    
    proc pop[T](s: var set[T]): T =
      for e in s:
        s.excl e
        return e
    
    while s.len > 0:
      let e = pop s
      echo e
    
    
    Run

Reply via email to