[Question]
  [
[A recent SO question](https://stackoverflow.com/q/61348795/5306507) asks for *a convenient one-liner to generate a list of numbers and their negative counterparts in Python*.
Given two integers \$1≤a≤b\$, generate all the integers \$x\$ such that \$a≤|x|≤b\$. The result may be printed or returned in any order or structure, as putting the result into a list and sorting it, yields `[-b,1-b,2-b,…,-a,a,a+1,a+2,…,b]`
### Examples
\$a=6,b=9\$ gives `[6,-6,7,-7,8,-8,9,-9]` or `[6,7,8,9,-9,-8,-7,-6]` or `[-8,7,-9,-7,9,8,-6,6]` or `[[6,-6],[7,-7],[8,-8],[9,-9]]` or `[[6,7,8,9],[-6,-7,-8,-9]]` etc.
\$a=6,b=6\$ gives `[6,-6]` or `[-6,6]` or `[[6,-6]]` or `[[6],[-6]]` etc.
  
[Answer]
# [Python 2](https://docs.python.org/2/), 33 bytes
```
def f(a,b):print-a,a;a<b<f(a+1,b)
```
[Try it online!](https://tio.run/##K6gsycjPM/r/PyU1TSFNI1EnSdOqoCgzr0Q3USfROtEmyQYoqG0IFP6fpmGmY6n5HwA "Python 2 – Try It Online")
A recursive function that prints in a two-column format. Based on [ideas from Surculose Sputum](https://codegolf.stackexchange.com/a/203803/20260).
In Python 3, we'd need 2 more bytes for `print()` needing parens.
---
# [Python 2](https://docs.python.org/2/), 37 bytes
```
lambda a,b:range(a,b+1)+range(-b,1-a)
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSFRJ8mqKDEvPVUDyNI21NSGcHSTdAx1EzX/FxRl5pUopGmY6VhqciE4Zpr/AQ "Python 2 – Try It Online")
Unfortunately for this challenge, Python's ranges are exclusive, so we have to add 1 to both upper endpoints.
[Answer]
# [Haskell](https://www.haskell.org/), 21 bytes
```
a%b=[a..b]++[-b.. -a]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P1E1yTY6UU8vKVZbO1o3SU9PQTcx9n9uYmaegq1CQVFmXomCioKZgqqC5f9/yWk5ienF/3WTCwoA "Haskell – Try It Online")
Looks like this boring solution is shortest. The space in before `-a` is needed to avoid a misparse with `..-`.
**22 bytes**
```
a%b=[id,(0-)]<*>[a..b]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P1E1yTY6M0VHw0BXM9ZGyy46UU8vKfZ/bmJmnoKtQkFRZl6JgoqCmYKqguX/f8lpOYnpxf91kwsKAA "Haskell – Try It Online")
**22 bytes**
```
a%b=[[x,-x]|x<-[a..b]]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P1E1yTY6ukJHtyK2psJGNzpRTy8pNvZ/bmJmnoKtQkFRZl6JgoqCmYKqguX/f8lpOYnpxf91kwsKAA "Haskell – Try It Online")
**23 bytes**
```
a%b=do x<-[a..b];[x,-x]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P1E1yTYlX6HCRjc6UU8vKdY6ukJHtyL2f25iZp6CrUJBUWZeiYKKgpmCqoLl/3/JaTmJ6cX/dZMLCgA "Haskell – Try It Online")
**23 bytes**
```
a%b=(,)<*>(0-)<$>[a..b]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P1E1yVZDR9NGy07DQFfTRsUuOlFPLyn2f25iZp6CrUJBUWZeiYKKgpmCqoLl/3/JaTmJ6cX/dZMLCgA "Haskell – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
ŸD(«
```
[Try it online!](https://tio.run/##yy9OTMpM/f//6A4XjUOr//8347IEAA "05AB1E – Try It Online")
# Explanation
```
     Takes two input integers
Ÿ    Inclusive range.
 D   Duplicate the stack.
  (  Negate all items of the duplicated item.
   « Concatenate both lists.
     Implicit output
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 5 bytes
```
_BM}F
```
[Try it online!](https://tio.run/##K6gsyfj/P97Jt9bt//9oUx1Dg1gA "Pyth – Try It Online")
`}F` forms an inclusive range, then `_B` pairs a number with its negation, and `M` maps that over the list.
[Answer]
# [PowerShell](https://github.com/PowerShell/PowerShell), 28 bytes
```
$args[0]..$args[1]|%{$_,-$_}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/XyWxKL042iBWTw/CMoytUa1WidfRVYmv/f//v9l/SwA)
`$args[0]..$args[1]` generates integer array range from `$args[0]` to `$args[1]`. It's piped and then each item in that array is mapped to itself and its negative counterpart.
[Answer]
## [Dyalog APL](https://www.dyalog.com), **19 bytes**
```
{(⊢,-)⍺,⍺(⊣+∘⍳-⍨)⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1Hf1EdtE8wUqjUedS3S0dV81LtLB4iBvMXajzpmPOrdrPuodwVQeGutguX//wA)
[Answer]
# [Python 3](https://docs.python.org/3/), ~~40~~ 39 bytes
*-1 byte thanks to @xnor!*
```
f=lambda a,b:b//a*[0]and[a,-a]+f(a+1,b)
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRIVEnySpJXz9RK9ogNjEvJTpRRzcxVjtNI1HbUCdJ839BUWZeiUaahpmOpaYmF4Jnpqn5HwA "Python 3 – Try It Online")
This would be 38 bytes in Python2, by replacing `//` operator with just `/`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
rNƬ
```
A dyadic Link accepting two integers (either way around) which yields a list of two lists.
**[Try it online!](https://tio.run/##y0rNyan8/7/I79ia////m/23BAA "Jelly – Try It Online")**
### How?
```
rNƬ - Link: integer, a; integer b                         e.g. 7; 4
r   - inclusive range  [a..b]                                  [7,6,5,4]
  Ƭ - collect up while unique, applying:
 N  -   negate (vectorises)                    0-applications: [[7,6,5,4]]
                                               1-application:  [[7,6,5,4],[-7,-6,-5,-4]]
                                               2-applications: [[7,6,5,4],[-7,-6,-5,-4],[7,6,5,4]]
                                                               - no longer distinct
                                                            -> [[7,6,5,4],[-7,-6,-5,-4]]
```
---
There are many, many ways to achieve this task in four bytes in Jelly.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 22 bytes
```
->a,b{[*-b..-a,*a..b]}
```
[Try it online!](https://tio.run/##KypNqvyfZhvzX9cuUSepOlpLN0lPTzdRRytRTy8ptvZ/gUJatJmOZex/AA "Ruby – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 26 25 bytes
-1 bytes thanks to Giuseppe
```
function(a,b)c(a:b,-b:-a))
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP08jUSdJM1kj0SpJR1cjySpRU/N/moaZjpkmF4iy1PwPAA "R – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~44~~ ~~43~~ 42 bytes
Saved a byte thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!!  
Saved a byte thanks to [S.S. Anne](https://codegolf.stackexchange.com/users/89298/s-s-anne)!!! 
```
f(a,b){for(;b/a;)printf("-%d %1$d ",a++);}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NI1EnSbM6Lb9IwzpJP9Fas6AoM68kTUNJVzVFQdVQJUVBSSdRW1vTuvZ/bmJmnoZmNVeahpmOpaY1F0xlTJ4SkAcSNQPStf8B "C (gcc) – Try It Online")
[Answer]
# Java 10, ~~76~~ ~~56~~ ~~52~~ 50 bytes
```
b->a->{for(;a<=b;)System.out.println(a+","+-a++);}
```
-22 bytes thanks to *@OlivierGrégoire*.
Takes the inputs in reverse order. Prints pairs of positive and negative integers `"a,-a"` newline separated.
[Try it online.](https://tio.run/##dY8xa8MwEIV3/4rDk4xtjYHWiZdCIUPIkLF0ODlykCPLwjoFQvBvdxVXpR3c5bjHvXf3XYc3LLvzdW40OgcHVOaRADhCUg10Yco9Kc1bbxpSg@HvsdnuDcmLHIs109tgnO/l@GOqa2hhN4uyxrJ@tMPIKtzuRJWd7o5kzwdP3I7KkDYM87RI8xLzPKumuUoCjfVCB5oIdRvUGfoAyk4UMpePT8DsCQ1A0hHbFC9Z9VduFjklv38tK5ZpuAlYPKuIO1aQ0r2xnl4hzcUCFxCDiEfW/EdP34HoaTlaq@9MZBybRlpi@H860k7zFw)
**Explanation:**
```
b->a->{                  // Method with two integer parameters and no return-type
  for(;a<=b;)            //  Loop in the range [a,b]:
    System.out.println(  //   Print with trailing newline:
      a                  //    `a`
      +" "               //    appended with a space
      +-a                //    appended with `-a`
         ++);}           //   And then increase `a` by 1 with `a++`
```
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), `-pn` , 5 bytes
```
ɧ⑷④±.
```
It prints all the numbers separated by newlines.
## Explained
```
ɧ⑷④±.
ɧ      # Generate a range between the two implicit inputs
 ⑷④±. # For each number in that range, print it raw without popping, negate it, and print it raw
```
[Try it online!](https://tio.run/##ARkA5v9rZWf//8mn4pG34pGjwrEu//82Cjn/LXBu "Keg – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~33~~ 31 bytes
-2 bytes thanks to [@mypronounismonicareinstate](https://codegolf.stackexchange.com/users/36445/my-pronoun-is-monicareinstate).
```
b=>f=a=>a>b?[]:[a,-a,...f(a+1)]
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9u@z/J1i7NNtHWLtEuyT461io6UUc3UUdPTy9NI1HbUDP2f3J@XnF@TqpeTn66RrqGpaaGmabmfwA "JavaScript (Node.js) – Try It Online")
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~47~~ 46 bytes
Much shorter than the beautiful LINQ solutions with `SelectMany` :(  
I also cannot remember when I last wrote a `for` loop while code-golfing, so I likely missed trivial golfs.
```
a=>b=>{for(int i=a;i<=b;Print(-i++))Print(i);}
```
[Try it online!](https://tio.run/##Sy7WTS7O/O9Wmpdsk5lXoqPgmFySmZ8HYtvZKbgp2P5PtLVLsrWrTssv0gAKKmTaJlpn2tgmWQcUAbkaupna2pqaEHampnXtf2suNw0zTQ1LTev/AA "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# Google Sheets, 66 bytes
```
=ArrayFormula({Row(Indirect(A1&":"&A2));-Row(Indirect(A1&":"&A2))}
```
Sheets will automatically add the last closing parentheses when you exit the cell. (A 1.5% byte reduction!)
Input is in cells A1 and A2. The order doesn't actually matter.  
`Indirect(A1&":"&A2)` creates a range that contains all the rows between those numbers, inclusive.  
`Row(Indirect(~))` returns the row numbers of everything in that range.  
[![Example](https://i.stack.imgur.com/ioHOB.png)](https://i.stack.imgur.com/ioHOB.png)
[Answer]
# [PHP](https://php.net/), ~~51~~ ~~46~~ 40 bytes
```
fn($a,$b)=>[range($a,$b),range(-$b,-$a)]
```
[Try it online!](https://tio.run/##K8go@G9jX5BRwKWSZvs/LU9DJVFHJUnT1i66KDEvPRXK1YFwdFWSdHRVEjVj/1tzlSUWxaeU5hZoqKRpmOlYamqiC5kBhf4DAA "PHP – Try It Online")
simply using php7 lambda functions short notation and built-in array functions..
EDIT: hum I see that from PHP7.4 we have now a spread operator! -5 bytes
EDIT2: thanks to DomHastings for saving another 6 bytes!
[Answer]
# [Bash](https://www.gnu.org/software/bash/) + Core utilties, 21 bytes
```
seq $1 $2;seq -$2 -$1
```
[Try it online!](https://tio.run/##S0oszvj/vzi1UEHFUEHFyBrE0lUxAmLD////m/23BAA "Bash – Try It Online")
[Answer]
# LaTeX, ~~61~~ 56 bytes
```
\input tikz.tex\def\f#1#2{\foreach~in{#1,...,#2}{~;-~;}}
```
Defines a macro `f` that takes input as two arguments and outputs the numbers as tokens to latex (so they are printed in the pdf), semicolon-seperated.
## Explanation
```
\input tikz.tex                % load the tikz package for the foreach command
\def\f#1#2{                    % define a macro f that takes two arguments
   \foreach ~                  % loop with the loop variable called ~
                               % (to save a space between the name and "in")
   in {#1,...,#2} {            % where ~ ranges from the first to the second 
                               % argument, inclusive
        ~;-~;                  % the macro f expands to
                               % ~
                               % a semicolon and a minus sign
                               % ~
                               % another semicolon
   }
}
```
## Example
```
\documentclass{article}
\input tikz.tex
\def\f#1#2{\foreach~in{#1,...,#2}{~;-~;}}
\begin{document}
\f6 9
\f6 6
\end{document}
```
Output:
[![enter image description here](https://i.stack.imgur.com/lIckw.png)](https://i.stack.imgur.com/lIckw.png)
[Answer]
# [Kotlin](https://kotlinlang.org) , 22 bytes
```
{a,b->(a..b)+(-b..-a)}
```
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal) `W`, 3 bytes
```
ṡ:N
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=W&code=%E1%B9%A1%3AN&inputs=6%0A9&header=&footer=)
```
ṡ:N
ṡ       Inclusive range of inputs
 :      Duplicate
  N     Negate the duplicate
W flag: Wrap both ranges into one list, which is implicitly output
```
[Answer]
# [Erlang (escript)](http://erlang.org/doc/man/escript.html), 36 bytes
```
g(A,B)->[[X,-X]||X<-lists:seq(A,B)].
```
[Try it online!](https://tio.run/##Sy3KScxL100tTi7KLCj5z/U/XcNRx0lT1y46OkJHNyK2pibCRjcns7ik2Ko4tRAsF6v3PzcxM08jOlZTQdeOSwEIMvOtyosyS1I10jXMdMw0NXWAAnk5Gpo6mLKWCFm9/wA "Erlang (escript) – Try It Online")
# [Erlang (escript)](http://erlang.org/doc/man/escript.html), 40 bytes
Port of Surculose Sputum's answer.
```
g(A,A)->[A,-A];g(A,B)->[A,-A]++g(A+1,B).
```
[Try it online!](https://tio.run/##Sy3KScxL100tTi7KLCj5z/U/XcNRx1FT1y7aUUfXMdYaxHWCc7W1gXxtQ6CI3v/cxMw8jehYTQVdOy4FIMjMtyovyixJ1UjXMNMx09TUAQrk5Who6mDKWiJk9f4DAA "Erlang (escript) – Try It Online")
[Answer]
# [Befunge-98 (FBBI)](https://github.com/catseye/FBBI), 24 bytes
```
&00p&v
0g-k@>::.'-,.1+:0
```
[Try it online!](https://tio.run/##S0pNK81LT9W1tPj/X83AoECtjMsgXTfbwc7KSk9dV0fPUNvK4P9/QyMFMwA "Befunge-98 (FBBI) – Try It Online")
### Explanation
`&00p&` is the input part. `&00p` takes \$b\$ as input and stores it in the top left corner. `&` takes input \$a\$ and pushes it to the stack.
`0g-k@>::.'-,.1+:0` is the main loop and, as the instruction pointer wraps around, equivalent to:
```
::.'-,.1+:00g-k@
::                duplicate a twice
  .               print a
   '-,            print '-'
      .           print a
       1+         increase a
         :        duplicate the new value of a
          00g     get b from the top-left corner
             -    calculate a-b, as Befunge has no negative values,
                  this is 0 for b>=a
              k@  execute *quit* (b-a)-times
```
[Answer]
# [J](http://jsoftware.com/), 10 bytes
```
]-.&i:<:@[
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/Y3X11DKtbKwcov9rcilwpSZn5CuYKaQpWHL9BwA "J – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk/wiki/Commands), 5 [bytes](https://github.com/barbuz/Husk/wiki/Codepage)
```
mSe_…
```
[Try it online.](https://tio.run/##yygtzv7/Pzc4Nf5Rw7L///@b/bcEAA)
Or alternatively:
```
Svm_…
```
[Try it online.](https://tio.run/##yygtzv7/P7gsN/5Rw7L///@b/bcEAA)
**Explanation:**
```
    …  # Create a an inclusive range using the two (implicit) input-arguments
m      # Map over this list
 Se    # and pair each element with:
   _   #  Its negative
       # (after which the result is output implicitly)
    …  # Create a an inclusive range using the two (implicit) input-arguments
 v     # Concatenate it with:
S m    #  The same list with each value mapped to:
   _   #   Its negative
       # (after which the result is output implicitly)
```
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 11 bytes
```
ps^pr@Jng.+
```
[Try it online!](https://tio.run/##SyotykktLixN/f@/oDiuoMjBKy9dT/v/f2MFSwA "Burlesque – Try It Online")
I feel like there's probably a better way to parse the input, but I'm not getting it. Explanation:
```
ps^p          # Parse input as block and split block to stack
    r@        # Generate range between two inputs
      Jng     # Duplicate and negate
         .+   # Concatenate and implicitly output
```
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), 15 bytes
```
{1 -1*/:y,y^!x}
```
[Try it online!](https://tio.run/##y9bNz/7/P82q2lBB11BL36pSpzJOsaL2f1q0mbVl7H8A "K (oK) – Try It Online")
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 36 bytes
```
,[->+>->-<<<],+[->>+<<]>>[-<.+>>.-<]
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fJ1rXTttO107XxsYmVkcbyLPTBrLs7KJ1bfS07ez0dG1i//9n4wQA "brainfuck – Try It Online")
## Clarification
Input and output are treated as bytes (as permitted in [Can numeric input/output be in the form of byte values?](https://codegolf.meta.stackexchange.com/questions/4708/can-numeric-input-output-be-in-the-form-of-byte-values/4719#4719))
Since negative bytes don't really make sense, a negative answer wraps around and starts at the largest value of the cell. For example, given a cell size of 128, the output for the input in bytes `[6, 9]` will be (in bytes) `[6,(128-6),7,(128-7),8,(128-8),9,(128-9)]`
Hopefully that's a fair enough interpretation of the rules!
[Answer]
# [Perl 5](https://www.perl.org/), 20 bytes
```
say"$_
-$_"for<>..<>
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVJJJZ5LVyVeKS2/yMZOT8/G7v9/My7Lf/kFJZn5ecX/dX1N9QwMDQA "Perl 5 – Try It Online")
[Answer]
# [Zsh](https://www.zsh.org/), 17 bytes
```
echo {,-}{$1..$2}
```
[Try it online!](https://tio.run/##qyrO@J@moanxPzU5I1@hWke3tlrFUE9Pxaj2vyYXV5qCoYIJkDRTsASTZv8B "Zsh – Try It Online")
]