I am expecting the code below to print chr7.
import strutils
var splitLine = "chr7 127471196 127472363 Pos1 0 +".split()
var chrom, startPos, endPos = splitLine[0..2]
echo chrom
Run Code Online (Sandbox Code Playgroud)
Instead it prints @[chr7, 127471196, 127472363].
Is there a way to unpack multiple values from sequences at the same time?
And what would the tersest way to do the above be if the elements weren't contiguous? For example:
var chrom, startPos, strand = splitLine[0..1, 5]
Run Code Online (Sandbox Code Playgroud)
Gives the error:
read_bed.nim(8, 40) …Run Code Online (Sandbox Code Playgroud) nim-lang ×1