Code Golf
number sequence add tag
Adám
[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.
Top Answer TeX
Skillmon
# TeX, 75 bytes

```tex
\def~{\count0 }\def\1#1#2{~#1\loop-\the~,\the~,\advance~1\ifnum~<#2\repeat}
```

Output will be printed into a PDF (if you're running `pdftex`).

Example script:

```tex
\def~{\count0 }\def\1#1#2{~#1\loop-\the~,\the~,\advance~1\ifnum~<#2\repeat}

\1{6}{9}
\bye
```

Output:

![numrange.png](/image?hash=2dcba78e6d46d9aa4cdd513996e94aa1c45e203863a59584c5f50cec06cf2cc1)
Answer #2 05AB1E
petStorm
# [05AB1E], 4 bytes
I'm just going to copy&paste my answer on [CG.SE](https://codegolf.stackexchange.com/questions/203797/generate-list-of-numbers-and-their-negative-counterparts).

    ŸD(«

[Try it online!][TIO-k9chu51f]

[05AB1E]: https://github.com/Adriandmen/05AB1E
[TIO-k9chu51f]: 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 #3 CJam
EsolangingFruit
# [CJam], 9 bytes

    {),>_Wf*}

[Try it online!][TIO-k9dojnro]

Takes input as two numbers on the stack and places two lists on the stack.

## Explanation

    {       }  Input:        2 4
     )         Increment:    2 5
      ,        Range:        2 [0 1 2 3 4]
       >       Slice:        [2 3 4]
        _      Duplicate:    [2 3 4] [2 3 4]
         Wf*   Negate each:  [2 3 4] [-2 -3 -4]

[CJam]: https://sourceforge.net/p/cjam
[TIO-k9dojnro]: https://tio.run/##S85KzP3/v1pTxy4@PE2r9r@Vt3VhXayRfnWdd6xVQrBWXq3@fzMFSy4zBTMA "CJam – Try It Online"
Answer #4 SQL (Postgres)
PeterVandivier
# PostgreSQL, 41 Bytes

<>https://dbfiddle.uk/?rdbms=postgres_12&fiddle=983cfb3d1ba72c5e10e5cb9c315cb66c
Answer #5 PowerShell Core
PeterVandivier
# [PowerShell Core], 17 bytes

``` ps
6..9|%{@($_,-$_)}
```

[Try it online!][TIO-k9cjzdm8]

[PowerShell Core]: https://github.com/PowerShell/PowerShell
[TIO-k9cjzdm8]: https://tio.run/##K8gvTy0qzkjNydFNzi9K/f/fTE/Pska12kFDJV5HVyVes/b///8A "PowerShell Core – Try It Online"
Answer #6 SQL (Oracle)
Jack Douglas
Oracle, 63 bytes

<>https://dbfiddle.uk/?rdbms=oracle_18&fiddle=ccc36f23065dcce4b3a7ed6143e01e27&hide=1

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.