From A, 3 Years ago, written in Nimrod.
Embed
  1. const MAXN = 10
  2.  
  3. var dp: array[MAXN, int]
  4.  
  5. proc `[]=`[T; U: Ordinal](arr: var openArray[T]; slice: Slice[U] | seq[U];
  6.     value: sink T) {.inline.} =
  7.   for idx in slice:
  8.     arr[idx] = value
  9.  
  10. when isMainModule:
  11.   let n = 8
  12.  
  13.   dp[1..8] = -1  # initialize dp array
  14.   echo dp
captcha