Powershell, 41 bytes
param($a,$b)$a;$b;$a..$b|?{$_-notin$a,$b}
Less golfed test script:
$f = {
param($a,$b)
$a # push $a to a pipe
$b # push $b to a pipe
$a..$b|?{ # push to pipe all integers from $a to $b
$_-notin$a,$b # ...except $a and $b itself
}
}
@(
,( 0, 5 , 0, 5, 1, 2, 3, 4)
,(-3, 8 , -3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7)
,( 4, 4 , 4, 4)
,( 4, 5 , 4, 5)
,( 8, 2 , 8, 2, 7, 6, 5, 4, 3)
,(-2, -7 , -2, -7, -3, -4, -5, -6)
) | % {
$a,$b,$expected = $_
$result = &$f $a $b
"$("$result"-eq"$expected"): $result"
}
Output:
True: 0 5 1 2 3 4
True: -3 8 -2 -1 0 1 2 3 4 5 6 7
True: 4 4
True: 4 5
True: 8 2 7 6 5 4 3
True: -2 -7 -3 -4 -5 -6
Explanation:
The basic concept of Powershell is the pipe. Pipe is an array. All results that push into the pipe fall into the array. So we should just push the values into the pipe in the correct order.