[Question]
  [
Given two integers, output the two integers, and then the range between them (excluding both).
The order of the range must be the same as the input.
### Examples:
```
 Input        Output
 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]
```
  
[Answer]
# [R](https://www.r-project.org/), ~~39~~ ~~33~~ 30 bytes
```
c(a<-scan(),setdiff(a:a[2],a))
```
[Try it online!](https://tio.run/##VYpBCsIwEEX3nmLAzQxMQGLFIt16CnExxI4ENIUmBUU8e0wiLlz9x3t/zgqDAV2CS34K@OAnvSA6CX@aXCuwPt6XmyQfrt@PTjOkMVaRHcpgqkXiOKaLV0U5yMmeWYjye6W4YdhRWbNlgL5SV6D7QWt9AdtOlsHsKX8A "R – Try It Online")
Thanks for saved bytes to user2390246 and J.Doe.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
Ÿ¦¨«
```
[Try it online!](https://tio.run/##yy9OTMpM/f//6I5Dyw6tOLT6//9oCx2jWAA "05AB1E – Try It Online")
**Explanation**
```
    Ÿ      # inclusive range [a ... b]
     ¦¨    # remove the first and last element
       «   # append to input
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~52~~ ~~48~~ ~~47~~ ~~42~~ 41 bytes
```
lambda a,b:[a,b,*range(a,b,-(a>b)|1)[1:]]
```
[Try it online!](https://tio.run/##VY7NCsIwEITvPsWAl0Q20L80paAvUnNI0aqgtZReBN89blJ/6iFhNvPtZIbHdL73ue@2e391t/bg4KitG75oM7r@dBRBKuF2rXymsklra/0wXvpJdAIJAVpKrNGw1ISUkBFyQmFXH0rxiGqmgq4IiiHFbLLciAElwfxWwyOKebX4C42O/jp64XA@stmpYriJsTp@kS96hRLm3StqPlxEMaaYVqX1Lw "Python 3 – Try It Online")
---
Combined former implementations.
[Answer]
# [Python 2 (Cython)](http://cython.org/), ~~36~~ 35 bytes
```
lambda x:x+range(*x,-cmp(*x)|1)[1:]
```
*Thanks to @nwellnhof for golfing off 1 byte!*
[Try it online!](https://tio.run/##LYpBDoIwFAXXeoq3A/Q3gYqRNNGL1C4QrZJIaRoW3yBnr0DcvJlknv8Mr95J0ayMFmdc47vubvcarHgfavd8pDsm0XR@ZvYtMl0oE20fwGgddE44GoIWB0K1SEko/1xDRZDrQRLEyajtxofWDbDJyDo3Sk6E2YrFAIjLPKNNOZuS@AM "Python 2 (Cython) – Try It Online")
---
# [Python 2](https://docs.python.org/2/), 37 bytes
```
lambda x:x+range(*x+[-cmp(*x)|1])[1:]
```
*Thanks to @JonasAusevicius for the port to CPython!*
[Try it online!](https://tio.run/##LYpBDoIwFAXXeoq3IbTym9CKkZDoRWoXKIIkUgiy@CbevVbiZt4kb6b38hi9CS1OuIRnPVybGlxxNte@u4sdZ1bdhimK/Ggnra5caMcZjN7D5oSDI1i1J5Q/KQjFf9ejJJg1MAR1dNV2M829X5AmpiFEAFDniOSVIoFgm8ecrY5sBUsZvg "Python 2 – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~26~~ 22 bytes
```
{|@_,|[...^](@_).skip}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/usYhXqcmWk9PLy5WwyFeU684O7Og9n9xYqVCmkaNSrymQlp@kYKGgY6CqaaOgoausY6CBYhhoqNgAqXBEhY6CkZgBUY6Crrmmv8B "Perl 6 – Try It Online")
### Explanation
```
{                    }
 |@_,   # Slip args a,b into result
      [...^](@_)  # Reduce args a,b with ...^ operator, same as a...^b
                .skip  # Skip first element
     |  # Slip into result
```
[Answer]
# [Python 2](https://docs.python.org/2/), 40 bytes
```
lambda x,y:[x,y]+range(x,y,-(y<x)|1)[1:]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaFCp9IqGkjEahcl5qWnagCZOroalTYVmjWGmtGGVrH/C4oy80oU0jQy8wpKSzQ0daC05n9dYy4LAA "Python 2 – Try It Online")
[Answer]
# **Python 3, ~~64~~ ~~62~~ 51 bytes**
`lambda a,b:[a,b]+[*range(a+1,b)]+[*range(a-1,b,-1)]`
[Try it online!](https://tio.run/##bZBPi8IwEMXvfoqHp3adgLX/pNCDF0HYw4LHmEOK7W5BG2l78dN3J0NZu2Agyczk994keTzHH9fFU1Neppu9V1cLS1WheTEb/dHb7rsO7CaiKlzkinNSUWimsR7GASX0Cjy03lJqCLwhJUSEHSEmJMbQDChO9x6RgKCYYDtsl7ioM0L@0iXehWXJPzdPztX0VWXbna/uxTAXq1Rs48VFfONcbiIRT26tGFLMqsyTZtW4HgF/RkgObQd5biEObYNGTlCWcAUefduNwfrrcD4Xa5pFcDRToYjq21D/ocfD6fMtOv0C)
# **Python 2, ~~58~~ 45 bytes**
`lambda a,b:[a,b]+range(a+1,b)+range(a-1,b,-1)`
[Try it online!](https://tio.run/##bZA/C8IwEMV3P8XDqcUL2NpaKXRwEQQHwbFmSLHVgjbSdvHT18tR/4GBJHeX33uX5P7oL7YJhyo7DldzK04Ghoo050XPWtOcS8/MAir8V6I4IRX4Q192fYcM@QQ88nxOsSbwhpgQEELCghBpTSOgOF05RAKCYoLdMP/GRb0kJB9d5FxYFv24OXKsxp8q24auuhLDRKxisV18XcQ1TuQmEvHk1oohxaxaOlJPKtvC42/wyaJuIM9NxaGuUMkJsgw2xb2tm96b7teHQzqlUQRLI@WLqLx25RvdrLe7v@jwBA)
[Answer]
# [Python 2](https://docs.python.org/2/), ~~47~~ ~~41~~ 40 bytes
```
lambda a,b:[a,b]+range(a,b,a<b or-1)[1:]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSFRJ8kqGkjEahcl5qWnagCZOok2SQr5RbqGmtGGVrH/C4oy80oU0jQUDHQUTDW5YFxdYx0FCwRXwURHwQSVi6RYwUJHwQhJr5GOrrnmfwA "Python 2 – Try It Online")
Here's mine, now that a lot of other Python answers have been posted
-6 bytes, thanks to G B
[Answer]
# Japt, 8 bytes
```
cUr!õ kU
```
[Try it here](https://ethproductions.github.io/japt/?v=1.4.6&code=Y1VyIfUga1U=&input=WzgsMl0=)
```
             :Implicit input of array U
c            :Concatenate
 Ur          :  Reduce U by
   !õ        :   Inclusive range
      kU     :  Remove all elements in original U
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
,œ|r
```
[Try it online!](https://tio.run/##y0rNyan8/1/n6OSaov@Hlxvpu///b6CjYKqjoKBrrKNgAaRNdEAIhEGiQBEjkCSQ0DUHAA "Jelly – Try It Online")
### How it works
```
,œ|r  Main link. Left argument: a. Right argument: b
,     Pair; yield [a, b].
   r  Range; yield [a, ..., b].
 œ|   Perform multiset union.
```
[Answer]
# JavaScript (ES6), 51 bytes
Takes input as `(a)(b)`.
```
a=>g=(b,c=b)=>(b+=b<a|-(b>a))-a?[...g(b,c),b]:[a,c]
```
[Try it online!](https://tio.run/##bczBCsIwEATQu1@yg0koVbFIN35I6WE3tkEpjdjiyX@PepQIc3rDzE2esoTH9b7aOV2GPHIW9pFJTWAFe9ItaysvS@oFsHLunHPx28Nof@rEhD6HNC9pGtyUIo1UgQ7A5hftDtQUuscnf7DcN6C6PK1B9gjkNw "JavaScript (Node.js) – Try It Online")
### Commented
```
a =>                // main function, taking a
  g = (             // g = recursive function
    b,              //     taking b
    c = b           // we save a backup of the original value of b into c
  ) =>              //
    (b +=           // add to b:
      b < a |       //   +1 if b is less than a
      -(b > a)      //   -1 if b is greater than a
    )               //   (or 0 if b = a)
    - a ?           // if the updated value of b is not equal to a:
      [             //   generate a new array:
        ...g(b, c), //     prepend all values generated by a recursive call
        b           //     append the current value of b
      ]             //
    :               // else:
      [a, c]        //   stop recursion and return the first 2 values: a and c
```
[Answer]
# Java 10, ~~109~~ ~~108~~ ~~104~~ ~~102~~ ~~93~~ 62 bytes
Using a space-delimited String:
```
b->a->{var r=a+" "+b;for(;a<b?++a<b:--a>b;)r+=" "+a;return r;}
```
[Try it online.](https://tio.run/##jZAxb4MwEIV3fsUpExa2VaWpGtWBbpU6dMpYdTgTiEyJQfaBFEX8dmooUsrW5fSe3539@SrsUVSn7zGv0Xv4QGNvEYAnJJNDFVLZkall2dmcTGPl2yIO75aKc@H4/5qO5Iw9ZxmUkMKoRYYiu/XowKWYbGCTaFU2LlZ40K9JEuqLEJhpxVySTjEqV1DnLDg1jCoKiG2n64C4kPaNOcEl0Me/L31@AbLpJwBUeIof@BNTdyse@f6v3/Hd2q6693y7Gt5y8TwfDNF9VzPBnBtLgHyqekE4Xj0VF9l0JNtAR7WNS4ltW19jzRaBbLlyGH8A)
Using a List:
```
b->a->{var r=new java.util.Stack();for(r.add(a),r.add(b);a<b?++a<b:--a>b;)r.add(a);return r;}
```
[Try it online.](https://tio.run/##lZAxa8MwEIX3/IobLSKJkqY0VIm7FQrt5LF0ONtykOPIRjq7hODf7iquS@Ixy/Ge7km8TyV2KMr8MGQVeg@faOx5AeAJyWRQhq1syVSyaG1GprbybRLbd0t6rx2/N/RhPMUxFLCDIRUxivjcoQO3s/rnJpYQZoeIqaJ2kZOY5xEy/idSpnCbvi6XYb4IgXGq2H9EOU2ts@BUP6hFIGnatAokE1BXmxyOATJKyBm7//oGZBdgANKeogf@xNTVike@ufVrvp7bWXrDV7PLKy6ex4N@cf3SscG4N5YA@WWmU4Xk5EkfZd2SbEI7qmxUSGya6hSYJ4FserIffgE)
(`a<b?++a<b:--a>b` can be `++a<b||(a-=2)>b` for the same byte-count: [Try it online for the String](https://tio.run/##jZAxb4MwEIV3fsUpky1sK6KpGsmBsVKGThmrDmcCkSkxyBxIUcJvp0CRUrYup/f87s6fXWCHsjh/D2mJTQMfaN09AGgIyaZQjKlqyZYqb11KtnLqfRGHo6Psknnxv6YTeesuSQI5xDAYmaBM7h168DGGG9iERueVZzoM8WAeD4YyjnhiNPdhPMWofUatd@B1P@hgRKxbU46IC2lX2TNcR3r2e9PnFyCfXgJAWUNsK165flr5IvZ//U7s1nbVvRfRajgS8m0@6IPnX80Ec24dAYqpmgXhdGsou6qqJVWPdFQ6lius6/LGDF8E8mVlP/wA) or [Try it online for the List](https://tio.run/##lZAxb4MwEIV3fsWNtmKsiKZqJAfGSpXaibHqcICJTIhB5qCKEn47dShVkrGL9Z7v@fQ@VzhgWBWHKa@x6@ADjT0HAB0hmRwqP5U9mVqWvc3JNFa@LmL3ZknvtRP/Db2bjpIESohhysIEw@Q8oAMXW/19F0sJ8wPjqmwccxKLgiEXvyLjarXCXXa5MAzjiCeZ4n8R5TT1zoJT46QCT9L2We1JFqChMQUcPSRLyRm7//wC5FdgANIdsbV45upmwyexvfcbsXm0D@mtiB4eRyJ8mS/G4Palc4N5biwBiuuZLRXSU0f6KJueZOvbUW1ZKbFt65NnXgTyZeU4/QA).)
---
**Old (~~109~~ ~~108~~ ~~104~~ ~~102~~ 101 bytes) answer using an array:**
```
a->b->{int s=a<b?1:-1,i=a!=b?(b-a)*s+1:2,r[]=new int[i];for(r[0]=a,r[1]=b;i>2;)r[--i]=b-=s;return r;}
```
-7 bytes thanks to *@nwellnhof*.
[Try it online.](https://tio.run/##jZAxb8IwEIV3foW72a1tkZSqCOOgLpU6dGKMMpwhQabBiewLFUL89tSkkShbF@vevTv5fbeHI4j99qvf1BAC@QTrzhNCAgLaDdlHV3Zoa1l1boO2cfJ9LJYfDstd6fn/hqzDvMgyUhFNehCZEdk59kjQsDSrZCESbjU8aLOiRgB7DE/JIuU@L7Qrv4dtW6iq8dTn00JDdJJCG2WzVDGfC2GjEjooX2LnHfHq0qtJBGk7U0eQkefY2C05REa6Rm/dLi8IsCsvIVgGpFP@wtRNimc@/6tnfHYv76bnPL1bTrl4HRqXye2iQ4LBv9IDv75mjLA@BSwPsulQtjEd1o7ebvvmPZyCxOY3Oa0ktG19osDGwjA2/nbpfwA)
**Explanation:**
```
a->b->{                // Method with 2 int parameters & int-array return-type
  int s=               //  Step integer, starting at:
        a<b?1          //   1 if the first input is smaller than the second
        :-1;           //   -1 otherwise
      i=               //  Array-index integer, starting at:
        a!=b?          //   If the inputs aren't equal:
         (b-a)*s+1     //    Set it to the absolute difference + 1
        :              //   Else:
         2,            //    Set it to 2
      r[]=new int[i];  //  Result-array of that size
  for(r[0]=a,          //  Fill the first value with the first input
      r[1]=b;          //  And the second value with the second input
      i>2;)            //  Loop `i` downwards in the range [`i`,2):
    r[--i]=            //   Decrease `i` by 1 first with `--i`
                       //   Set the `i`'th array-value to:
           b-=s;       //    If the step integer is 1: decrease `b` by 1
                       //    If the step integer is -1: increase `b` by 1
                       //    And set the array-value to this modified `b`
  return r;}           //  Return the result-array
```
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 5 bytes
Anonymous infix function.
```
,,…~,
```
[Try it online!](https://tio.run/##XY6xDoIwFEV3vuJ9wHsJQgudXFxkMhE3w0ACuBBlcNDFmJgwmEB0cHR15R/4lP5IfXSqLm16e87NzZuainNeH3ZUno7lvigLYxD19XNBU@n2obte969kpe@3cQh1@@RXul7wuVkmqQG/ApAAoLs3zfne@ggSYYYQIIQIIvPYY0i5EPGPQiBmiFHfFawfIcSZB4JF4YrCNtpc/uWSc8V54ObK1sa2UNrycBoUVDAO8c@iaQpz0zJijJimKPsC "APL (Dyalog Extended) – Try It Online")
`,` the first and last (lit. the concatenation of the arguments)
`,` and (lit. concatenated to)
`…` the range
`~` without
`,` the first and last (lit. the concatenation of the arguments)
[Answer]
## Haskell, 34 bytes
```
a#b=a:b:[a+1..b-1]++[a-1,a-2..b+1]
```
[Try it online!](https://tio.run/##HYlLCoQwEAWv0uAmId3BZBRF8AieIIShMwwoapA4Lub08bN5RdUbeZ@/y5IzF6HnLnSOldE6kPFKOSaDTPZyZXxeeYrQw8rb8AaxpSn@QMMRP0dKfxCFlOBEibVEQS9sL1RYPXunFu19WKRG@nwC "Haskell – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 26 bytes
```
,,[|.@]^:(>{.)<.+1}.i.@|@-
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/dXSia/QcYuOsNOyq9TRt9LQNa/Uy9RxqHHT/a3IpcKUmZ@QDVacpmEKY8cZAtgWEbQJkmiCYUBUWQKYRVLERkB1v/h8A "J – Try It Online")
## Explanation:
A dyadic verb (takes left and right argument)
```
                         -    subtracts the arguments
                       |@     and finds the absolute value
                    i.@       and makes a list 0..absolute difference
                 1}.          drops the fist element
                +             adds to the entire list
              <.              the smaller of the arguments
   |.@]                       reverses the list
       ^:                     only if
  [                           the left argument
         (>{.)                is greater than the first item of the list
 ,                            appends the list to
,                             the right argument appended to the left one
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 45 bytes
```
@(a,b)[a b linspace(a,b,(t=abs(a-b))+1)(2:t)]
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999BI1EnSTM6USFJISczr7ggMTkVJKKjUWKbmFSskaibpKmpbaipYWRVohn7PyWzuEAjTcNAx1RTkwvK0TXWsUDwTHRMkDlI6ix0jJA0Genommtq/gcA "Octave – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 13 bytes
```
,,<.+i.@-~-.=
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/dXRs9LQz9Rx063T1bP9rcilwpSZn5AMVpCmYQpjxxkC2BYRtAmSaIJhQFRZAphFUsRGQHW/@HwA "J – Try It Online")
```
     i.@-~       range [0 .. |difference|-1], reverse if the difference is positive
          -.=    remove the zero (either "=" is 0 or there’s nothing to remove)
  <.+            to each element add the smaller of the args
,,               prepend args
```
[Answer]
## Batch, 107 bytes
```
@echo %1
@echo %2
@for %%s in (1 -1)do @for /l %%i in (%1,%%s,%2)do @if %1 neq %%i if %%i neq %2 echo %%i
```
Takes input as command-line arguments. Explanation:
```
@echo %1
@echo %2
```
Output the two integers.
```
@for %%s in (1 -1)do
```
Try both ascending and descending ranges.
```
@for /l %%i in (%1,%%s,%2)do
```
Loop over the inclusive range.
```
@if %1 neq %%i if %%i neq %2
```
Exclude the two integers.
```
echo %%i
```
Output the current value.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 5 bytes
```
+QtrF
```
Input is a two-element list, `[input 1, input 2]`. Try it online [here](https://pyth.herokuapp.com/?code=%2BQtrF&input=%5B0%2C5%5D&debug=0), or verify all the test cases at once [here](https://pyth.herokuapp.com/?code=%2BQtrF&test_suite=1&test_suite_input=%5B0%2C5%5D%0A%5B-3%2C8%5D%0A%5B4%2C4%5D%0A%5B4%2C5%5D%0A%5B8%2C2%5D%0A%5B-2%2C-7%5D&debug=0).
```
+QtrFQ   Implicit: Q=eval(input())
         Trailing Q inferred
   rFQ   Generate range [input 1 - input 2)
  t      Discard first element
+Q       Prepend Q
```
[Answer]
# [Red](http://www.red-lang.org), 75 bytes
```
func[a b][s: sign? d: b - a prin[a b]loop absolute d - s[prin[""a: a + s]]]
```
[Try it online!](https://tio.run/##VcvBCoQgFIXhvU9xcBvCUA0TbnqHtnIXmjoEodGt57em1bj8@c7Zgy9T8IZE1CWeaTYWjgxr8PJNI7yGg4LFti/psTXnDdZxXs8jwN/I5kEprb6HDZiISsQLb/GDA1KKCNVh@O8efZ3VekBbnVuoT7kA "Red – Try It Online")
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), 49 bytes
```
import StdEnv
@a b=init[a,b:tl[a,a+sign(b-a)..b]]
```
[Try it online!](https://tio.run/##S85JTcz7n5ufUpqTqpCbmJn3PzO3IL@oRCG4JMU1r4zLIVEhyTYzL7MkOlEnyaokB0glahdnpudpJOkmaurpJcXG/g8uSQRqsFVwULBQ0DX6/y85LScxvfi/rqfPf5fKvMTczORiAA "Clean – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~33~~ 40 bytes
```
->a,b{[a,b]+[*a..b,*a.downto(b)][1..-2]}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y5RJ6k6GkjEakdrJerpJekAyZT88rySfI0kzdhoQz09XaPY2v8FCmnRCgY6CgqmsVwgtq4xkG0BYSuYANkmSGyoGgULINsIqt5IR0HXPPY/AA "Ruby – Try It Online")
Temporary fix, trying to find a better idea
[Answer]
# [Python 2](https://docs.python.org/2/), ~~52~~ ~~47~~ 41 bytes
```
lambda i,j:[i,j]+range(i,j,(i<j)*2-1)[1:]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSFTJ8sqGkjEahcl5qWnagCZOhqZNlmaWka6hprRhlax/wuKMvNKFNI0DHRMNblgHF1jHQsEz0THBJmDpM5CxwhJk5GOrrnmfwA "Python 2 – Try It Online")
-5 with thanks to @JoKing
-6 by slicing the first element from the range (idea stolen from and with credit to @TFeld)
Non-lambda version...
# [Python 2](https://docs.python.org/2/), ~~51~~ ~~49~~ 47 bytes
```
i,j=input();print[i,j]+range(i,j,(i<j)*2-1)[1:]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfnJ@SqmCroK6u/j9TJ8s2M6@gtERD07qgKDOvJBooEqtdlJiXnqoBZOpoZNpkaWoZ6RpqRhtaxf4H6uFKrUhN1gCZoall9t9Ax5RL11jHgstExwSITbksdIy4dI10dM0B "Python 2 – Try It Online")
-2 with thanks to @JoKing
[Answer]
# [APL (Dyalog Classic)](https://www.dyalog.com/), 29 bytes
```
{⍺,⍵,(⌽⍣(⍺>⍵))(⍺⌊⍵)+¯1↓⍳|⍺-⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v8/7VHbhOpHvbt0HvVu1dF41LP3Ue9iDSDfDsjX1ASxHvV0gdjah9YbPmqb/Kh3cw1QUBcoVPv/v4FCmoIp16H1xkDagssESJqASVMuCyBpBJQxAtKH1psDAA "APL (Dyalog Classic) – Try It Online")
A port of my `J` solution
[Answer]
## PHP (102 bytes)
```
function t($a,$b){count($r=range($a,$b))>1?array_splice($r,1,0,array_pop($r)):$r=[$a,$b];print_r($r);}
```
[Sandbox](http://sandbox.onlinephpfunctions.com/code/870c42af9617a26dda4cc80cca4aebf17f215b6d)
Unfortunately (for golf) PHP has rather verbose function names, which contribute a lot to the length. But the basic idea is to create a range, then pop off the last element and stitch it back in at offset 1. For the `4,4` example I had to add `count($r=range($a,$b))>1?...:$r=[$a,$b];` which adds quite a bit, and unfortunately `array_splice()` is by reference which hit me for a few more bytes (`$r= and a ;`). All because of that "edge case", lol.
Well anyway enjoy!
[Answer]
# [Clojure](https://clojure.org/), 61 bytes
```
(fn[[a b]](def s(if(> a b)-1 1))(list* a b(range(+ a s)b s)))
```
An anonymous function that takes a 2-vector as input and returns a list.
[Try it online!](https://tio.run/##pY2xCsIwFEV3v@KOL9pCaxEKgl/g4B46pDXRSE20SQS/Pibd2tXhweVw7n3DaB9hkjGSMpwL9F1HV6ngSCs6IQFW1qgZo1E7v82AJmFuknYpO9anYyzOHYW/RhiOOEufZuQ7iBH@LiGMNd@nDQ4qmMFrayB6@5Ebek3a@NGkl@AVDt1cv2QIRbwqMlpaZYN2pZVNkdnSa7FfaW2RUfwB "Clojure – Try It Online")
## Explanation
```
(fn [[a b]] ; An anonymous function that accepts a 2-vector as input, and destructures it to a and b
  (def s (if (> a b) -1 1)) ; If a > b assigns -1 to s and assigns 1 to s otherwise. This determines the order of the elements of the output list.
  (list* a b ; Creates a list with a and b as the first two elements. The remaining elements will be appended from the following range:
    (range (+ a s) b s))) ; A range starting at a+s and ending at b with step s
```
[Answer]
# [D](https://dlang.org/), 85 bytes
```
T[]f(T)(T a,T b){T[]v=[a,b];T c=2*(b>a)-1;for(T i=a+c;a!=b&&b!=i;i+=c)v~=i;return v;}
```
[Try it online!](https://tio.run/##XcxBDoIwEAXQNZxi2JBWClHESNLUU3RHWLQgySRCTa11QfDqlbhSFpP8vPw/fQiyaQciKZGgmARN5xW8aBTTLZfQiXJH9EXR/MAHY9cWCpV1XCVCp6lOBHLMREf9e0326p52As@X4A32MCqcCIU5jnC8G@vg4fpiPTQ8jgayZydavCy66236Qn5k9b9UrNrCZlOzcvOkZJCff2wJHw "D – Try It Online")
A port of @HatsuPointerKun's C++ answer into D. 
[Answer]
# TI-BASIC, ~~35~~ 34 bytes
-1 byte from [Misha Lavrov](https://codegolf.stackexchange.com/users/74672/misha-lavrov)
```
Prompt A,B
Disp A,B
cos(π(A>B
For(I,A+Ans,B-Ans,Ans
Disp I
End
```
[Answer]
# JavaScript, 73 bytes
Without recursion:
```
(s,e,m=s>e?-1:1)=>[s,e,...[...Array(m*(e-s||1)-1)].map((_,i)=>s+m*(i+1))]
```
Try it:
```
f=(s,e,m=s>e?-1:1)=>[s,e,...[...Array(m*(e-s||1)-1)].map((_,i)=>s+m*(i+1))]
console.log(JSON.stringify(f(0,5)));
console.log(JSON.stringify(f(-3,8)));
console.log(JSON.stringify(f(4,4)));
console.log(JSON.stringify(f(4,5)));
console.log(JSON.stringify(f(8,2)));
console.log(JSON.stringify(f(-2,-7)));
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 15 bytes
```
ＩＥ²ＮＩ…⊕θηＩ⮌…⊕ηθ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwzexQMNIR8Ezr6C0xK80Nym1SEMTCKy5kNQEJealp2p45iUXpeam5pWkpmgUauooZGAoSy1LLSpOxaI8A6i8EGzs///RukDrdM1j/@uW5QAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＩＥ²Ｎ
```
Print the inputs on separate lines.
```
Ｉ…⊕θη
```
Print the ascending range, if any.
```
Ｉ⮌…⊕ηθ
```
Print the reverse ascending reverse range, if any.
]