INim
INim copied to clipboard
slice seq, or maybe not bug
please note that the last statement, i.e. a[..3]
outputs 3 lines of result
nim> var a = @[3, 1]
nim> a[0..1]
@[3, 1] == type int
nim> a.add 4
nim> a[0..2]
@[3, 1, 4] == type int
nim> a.add 1
nim> a[..3]
@[3, 1] == type int
@[3, 1, 4] == type int
@[3, 1, 4, 1] == type seq[int]
but
nim> var a = @[3, 1]
nim> a[0..1]
@[3, 1] == type int
nim> a.add 4
nim> a[0..2]
@[3, 1, 4] == type int
nim> a.add 1
nim> a[0..3]
@[3, 1, 4, 1] == type int
we know that nim
says Warning: replace
..bwith
0..b; .. is deprecated [Deprecated]
on a[..3]
, but why inim
outputs
@[3, 1] == type int
@[3, 1, 4] == type int
@[3, 1, 4, 1] == type seq[int]