tapply.nim 195 B

123456789101112
  1. discard """
  2. output: '''true'''
  3. """
  4. import sequtils
  5. var x = @[1, 2, 3]
  6. x.apply(proc(x: var int) = x = x+10)
  7. x.apply(proc(x: int): int = x+100)
  8. x.applyIt(it+5000)
  9. echo x == @[5111, 5112, 5113]