in reply to Re^7: What's most efficient way to get list context? (count)
in thread What's most efficient way to get list context?
A slice in a scalar context returns the last element, but could have been made to invoke nethack again.Yes, it could have, but it wasn't, and so the concept of multi-context LISTing is reinforced. My point is that There Is More Than One Way To Think About It, and unless there is some behavior that breaks the mental model, there's nothing wrong with the concept of a list in a scalar context. It explains WLM more simply than a whole bunch of special cases that we pretend are absolutely unrelated. They are related by Larry's vision, which appears to include the notion of a LIST.
The comma is a LIST-construction operator that works in either context, and the slice is another. qw is another. The range operator is not, because in scalar context, it's a completely different operator.
|
|---|