INim icon indicating copy to clipboard operation
INim copied to clipboard

slice seq, or maybe not bug

Open retsyo opened this issue 2 years ago • 0 comments

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 ..bwith0..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]

retsyo avatar Nov 12 '21 12:11 retsyo