The "comma" operator (as in 2,5) produces a stream. So 2,5 emits two integers, which is why [2,5] evaluates to an array of two integers.
In general, if E/1 has been defined using a form equivalent to def E($x): (i.e., as a "regular" function), then E(a,b) emits the stream E(a) followed by the stream E(b).
And indeed range/1 has been defined as a "regular function".
Non-regular functions
Here's an example of a non-regular function:
# Emit a single JSON object ("bow" is short for "bag of words")
def bow(stream):
reduce stream as $word ({}; .[($word|tostring)] += 1);
Notice that the function argument here (stream) is passed to reduce, which of course handles its first argument in a special way.
Since def E($x): is equivalent to def E(x): x as $x, defining bow as
def bow($s): reduce $s as $word ({}; .[($word|tostring)] += 1);
would have completely different (and useless) semantics.