Inside a list comprehension, the bit a <- b
means "for each a
in b
".
So in your case, xs <- xss
should read like "for each xs
in xss
", and then x <- xs
should read like "for each x
in xs
", which is also valid becase xs
itself is a list, because xss
is a list of lists.
So as the list comprehension unfolds, xs
becomes bound first to [1,2,3]
, then to [4]
, and then to [5]
, and within each iteration of xs
, x
becomes bound to 1
, 2
, 3
, then to 4
, and finally to 5
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…