[Question]
      [
A [**Walsh matrix**](https://en.wikipedia.org/wiki/Walsh_matrix) is a special kind of square matrix with [applications in quantum computing](https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_gate) (and probably elsewhere, but I only care about quantum computing).
### Properties of Walsh matrices
The dimensions are the same power of 2. Therefore, we can refer to these matrices by two's exponent here, calling them`W(0)`, `W(1)`, `W(2)`...
`W(0)` is defined as `[[1]]`.
For `n>0`, `W(n)` looks like:
```
[[W(n-1)  W(n-1)]
 [W(n-1) -W(n-1)]]
```
So `W(1)` is:
```
[[1  1]
 [1 -1]]
```
And `W(2)` is:
```
[[1  1  1  1]
 [1 -1  1 -1]
 [1  1 -1 -1]
 [1 -1 -1  1]]
```
The pattern continues...
### Your task
Write a program or function that takes as input an integer `n` and prints/returns `W(n)` in any convenient format. This can be an array of arrays, a flattened array of booleans, a `.svg` image, you name it, as long as it's correct.
[Standard loopholes](https://codegolf.meta.stackexchange.com/q/1061/73884) are forbidden.
### A couple things:
For `W(0)`, the `1` need not be wrapped even once. It can be a mere integer.
You are allowed to 1-index results—`W(1)` would then be `[[1]]`.
### Test cases
```
0 -> [[1]]
1 -> [[1  1]
      [1 -1]]
2 -> [[1  1  1  1]
      [1 -1  1 -1]
      [1  1 -1 -1]
      [1 -1 -1  1]]
3 -> [[1  1  1  1  1  1  1  1]
      [1 -1  1 -1  1 -1  1 -1]
      [1  1 -1 -1  1  1 -1 -1]
      [1 -1 -1  1  1 -1 -1  1]
      [1  1  1  1 -1 -1 -1 -1]
      [1 -1  1 -1 -1  1 -1  1]
      [1  1 -1 -1 -1 -1  1  1]
      [1 -1 -1  1 -1  1  1 -1]]
```
`8 ->` [Pastebin](https://pastebin.com/aYkjxk7w)
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest solution in each language wins! Happy golfing!

[Answer]
# [MATL](https://github.com/lmendo/MATL), 4 bytes
```
W4YL
```
[Try it online!](https://tio.run/##y00syfn/P9wk0uf/f2MA "MATL – Try It Online")
**How it works:**
```
W       % Push 2 raised to (implicit) input
4YL     % (Walsh-)Hadamard matrix of that size. Display (implicit)
```
---
Without the built-in: **11 bytes**
```
1i:"th1M_hv
```
[Try it online!](https://tio.run/##y00syfn/3zDTSqkkw9A3PqPs/39jAA)
**How it works**:
For each Walsh matrix **W**, the next matrix is computed as [**W** **W**; **W** −**W**], as is described in the challenge. The code does that `n` times, starting from the 1×1 matrix [1].
```
1       % Push 1. This is equivalent to the 1×1 matrix [1]
i:"     % Input n. Do the following n times
  t     %   Duplicate
  h     %   Concatenate horizontally
  1M    %   Push the inputs of the latest function call
  _     %   Negate
  h     %   Concatenate horizontally
  v     %   Concatenate vertically
        % End (implicit). Display (implicit)
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~63~~ ~~44~~ 40 bytes
```
{map {:3(.base(2))%2},[X+&] ^2**$_ xx 2}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/OjexQKHaylhDLymxOFXDSFNT1ahWJzpCWy1WIc5IS0slXqGiQsGo9n9afpFCmoaxpl5Rfkl@kQZQylhToZqLs6AoM69EAajM3l5BXddQQV1BURFIgBggLSrx1jA1SjF5StZctf8B "Perl 6 – Try It Online")
Non-recursive approach, exploiting the fact that the value at coordinates x,y is `(-1)**popcount(x&y)`. Returns a flattened array of Booleans.
-4 bytes thanks to [xnor](https://codegolf.stackexchange.com/users/20260/xnor)'s [bit parity trick](https://codegolf.stackexchange.com/a/144027/64121).
[Answer]
# [Haskell](https://www.haskell.org/), ~~57~~ 56 bytes
```
(iterate(\m->zipWith(++)(m++m)$m++(map(0-)<$>m))[[1]]!!)
```
[Try it online!](https://tio.run/##y0gszk7NyflfbhvzXyOzJLUosSRVIyZX164qsyA8syRDQ1tbUyNXWztXUwVIauQmFmgY6GraqNjlampGRxvGxioqav7PTczMU7BVAEr6KhQUZeaVKKgolCsY//@XnJaTmF78XzfCOSAAAA "Haskell – Try It Online") This implements the given recursive construction.
*-1 byte thanks to [Ørjan Johansen](https://codegolf.stackexchange.com/users/66041/%c3%98rjan-johansen)!*
[Answer]
# [Octave](https://www.gnu.org/software/octave/) with builtin, ~~18~~ 17 bytes
```
@(x)hadamard(2^x)
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo0IzIzElMTexKEXDKK5C83@ahoEmV5qGIYgwAhHGmv8B "Octave – Try It Online")
# [Octave](https://www.gnu.org/software/octave/) without builtin, ~~56 51~~ 47 bytes
```
function r=f(x)r=1;if x,r=[x=f(x-1) x;x -x];end
```
[Try it online!](https://tio.run/##y08uSSxL/f8/rTQvuSQzP0@hyDZNo0KzyNbQOjNNoUKnyDa6AiSia6ipUGFdoaBbEWudmpfyH4i5uNI0DDSBhCGIMAIRxpr/AQ "Octave – Try It Online") Thanks to [@Luis Mendo](https://codegolf.stackexchange.com/users/36398/luis-mendo) for -4.
# [Octave](https://www.gnu.org/software/octave/) with recursive lambda, ~~54 53 52~~ 48 bytes
```
f(f=@(f)@(x){@()[x=f(f)(x-1) x;x -x],1}{1+~x}())
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en9z9NI83WQSNN00GjQrPaQUMzusIWKKSpUaFrqKlQYV2hoFsRq2NYW22oXVdRq6GpCdRgoMmVpmEIIoxAhLHmfwA "Octave – Try It Online") Thanks to [this answer](https://codegolf.stackexchange.com/a/137547/32352) and [this question](https://codegolf.stackexchange.com/questions/164454/whats-the-shortest-way-to-define-an-anonymous-recursive-function-in-octave) for inspiration.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 12 bytes
```
(⍪⍨,⊢⍪-)⍣⎕⍪1
```
[Try it online!](https://tio.run/##jY49DsIwDEb3nMJMbSUqUbgDJ@ACaWK1kfJTNc7ABRiQglgYWWBBHCsXKQH2qoOtJ33Pn8wHXcsj166bphTvcOgRhJN5cVsQtAhDIOhxRJABgRwQit4qwTVoZRRxUs761f96H7SGYXTdyA2UPrRGeZ/zCkrhjEFLKGd7KpZrvgNliu8UX@t0fmSqqxSf6XLL2LBffkBP@UmPnrEZd5PtjKdrUcx6zUJvu9DbfQA "APL (Dyalog Unicode) – Try It Online")
Output is a 2-dimensional array.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~75~~ 71 bytes
```
r=range(2**input())
print[[int(bin(x&y),13)%2or-1for x in r]for y in r]
```
[Try it online!](https://tio.run/##K6gsycjPM/r/v8i2KDEvPVXDSEsrM6@gtERDU5OroCgzryQ6GkhoJGXmaVSoVWrqGBprqhrlF@kapuUXKVQoZOYpFMWCmJUQ5v//JgA "Python 2 – Try It Online")
The Walsh Matrix seems to be related to the evil numbers. If `x&y` (bitwise and, 0-based coordinates) is an evil number, the value in the matrix is `1`, `-1` for odious numbers. The bit parity calculation `int(bin(n),13)%2` is taken from [Noodle9's](https://codegolf.stackexchange.com/users/9481/noodle9) comment on [this answer](https://codegolf.stackexchange.com/a/144027/64121).
[Answer]
# [R](https://www.r-project.org/), ~~61~~ ~~56~~ ~~53~~ 50 bytes
```
w=function(n)"if"(n,w(n-1)%x%matrix(1-2*!3:0,2),1)
```
[Try it online!](https://tio.run/##K/r/v9w2rTQvuSQzP08jT1MpM01JI0@nXCNP11BTtUI1N7GkKLNCw1DXSEvR2MpAx0hTx1Dzf7mGseZ/AA "R – Try It Online")
Recursively calculates the matrix by Kronecker product, and returns 1 for `n=0` case (thanks to Giuseppe for pointing this out, and also to JAD for helping to golf the initial version).
Additional -3 bytes again thanks to Giuseppe.
[Answer]
# [Haskell](https://www.haskell.org/), 41 bytes
```
(iterate([id<>id,id<>map(0-)]<*>)[[1]]!!)
```
[Try it online!](https://tio.run/##Fcm9DsIgEADg3ae4Jg5grNG4UhZdm3Q0QYaLgF7kL5Tn99TpG74Xrm8fI1OqpXW4YsfDXHIhB0IoLeUmTHcW1H3D7oUhpzS5/Z@EVRxHadVOS2NO1g6D5ISUYYLfzVAb5Q5bCHDmzyNEfK483i7L8gU "Haskell – Try It Online")
The version of Haskell on TIO doesn't yet have `(<>)` in Prelude so I import it in the header.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 bytes
```
1WW;"Ð€,N$ẎƊ⁸¡
```
[Try it online!](https://tio.run/##ASUA2v9qZWxsef//MVdXOyLDkOKCrCxOJOG6jsaK4oG4wqH/w4dH//8z "Jelly – Try It Online")
Change the `G` to `ŒṘ` in the footer to see the actual output.
[Answer]
## JavaScript (ES6), 77 bytes
```
n=>[...Array(1<<n)].map((_,i,a)=>a.map((_,j)=>1|-f(i&j)),f=n=>n&&n%2^f(n>>1))
```
The naive calculation starts by taking `0 <= X, Y <= 2**N` in `W[N]`. The simple case is when either `X` or `Y` is less than `2**(N-1)`, in which case we recurse on `X%2**(N-1)` and `Y%2**(N-1)`. In the case of both `X` and `Y` being at least `2**(N-1)` the recursive call needs to be negated.
If rather than comparing `X` or `Y` less than `2**(N-1)` a bitmask `X&Y&2**(N-1)` is taken then this is non-zero when the recursive call needs to be negated and zero when it does not. This also avoids having to reduce modulo `2**(N-1)`.
The bits can of course be tested in reverse order for the same result. Then rather than doubling the bitmask each time we he coordinates can be halved instead, allowing the results to be XORed, whereby a final result of `0` means no negation and `1` means negation.
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 41 bytes
```
f(n)=if(n,matconcat([m=f(n-1),m;m,-m]),1)
```
[Try it online!](https://tio.run/##FYwxCsAgDAC/EjoZSKBCt2I/UjqIYHFIFPH/aboc3A038mz8DrMaFFNzkuRVupa8wi3JA0ckOYVYHqSIVvsMCgl2goNgzKbLfQO@HP8G0T4 "Pari/GP – Try It Online")
[Answer]
# [K (ngn/k)](https://github.com/ngn/k), 18 bytes
```
{x{(x,x),'x,-x}/1}
```
[Try it online!](https://tio.run/##y9bNS8/7/z/NqrqiWqNCp0JTR71CR7eiVt@w9n@aggFXmoIhEBsBsfF/AA "K (ngn/k) – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 13 bytes
```
!¡§z+DS+†_;;1
```
[Try it online!](https://tio.run/##yygtzv7/X/HQwkPLq7RdgrUfNSyIt7Y2/P//vzEA "Husk – Try It Online")
1-indexed.
### Explanation
```
!¡§z+DS+†_;;1
 ¡        ;;1    Iterate the following function starting from the matrix [[1]]
  §z+              Concatenate horizontally
     D               The matrix with its lines doubled
      S+†_           and the matrix concatenated vertically with its negation
!                Finally, return the result after as many iterations as specified
                 by the input (where the original matrix [[1]] is at index 1)
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 39 bytes
```
Nest[ArrayFlatten@{{#,#},{#,-#}}&,1,#]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b73y@1uCTasagosdItJ7GkJDXPobpaWUe5VgdI6irX1qrpGOoox6r9T4s2jv3/X7egKDOvBAA "Wolfram Language (Mathematica) – Try It Online")
Almost directly copied from [this answer of mine](https://codegolf.stackexchange.com/a/259635/110698).
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 bytes
```
Ø+ṗ&P¥þ`
```
[Try it online!](https://tio.run/##ASIA3f9qZWxsef//w5gr4bmXJlDCpcO@YP/Dh0cpauKBvgoK//8z "Jelly – Try It Online")
```
Ø+ṗ         Take the Cartesian product of [1, -1] with itself n times.
      þ`    Table that with itself by:
   &        vectorizing bitwise AND (i.e. logical AND of sign bits!)
    P¥      then multiply the results.
```
A cell is -1 iff it has an odd number of 1 bits in the bitwise AND of its 0-indices. This effectively computes `[0 .. 2^n)`, tables that with itself by bitwise-AND-then-popcount, and raises -1 to each resulting power, but shortcuts all of those steps by representing 0 bits as 1 and 1 bits as -1 to begin with: `ṗ` provides the desired range without having to explicitly compute `2^n`, and the product is -1 iff there are an odd number of -1s, while thanks to the magic of zipwith-vectorization and two's complement representation the bitwise AND of two sign-list integers is still their bitwise AND as sign-list integers.
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), 10 bytes
```
.;`,^2$.@^-1+``@`&
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708LzMpKSe1eMGCpaUlaboWm_SsE3TijFT0HOJ0DbUTEhwS1CASUPkFC40hDAA)
Uses the formula \$W\_{i,j} = \left(-1\right)^{\operatorname{popcount}(\operatorname{bitand}(i,j))}\$.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org),100 89 79 bytes
```
f=n=>n?[...(m=F=>r.map(x=>[...x,...x.map(y=>y*F)]))(1,r=f(n-1)),...m(-1)]:[[1]]
```
[Try it online!](https://tio.run/##XZDBboMwDIbvPIVV7ZBMDlq226awWx9g2o1FgtGwUbUBEVpRVTx754S2wAQK9vf/tmO2@TF3RVs1nbD1xlxKRa9ViX1P4zhme7VWSRvv84b1KvGoR38EclLJ6XHNNedMYqtKZoXk3Ot7RpF@TVOp9SWKOuM6UMAq2yCYvuEqOUcAx7yF1jhSSi/xeFtXNvuy2dtVJOtH0ClYiFXJqFCpq4MTKmrr6p2Jd/UPW33@Vg781CJ3BprcObNZeZfZOeNHL/0ZtTFFZzbwcB47Dgjfhw7K@mA9pGFD5uuHaAjbsGek5QBBIkD4aozAEyEBkKi4Ewh0TsSVUJXmYz956zd5vBaWYE8Y/uQtffEpLh4dISHh4/kx4pCK0Skm/A/i3T2hpXsqmbtnzsVNpnvIcZnLHw "JavaScript (Node.js) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 16 bytes
```
oFoL<N&b0м€g®smˆ
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/3y3fx8ZPLcngwp5HTWvSD60rzj3d9v@/MQA "05AB1E – Try It Online")
**Explanation**
```
oF                 # for N in 2**input do:
  oL<              # push range [1..2**input]-1
     N&            # bitwise AND with N
       b           # convert to binary
        0м         # remove zeroes
          €g       # length of each
            ®sm    # raise -1 to the power of each
               ˆ   # add to global array
```
I wish I knew a shorter way to compute the Hamming Weight.
`1δ¢˜` is the same length as `0м€g`.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 20 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
àΩ2┤â#╣_ê|ª⌐╦è│╞►═∞H
```
[Run and debug it at staxlang.xyz!](https://staxlang.xyz/#p=85ea32b48323b95f887ca6a9cb8ab3c610cdec48&i=0%0A%0A1%0A%0A2%0A%0A3%0A%0A4%0A%0A5&a=1&m=1)
Thought I'd give my own challenge a try after some time. Non-recursive approach. Not too competitive against other golfing languages...
### Unpacked (24 bytes) and explanation
```
|2c{ci{ci|&:B|+|1p}a*d}*
|2                          Power of 2
  c                         Copy on the stack.
   {                  }     Block:
    c                         Copy on stack.
     i                        Push iteration index (starts at 0).
      {           }           Block:
       ci                       Copy top of stack. Push iteration index.
         |&                     Bitwise and
           :B                   To binary digits
             |+                 Sum
               |1               Power of -1
                 p              Pop and print
                   a          Move third element (2^n) to top...
                    *         And execute block that many times.
                     d        Pop and discard
                       *    Execute block (2^n) times
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~80~~ 79 bytes
```
f=lambda n:n<1and[[1]]or[r*2for r in f(n-1)]+[r+[-x for x in r]for r in f(n-1)]
```
[Try it online!](https://tio.run/##XYxBCsIwFAWv8ndJLC0k7kRP8g00UoIp@lJ@I8TTR4pdiLthGGZ5l3uGay1eHuF5mwLhhLMNmJit91lYDi5mIaEEihq9Nb5j6bivtPm6efH/SVskoZC6Qg1zTtCKdhjrOMj8Wot25ufw5X1xNKZ9AA "Python 2 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 49 bytes
Showcasing a couple of approaches using additional libraries.
This one relies on a built-in in Scipy:
```
lambda n:hadamard(2**n)
from scipy.linalg import*
```
[Try it online!](https://tio.run/##BcFLCoAgEADQfacYXKlEi2gldBM3U/YZ0FEmQTy9vVd6fTOvo@1@RExHQGD3YsCEEvRqLZvplpzgO6n0JRJjfIBSyVLtuLMAATEI8nPpzTgoQlyhaTKz8qzGDw "Python 2 – Try It Online")
# [Python 2](https://docs.python.org/2/), 65 bytes
And this one only uses Numpy, and solves by Kronecker product, analogously to my [R answer](https://codegolf.stackexchange.com/a/162303/78274):
```
from numpy import*
w=lambda n:0**n or kron(w(n-1),[[1,1],[1,-1]])
```
[Try it online!](https://tio.run/##DclBCsIwEAXQvacYukpCCo24KniSNosUrQ6aP2GIhJ4@dvM2rxz1Lbj2vqtkwi@XgzgX0eou7f5NeXskwjw5BxKljwpMMxiD9csSfIj@dAwx2r6fz8QgTXg9zc3OVJRRqRm2flgx9D8 "Python 2 – Try It Online")
]


[Question]
      [
# Description :
Given a string of space separated binary digits or space separated booleans or an array of binary digits or array of booleans . Your job is to find the xor of each until you end up with one answer either 0 or 1. The inputs will always be valid and will only be either 0 or 1.
# Example :
```
1 0 0 1 0 --> 0
1 0 1 1 1 0 0 1 0 0 0 0 --> 1
```
This is code golf so shortest code will win. Good luck.

[Answer]
# [Java (JDK 10)](http://jdk.java.net/), 12 bytes
```
s->s.sum()%2
```
[Try it online!](https://tio.run/##rU@7asNAEOz1FdsY7oJ9xGn9ADeBFKmUzrhYy5I5@V7c7jkIo29XzsJOirg0DOxjZmd3WzzjrD2cBm2DjwxtrlVibRRxrNGql0Xxj2qSq1h795DMvcogEXyidnApAELaG10BMXIOZ68PYDMnSo7aHbc7wHgkOUoBvvyH4/fbgmXOy/GONTSwGmi2JkXJCjl5GxajvuyIa6t8YhWyHRsnGoUhmG5DeVpsYsSObt8IV39DFm13l/kUXkdck15K@Qy7@R1/1r@47@iLfvgB "Java (JDK 10) – Try It Online")
If a string is really required, then **20 bytes**:
```
s->s.chars().sum()%2
```
[Try it online!](https://tio.run/##lY27CgJBDEX7/YogCDOCg9r6ABvBwko7sYirq7POi0lGEPHb12HdThu5kJDcnJsa7zisT7dG2@AjQ51nlVgbRRzPaNVgWnxZVXIla@9@mnlXGiSCDWoHzwIgpKPRJRAj53b3@gQ2e2LLUbvL/gAYLyTbU4CdXztedQ9mn5MFVDBvaLggVV4xkpCKkhWyP2mmLbR9EJ@t8olVyAAbJyqFIZjHknKc6I1hlJVrT8o/kHGrDv2oC3gVr@YN "Java (JDK 10) – Try It Online")
The "string" answer uses the fact that a space is codepoint 32, which mod 2 returns 0.
[Answer]
# JavaScript (ES6), 18 bytes
```
s=>eval(s.join`^`)
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1i61LDFHo1gvKz8zLyEuQfN/cn5ecX5Oql5OfrpGmka0oY6CARiBGLGamlxY5Q1hCKEWjoCa/gMA "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 17 bytes
```
lambda a:sum(a)%2
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHRqrg0VyNRU9Xof0FRZl6JQppGtKGOARACyVhNLhRBQzCESkJgrOZ/AA "Python 2 – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
OÉ
```
[Try it online.](https://tio.run/##MzBNTDJM/f/f/3Dn///RhjoGOoZgaABmGUBgLAA)
**Explanation:**
* `O`: Take the sum of the input-array
* `É`: Evaluates `sum % 2 == 1`, returning `1` if the sum is odd, `0` otherwise
---
**3 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)**:
A leading `Ç` can be added if the space-delimited string input was still mandatory, instead of a boolean-array.
[Try it online.](https://tio.run/##MzBNTDJM/f//cLv/4c7//w0VDBQMwdAAzDKAQAA)
* `Ç`: Push the ASCII values of all characters, and implicitly convert it to a list. `0 1` would become `[48, 32, 49]` in that case. The `O` (sum) and `É` (is odd?) will still act the same.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 23 bytes
```
a=>a.reduce((c,d)=>c^d)
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i5Rryg1pTQ5VUMjWSdF09YuOS5F839yfl5xfk6qXk5@ukaaRrShjgEQAslYTU0uLHKGYAhVA4FAlf8B "JavaScript (Node.js) – Try It Online")
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), 44 bytes
```
A	X =X + INPUT	:S(A)
	OUTPUT =REMDR(X,2)
END
```
[Try it online!](https://tio.run/##K87LT8rPMfn/35EzQsE2QkFbwdMvIDSE0ypYw1GTi9M/NATIU7ANcvV1CdKI0DHS5HL1c/n/35DLAAiBJAA "SNOBOL4 (CSNOBOL4) – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) `-p040`, 10 bytes
Assumes the input list can't be empty
```
$\^=0+$_}{
```
[Try it online!](https://tio.run/##K0gtyjH9/18lJs7WQFslvrb6/39DBUMFAyA2/JdfUJKZn1f8X7fAwMQAAA "Perl 5 – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~3~~ 2 bytes
```
so
```
Input can be a numeric vector of the form `[1 0 0 1 0]`, or a string such as `'10010'` (thanks to [@Giuseppe](https://codegolf.stackexchange.com/users/67312/giuseppe) for noticing!).
[**Try it online!**](https://tio.run/##y00syfn/vzj///9oQwUDIASSsQA "MATL – Try It Online")
### Explanation
The code is `so` simple that it hardly needs an explanation, but here it goes.
```
s    % Implicit input: numeric vector (or string). Sum of the numbers. (For string
     % input, the ASCII codes are summed. Character '1' is odd, '0' is even, and
     % space is even too, so the parity is the same as with numeric vector input)
o    % Parity. Implicit display
```
[Answer]
# Java 10, 41 bytes
```
b->{var r=1<0;for(var c:b)r^=c;return r;}
```
The variable r is initially set to false, since we are `XOR`ing `b[0]` with it. Try it online [here](https://tio.run/##pY7BbsIwDIbP6VP42Eij2q503RugSeMyaRqSG1IUCAly3G5TlWcvCSDBAU67@Pdv2d/vLQ44265306FvrVGgLIYACzQOxkIYx5o6VBo@3z/yQLTeW40Ofj2Vl/7rOztZFyIW4oIJjJxk8GYN@wQrl0zGbdIq0ibIEyoj0yE0MLWzt3FAAmpeXp/rLrGzU/NW0qpRNWnuyQHVcRIi5YjlX2C9r3zP1SFx2boykar8lNM/cH1sZOr1E3Row1VuZlHKf/DO5rY@DLor5/RYxOkI).
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 8 bytes
```
L~,€Os2%
```
[Try it online!](https://tio.run/##S0xJKSj4/9@nTudR0xr/YiPV////KxkqGCgYgqEBmGUAgUr/8gtKMvPziv/r6mbmFuRkJmeWAAA "Add++ – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~5~~ ~~3~~ 2 bytes
```
^/
```
[Try it online!](https://tio.run/##y0rNyan8/z9O///h9kdNa/7/jzbUUTDQUTCEIQMY1wCOYnUUolFkYgE "Jelly – Try It Online")
-2 bytes thanks to user202729!
[Answer]
# [Befunge-98 (FBBI)](https://github.com/catseye/FBBI), 8 bytes
```
#.~+2%#@
```
[Try it online!](https://tio.run/##S0pNK81LT9W1tPj/X1mvTttIVdnh/39DBQMgBJIA "Befunge-98 (FBBI) – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 2 bytes
```
r^
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=cl4=&input=WzEsMCwwLDEsMF0=)
Does exactly what it says on the tin, `r`educe the array by XORing.
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 11 bytes
```
i?+<^<@Oa1<
```
[Try it online!](https://tio.run/##Sy5Nyqz4/z/TXtsmzsbBP9HQ5v9/QwUDBUMwNACzDCAQAA "Cubix – Try It Online")
It's been a while, so it feels good to write a Cubix answer!
[Answer]
# [Whispers v2](https://github.com/cairdcoinheringaahing/Whispers), 38 bytes
```
> Input
> 2
>> ∑1
>> 3%2
>> Output 4
```
[Try it online!](https://tio.run/##K8/ILC5ILSo2@v/fTsEzr6C0hMtOwYjLzk7hUcdEQxBtrArm@peWACUVTP7/jzbUUTDQUTCEIQMY1wCOYgE "Whispers v2 – Try It Online")
I feel like 3 answers is too many, but I wanted to get Whispers out again. I'm still working on an XOR approach
[Answer]
# (Traditional) APL, 3 or 4 bytes
[TIO](https://tio.run/##SyzI0U2pTMzJT///qKM9Ir/o/6POBfqP@qaCuP8VwAAoymWoYACEQJILVcwQDKFyEAgA), courtesy Adám
```
≠/⍎⎕
```
Analysis:
`⎕` - Accept input.
`⍎` - "unquote" it (if it's a quoted string, this will convert it to a numeric vector. If it's already a numeric vector, this is effectively a null op)
`/` - reduction - apply the operator to the left to each successive item in the vector to the right
`≠` - "not equal" - when applied strictly to boolean arguments, this is functionally identical to XOR (which is not implemented as a separate operator in APL)
If it may be assumed that the input will be a numeric vector instead of a quoted string, then the 'unquote' can be removed, saving one byte:
```
≠/⎕
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 42 bytes
```
->s{s.split(' ').reduce(0){|a,b|a^b.to_i}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1664ulivuCAns0RDXUFdU68oNaU0OVXDQLO6JlEnqSYxLkmvJD8@s7b2f0FpSbFCWrS6oYIBEAJJ9VguZDFDMITKQaB67H8A "Ruby – Try It Online")
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 2 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Tacit prefix function.
```
≠/
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1HnAv3/aY/aJjzq7XvUN9XT/1FX86H1xo/aJgJ5wUHOQDLEwzP4f5qCoYIBEAJJLgjbEAyhYhAIAA "APL (Dyalog Unicode) – Try It Online")
`/` is reduction and `≠` is XOR because XOR only gives `1` if its arguments are unequal.
[Answer]
# [Julia 0.6](http://julialang.org/), 12 bytes
```
b->⊻(b...)
```
[Try it online!](https://tio.run/##yyrNyUw0@59m@z9J1@5R126NJD09Pc3/uYkFGgVFmXklOXmPOmak6ShoRBvoGOoYAKFhrI5CtKGCgYIhGBqAWQYQGKuuqanwHwA "Julia 0.6 – Try It Online")
`⊻` is the xor symbol, and `b...` distributes an array as individual elements before sending it to the xor function (since xor needs multiple arguments passed separately, not a single array argument).
A bit more interestingly, a version that accepts space separated (/comma-separated/unseparated) boolean values as a string, and returns the xor result :
### Julia 0.6, 22 bytes
```
b->sum(Int.([b...]))%2
```
[Try it online!](https://tio.run/##yyrNyUw0@59m@z9J1664NFfDM69ETyM6SU9PL1ZTU9Xof25igUZBUWZeSU7eo44ZaToKGkoGOoY6BkBoqKSgo6BkqGCgYAiGBmCWAQQqwaSUNDUV/gMA "Julia 0.6 – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~41~~ ~~39~~ 38 bytes
Saved a few bytes with inspiration from ceilingcat.
Saved another byte thanks to Jonathan Frech
```
r;f(char*s){for(r=0;*s;)r^=*s++;r&=1;}
```
[Try it online!](https://tio.run/##S9ZNT07@/7/IOk0jOSOxSKtYszotv0ijyNbAWqvYWrMozlarWFvbukjN1tC69n9uYmaehiZXNZeCQkFRZl5JmoaSakpMnpIOkGGoYACEhmBsqKSpaY1LkSEYwhSDIVh57X8A "C (gcc) – Try It Online")
]


[Question]
      [
**This question already has answers here**:

[There Was an Old Lady](/questions/3697/there-was-an-old-lady)
 (31 answers)

Closed 5 years ago.
So, there's a famous children's rhyme...
```
This is the house that Jack built.
This is the malt
That lay in the house that Jack built.
This is the rat
That ate the malt
That lay in the house that Jack built.
This is the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the cow with the crumpled horn
That tossed the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the maiden all forlorn
That milked the cow with the crumpled horn
That tossed the dog that worried the cat
That killed the rat that ate the malt
That lay in the house that Jack built.
This is the man all tattered and torn
That kissed the maiden all forlorn
That milked the cow with the crumpled horn
That tossed the dog that worried the cat
That killed the rat that ate the malt
That lay in the house that Jack built.
This is the judge all shaven and shorn
That married the man all tattered and torn
That kissed the maiden all forlorn
That milked the cow with the crumpled horn
That tossed the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the rooster that crowed in the morn
That woke the judge all shaven and shorn
That married the man all tattered and torn
That kissed the maiden all forlorn
That milked the cow with the crumpled horn
That tossed the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the farmer sowing his corn
That kept the rooster that crowed in the morn
That woke the judge all shaven and shorn
That married the man all tattered and torn
That kissed the maiden all forlorn
That milked the cow with the crumpled horn
That tossed the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the horse and the hound and the horn
That belonged to the farmer sowing his corn
That kept the rooster that crowed in the morn
That woke the judge all shaven and shorn
That married the man all tattered and torn
That kissed the maiden all forlorn
That milked the cow with the crumpled horn
That tossed the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
```
Obviously, it's pretty process-based, you could totally write code for this, right?
---
* Write some code which outputs the full text of "The house that Jack built".
* Standard rules and loopholes and stuff.
* Any language you like.
* Try to do it in the smallest number of bytes.
* I always like to see [TIO](http://tio.run) links.
* The case must match the rhyme.
* Each line of the rhyme must be on a new line of text.
* White-space before and after the line is fine.
* No punctuation, except the full stop at the end of each verse.
---
Edit:
Earlier versions of this question contained an issue with this line
This is the rooster that crowed the morn
It was inconsistently applied.
To be clear; this should be one line on every occurrence, and should be added at once.
---
Further edit:
It's been declared that this question is a duplicate of:
[We're no strangers to code golf, you know the rules, and so do I](https://codegolf.stackexchange.com/questions/6043/were-no-strangers-to-code-golf-you-know-the-rules-and-so-do-i)
However, while you could take the same approach, compressing the text as much as possible. There's also a chance to take a procedural approach to this rhyme, following the structure of the rhyme itself. Some of the solutions take this approach, so I'd say it is a similar, but distinct challenge for this reason.
[This answer](https://codegolf.stackexchange.com/a/161993/16824) suggests that it's actually better to take the approach to this question which would not work for Rick Astley.
It is, however, a duplicate of the old lady song, and the 12 days of Christmas. I've voted to close it. (although, those two were not declared duplicate of each other).

[Answer]
# JavaScript (ES6), 356 bytes
Procedural approach.
```
_=>`house th5 Jack built.
|malt6lay in|r565e|c56kill2dog6worri2cow with0crumpled h16toss2maiden3forl16milk2man3t5tered4 t16kiss2judge3shaven4 sh16marri2rooster6crowed in0m16woke|farmer sowing his c16kept|horse40hound40h16belonged to`.replace(/\d/g,n=>` the ,orn,ed|, all , and,at,
That `.split`,`[n]).split`|`.map(s=>`This is`+(p=' the '+s+p),p='').join`
`
```
[Try it online!](https://tio.run/##LY/BbsMgEETv@QpusRXqxEnMLf2AnnNrq0JhbYiBtQDHquR/TzdVL7va1cwbzU3dVdbJTeUlooFHf3l8XV6lxTkDK7Zjb0qP7Ht2vjSbNShfhFc/zMU1daKDVXdidN4fDQ5iwZTcUePCFlfsQac5TB4Ms60omPMxKGcgnnpMvhXB@ZE@8VS6AgnMmZWWUCS7zWaAU7bqDvHMMrmDeoITYiap0AkXorp4CC1ljrD2KgVILOPi4sCsy0wTC6ayWkwZzgeqEw2tVnyDxziQvaBsEkxeaaj2H2Y/8Ei9qTIwjilyMCtnyntGMxquCt9crSpMNnnyrkgu3@Nn/X@ssglqqjIRrs94l@Wumi7bP9x2l3dTzenc1s0NXZQb@dAYM3poPA5VX9X14xc "JavaScript (Node.js) – Try It Online")
---
# Simple compression, 429 bytes
Using [RegPack](https://siorki.github.io/regPack.html).
```
_=>[...'IKLMNOPQRSUVWXYZ[]^_0qxz{}~'].reduce((s,c)=>(l=s.split(c)).join(l.pop()),`TNis_ZOlt }{rQ z^}{cQ Sz^ }KM}]M}xI[I~Z0ZYZLrseULundU{hWbelongV toY~{judgeRshavenU shWmarriV[MP}PZ{ the z
ThQ xOidenRforlWmilkV]qworriV{cQS 0{rooster XcrowV in{mWwoke~_Luse XJack built.^QeOlt]{cow with{crumplV hWtossVK[OnRtQterVU tWkissVxZ
TNisY{farmer sowing NcWkept0XthQ WornzVedU andSzkillV{rQR all QatPzlay in_O{maNhis Mzqz^L{hoK{dog IXqX^}`)
```
[Try it online!](https://tio.run/##FZDPbqMwGMTveYrvVpC6KC@Q3rOBEEj5ExBQ1zjgYGxim5LFIq@epdfRaOY3c0M/SGFJB/2Hi5q8rrtXtfvIHcd52x9c7@ifgvAcxUl6yfKirLb3x2yW51vhSFKPmFiWesf27sNiO@WogVFtYdt2boJyizmDGCzbfv/6PFJVZT7TsBgZwFwuBgdwnktYDt5SeMtjn@@f2Ta7ZK5UJHJHXkemTb4JE7yJQYvL09zGuiGhatEP4RGoNumRlDTOvdNyygzolsC8@WwDePi0Jjy8CsmSnrIuLu6T@LWupWfYGimE0kRCiqWYYqDc9MkkOvKs3FERSP8i3MH3SJl2yoCs1IXBYoKJ6tZgOfYDi6FNtFAqPuQ@D3WwpsUR6KSjq/bINpvfwRdzRbJfe5SYKG/giJOODHqb6pUxEZLPMakjQLw@zx1lLF6vCQExBgHSp5mhfyta5ZseHVuqwJvvc@maVhxMLRrYp/e0XL7sFxZcCUYcJhrrur79@g8 "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~398~~ 397 bytes
```
for i in range(12):print'\nThis is the',''.join(dict(zip('012345','\nThat , the ,orn,ed, all , and'.split(','))).get(c,c)for c in'1'.join('horse51hound51h20belong3 to|farmer sowing his c20kept|rooster that crow3 in1m20woke|judge4shaven5 sh20marri3|man4tatter35 t20kiss3|maiden4forl20milk3|cow with1crumpl3 h20toss3|dog0worri3|cat0kill3|rat0ate|malt0lay in|house that Jack built.'.split('|')[~i:]))
```
[Try it online!](https://tio.run/##PZDBboQgEIZfhRuSGKOil32Ennvb9sAiq7MiY2Cs2Yb01e3YNk1IIDP/fP/PrE@aMLTHcccoQEAQ0YTRFU2rLmuEQPItvE6QBB@anCylrB4IoRjAUvEJayHrptVdz51TaUiUp1CUGEPphlIY77lkwiCrtHqggpVKqWp0VNjSqtPYsrFs/shywphc30y4hYGvtr45j2HUgjDfTVxcFAl3CKM4g9m2nt1KOSIm4hadGWzEXTO0Wdp6x9nlxzaMrkuT@XChF4mhi4kRdF5M6MgQT@peELMgpbMKgwsdZ/OsBD/rbHEXO9DU2Lgtq9eCGYSneMCRTX5o1hATvNc58suQY5Kn2psnh8n8o@R@A74YO4vbBp6q/71kqa5fcHlX6ji@AQ "Python 2 – Try It Online")
---
# [Python 2](https://docs.python.org/2/), ~~401~~ 398 bytes
```
for i in range(12):print'\nThis is the',' the '.join('horse and the hound and the horn?belonged to|farmer sowing his corn?kept|rooster that crowed in the morn?woke|judge all shaven and shorn?married|man all tattered and torn?kissed|maiden all forlorn?milked|cow with the crumpled horn?tossed|dog?worried|cat?killed|rat?ate|malt?lay in|house that Jack built.'.split('|')[~i:]).replace('?','\nThat ')
```
[Try it online!](https://tio.run/##RVBNa8MwDP0rvjmBEViPvfS@827bDq6jxmocK8jKQsHsr2eyOxgYLEvvQ37rQwKl03HciA0aTIZdmqB7PfXnlTGJ/UzvAbPRIwHsi62XscOdMHU2EGcwLo2tG2jT6v/F6XKFSKqnHSo3xwuwybRjmkwV9RUywyqFibLoUIIT45l2pegyVWepoJ1mKPdtnNQtRpOD@4bUrHLzWRwzwlgWlxpAnKgc/G3TbDDnBsARnhj9cmxcjLNOPO1mRwnN1PO2rFH5TV2ocUeadJGnkXeiklEhhbV0Aiod5RLdQxcvGoUG037z5vxsrhtGGeyQ14jS2WL7jx88f/UDwxqdh85eNNuatTJsfxy/ "Python 2 – Try It Online")
---
Saved
* -3 bytes, thanks to Jonathan Frech
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~256~~ ~~245~~ 241 bytes
```
“x´ž€†0ƒé€Š Jackíš.xâì0íàltx¨Ù0ÄŠxÜ³0—Äx€„ssed0‹·x«Ëed0Ð§€Ž0 crumpledÑÛx·—ed0ì›€Ÿ€‡lornx¢¢0…Ž€Ÿ»ättered€ƒ€„rnx woke0¡Ë€Ÿ shaven€ƒ shornx¤°0ÝËoster€Š crowed€†0›árnxÊÂed€„0ÃË€Êwing€ËÃÅx0î€€ƒ0 hound€ƒ0ÑÛ“0’ €€’:'x¡'€Š™ìηʒRćD'€€kG¦}„€Œ€ˆªì¸ì»¶«,
```
[Try it online!](https://tio.run/##LZDLSsNAFIZfJbtuRMaFG9eC4NI3qO1gpTWRpDWzEUqtCs1Gi5tiLUkp9dILgmKrpS7Ob7pQ8CHyIvHMxMXAuXzn/@ccsZnf35BpmtS7il7jz6QxTuqhWLXxyGEcWrv5QhmTOFpX6GMsMEFYqSp6QEegGYcKXXoRSf0GTWVme54ni1x4p5miEQJOcEX3WmwprIJbOzquyCKucatoxnO6z2MfGpgbhajiuLaiPvVZZhgvTYcWGFSr0pVFTlftzIoxy3fKUlCEwGCWV8qfSNswHBuhAT0L3CFwPJ7Pliq4jm@U9K5sjohBtND4L/YEzowiWv6hfaCDgCvnSmCqAS0vrJJTs7PvCL0Pn5C1OlYGcLSVUxTljGPS5OP9zr7be1@X27mMKO/Q8JS9NKAX@rmgJ4xpzm9BbzRaS9M/ "05AB1E – Try It Online")
[Answer]
# Java 8, ~~666~~ ~~649~~ ~~640~~ ~~636~~ 625 bytes
```
$->{String y="This is",x="That ",w="orn\n",A="~house that Jack built.\n\n",B="~malt\n",D="~rat\n",F="~cat\n",H="~dog\n",J="~cow with~crumpled h"+w,L="~maiden all forl"+w,N="~man all tattered and t"+w,P="~judge all shaven and sh"+w,R="~rooster that crowed in~m"+w,T="~farmer sowing his c"+w,r=y+A,a[]={B,"lay in"+A,D,"ate"+B,F,"killed"+D,H,"worried"+F,J,"tossed"+H,L,"milked"+J,N,"kissed"+L,P,"married"+N,R,"woke"+P,T,"kept"+R,"~horse and~hound and~h"+w,"belonged to"+T};for(int i:"123425642786429:8642;<:8642=><:8642?@><:8642AB@><:8642CDB@><:8642EFDB@><:8642".getBytes())r+=(i%2>0?y:x)+a[i-49];return r.replace("~"," the ");}
```
Well..
NOTE: It's just like every other (non-encoded) answer incorrect for the verses about the `maiden` and `man`, where the lines of the dog and cat, as well as rat and malt are on a single line, instead of new-line separated.. I'm just too lazy to fix it, since it's closed as a dupe anyway.
**Explanation:**
[Try it online.](https://tio.run/##RVLbjtowEH3vV1ijrZQoJmopvSxp2EIpQogitEV9YXkwiQGDsZHtkEUIfp2OE9pKiX1mjmc0l7NlR9bY5rtbJpm15CcT6vyGEKEcNyuWcTLxJiG/nBFqTbLgtxY5eQgT9F7wx8865kRGJkSRlNweGp3z/fEphdlGWCIs0FePmSNAyxS0US8KaDeF60YXlhPnqRHLdmRZCOnil4rvIb9n0nncR2xYBQcIsxoOEeZ67eHIe3VJSuE218wU@4PkOdlAVNJxlUfkXBEmJVlpI717UrlrH7aADWMAUzlxnp0iuy3yNa94u2FHH46srXI@@3q0thhVV58ZXWK8UNe952fIr5jZI2116afhJ5F5yqSnqEvZfJGeexQkO2EQoKdPgTkOUY8OKOyExPoh6tMhhVIbI7w1oCMKTlvrjSEdU9gLufPGiE58UM2M6RQZdg@a0GefYoepp3SGr/gBO0QfDt/g8LEpvwaV18iXCEsutVpjP05DNLskOLMANUFEG943P7SaHz@1mp@/4PHY9mfytbrSTn0/fbuDbu8v@t7/B38M/mOI19z1To7bIAxNlAbibbPz7unUfg0jNheN1uMiMdwVRhETG36QKMkArkABp84JhMnlltQyPBRLiTK8q/HoZYpLV0EtxvmChXcln3Bp@1gXLj4g4wIVZ4EqpAzvor7c/gA)
```
$->{                  // Method with empty unused parameter and String return-type
  String y="This is", //  Temp-String "This is"
         x="That ",   //  Temp-String "That "
         w="orn\n",   //  Temp-String "orn\n"
                      //  " the ...\n" temp Strings:
  A="~house that Jack built.\n\n",
  B="~malt\n",
  D="~rat\n",
  F="~cat\n",
  H="~dog\n",
  J="~cow with~crumpled h"+w,
  L="~maiden all forl"+w,
  N="~man all tattered and t"+w,
  P="~judge all shaven and sh"+w,
  R="~rooster that crowed in~m"+w,
  T="~farmer sowing his c"+w,
  r=y+A,              //  Result-String, starting at:
                      //   This is the house that Jack built.\n\n
  a[]={               //  String-array, containing:
    B,                //   the malt\n
    "lay in"+A,       //   lay in the house that Jack built.\n\n
    D,                //   the rat\n
    "ate"+B,          //   ate the malt\n
    F,                //   the cat\n
    "killed"+D,       //   killed the rat\n
    H,                //   the dog\n
    "worried"+F,      //   worried the cat\n
    J,                //   the cow with the crumpled horn\n
    "tossed"+H,       //   tossed the dog\n
    L,                //   the maiden all forlorn\n
    "milked"+J,       //   milked the cow with the crumpled horn\n
    N,                //   the man all tattered and torn\n
    "kissed"+L,       //   kissed the maiden all farlorn\
    P,                //   the judge all shaven and shorn\n
    "married"+N,      //   married the man all tattered and torn\n
    R,                //   the rooster that crowed in the morn\n
    "woke"+P,         //   woke the judge all shaven and shorn\n
    T,                //   the farmer sowing his corn\n
    "kept"+R,         //   kept the rooster that crowed in the morn\n
    "~horse and~hound and~h"+w,
                      //   the horse and the hound and the horn\n
    "belonged to"+T}; //   belonged to the farmer sowing his corn\n
  for(int i:"123425642786429:8642;<:8642=><:8642?@><:8642AB@><:8642CDB@><:8642EFDB@><:8642".getBytes())
                      //  Loop over the bytes of the String above
    r+=(i%2>0?y       //   If `i` is odd: Append "This is "
        :x)           //   Else (`i` is even): Append "That " instead
       +a[i-49];      //   And also append the string from the array at index `i-49`
  return r.replace("~"," the ");}
                      //  Return the result, with all "~" replaced with " the "
```
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), ~~322~~ 308 bytes
```
0horse20hound20h3belonged to0farmer sowing his c3kept0rooster that crowed in0m3woke0judge all shaven2 sh3married0man all tattered2 t3kissed0maiden all forl3milked0cow with0crumpled h3tossed0dog1worried0cat1killed0rat1ate0malt1lay in0house that Jack built.
3
orn1
1
¶That
L^$`0.*
This is$&$'¶
2
 and
0
 the
```
[Try it online!](https://tio.run/##JY8xbsMwDEV3nUJD0AIdAsm6RdExcxFGYixVshhIdI1eLAfIxVzanj7BR35@NuRUwa6rMpFax0FkrkHE3bBQHTFoJnOHNmHTnZZURx1T195lfLBpRJ2FcATWvtEi86mayS2U0fzMYUQNpege4RfrIOomaC1hMBPUHTGwOGAYNLucet9RCnjQO7XiplSytD0tekkcjW/z9ChyKjqmfSPQaBc6jD2wzakIN01KYBTDwrbA35ZNHux4BP4En/VtToXPyilq1SqrXs/LxtTX9@lqzh/qsr2b@unt9P56qkFpqEEZJQ6o1/Uf "Retina – Try It Online")
[Answer]
# [Jstx](https://github.com/Quantum64/Jstx), 293 [bytes](https://quantum64.github.io/Jstx/codepage)
```
↕Δ"▌ÇÇÉÇ◙ëÇÇÇÇÇÇÇ¬ÜëºΣ£•☼▀2.─&│E╧=▒√║∙►ybⁿ☯╫QΔ(☺¥ë2↕☯k`u3xò6┘[↨:ªh°♀êΔ╘δ‼δ@W$A⌐ΘsΘ↕║∞Φ⌡▌b⌐M±uc9╖#→δ¡9¼▀Ö╪♠¬╢æ¥.≈ëzTH♂⌡Q┐àÿî♥τ◄≈«‼û4_≤╛─◄→♂U┌█2Üüà╓ªçδ»Aÿ▄╜9■q▒iö♦4s⌐±[╗:áxÿº•╗.é÷╫╙σG¼╧[]┌>5←◙÷ö╣↨>≤±Bøz→▲√┐•♫◘╚←<∟⌡₧o?PB|Å╩↔Θ↨Γ»H☻▒╩z`6_ⁿ#∩⌂ε╦╬SNΦ9└├↓¥n-d┴≤α┐'F+~<,+╒↑│░»|M☯½☺E}°]dπ☻Ñö°á╠üdhP▼{Bßë
```
[Try it online!](https://quantum64.github.io/Jstx/JstxGWT-1.0.3/JstxGWT.html?code=4oaVzpQi4paMw4fDh8OJw4fil5nDq8OHw4fDh8OHw4fDh8OHwqzDnMOrwrrOo8Kj4oCi4pi84paAMi7ilIAm4pSCReKVpz3ilpLiiJrilZHiiJnilrp5YuKBv%24KYr%24KVq1HOlCjimLrCpcOrMuKGleKYr2tgdTN4w7I24pSYW%24KGqDrCqmjCsOKZgMOqzpTilZjOtOKAvM60QFckQeKMkM6Yc86Y4oaV4pWR4oiezqbijKHiloxi4oyQTcKxdWM54pWWI%24KGks60wqE5wrziloDDluKVquKZoMKs4pWiw6bCpS7iiYjDq3pUSOKZguKMoVHilJDDoMO_w67imaXPhOKXhOKJiMKr4oC8w7s0X%24KJpOKVm%24KUgOKXhOKGkuKZglXilIzilogyw5zDvMOg4pWTwqrDp860wrtBw7_iloTilZw54pagceKWkmnDtuKZpjRz4oyQwrFb4pWXOsOheMO_wrrigKLilZcuw6nDt%24KVq%24KVmc%24DR8K84pWnW13ilIw%24NeKGkOKXmcO3w7bilaPihqg%244omkwrFCw7h64oaS4pay4oia4pSQ4oCi4pmr4peY4pWa4oaQPOKIn%24KMoeKCp28_UEJ8w4XilanihpTOmOKGqM6TwrtI4pi74paS4pWpemA2X%24KBvyPiiKnijILOteKVpuKVrFNOzqY54pSU4pSc4oaTwqVuLWTilLTiiaTOseKUkCdGK348LCvilZLihpHilILilpHCu3xN4pivwr3imLpFfcKwXWTPgOKYu8ORw7bCsMOh4pWgw7xkaFDilrx7QsOfw6s%3D)
]


[Question]
      []


[Question]
      [
You must fill an array with every number from `0-n` inclusive. No numbers should repeat. However they must be in a random order.
# Rules
All standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules and standard loopholes are banned
The array must be generated pseudo-randomly. Every possible permutation should have a equal probability.
# Input
`n` in any way allowed in the I/O post on meta.
# Output
The array of numbers scrambled from `0-n` inclusive.

[Answer]
# [Tcl](http://tcl.tk/), 90 bytes
```
proc R n {lsort -c {try expr\ rand()>.5 on 9} [if [incr n -1]+2 {concat [R $n] [incr n]}]}
```
[Try it online!](https://tio.run/##K0nO@f@/oCg/WSFIIU@hOqc4v6hEQTdZobqkqFIhtaKgKEahKDEvRUPTTs9UIT9PwbJWITozDYjzkouAGnQNY7WNFKqT8/OSE0sUooMUVPJiYZKxtbG1/wtKS4pB4kYGsf8B "Tcl – Try It Online")
# [Tcl](http://tcl.tk/), 96 bytes
```
proc R n {proc f a\ b {expr rand()>.5}
set i -1
while \$i<$n {lappend L [incr i]}
lsort -c f $L}
```
[Try it online!](https://tio.run/##K0nO@f@/oCg/WSFIIU@hGsxKU0iMUUhSqE6tKChSKErMS9HQtNMzreUqTi1RyFTQNeQqz8jMSVWIUcm0UQHqyUksKEjNS1HwUYjOzEsuUsiMreXKKc4vKlHQBZml4lP7v6C0pFghOkjByCD2PwA "Tcl – Try It Online")
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2), 3 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
Ėµr
```
[Try it online!](https://Not-Thonnu.github.io/run#aGVhZGVyPSZjb2RlPSVDNCU5NiVDMiVCNXImZm9vdGVyPSZpbnB1dD0xMCZmbGFncz0=)
#### Explanation
```
Ėµr  # Implicit input
Ė    # Push [0..input]
 µr  # Random shuffle
     # Implicit output
```
[Answer]
# [Factor](https://factorcode.org/), 25 bytes
```
[ dup [0,b] swap sample ]
```
[Try it online!](https://tio.run/##S0tMLskv@h8a7OnnbqWQm1iSoVeUmJeeWqwApFLycxWyU4vyUnMUCopSS0oqC4oy80oUrLm4DA3@RyuklBYoRBvoJMUqFJcnFigUJ@YW5KQqxP5PTszJUdD7DwA "Factor – Try It Online")
```
        ! 10
dup     ! 10 10
[0,b]   ! 10 { 0 1 2 3 4 5 6 7 8 9 10 }
swap    ! { 0 1 2 3 4 5 6 7 8 9 10 } 10
sample  ! { 3 6 9 10 4 8 2 5 7 0 }
```
[Answer]
# [Arturo](https://arturo-lang.io), 17 bytes
```
$=>[shuffle@0..&]
```
[Try it!](http://arturo-lang.io/playground?HiHnFm)
```
$=>[          ; a function where input is assigned to &
    0..&      ; a range from 0 to input inclusive
    @         ; reify the range (make it a concrete array)
    shuffle   ; shuffle it
]             ; end function
```
[Answer]
# [RProgN 2](https://github.com/TehFlaminTaco/RProgN-2), 3 bytes
```
0Rñ
```
## Explained
```
0Rñ
0R  # Range of numbers 0-n (Implicit input)
  ñ # Shuffle, Implicit output.
```
[Try it online!](https://tio.run/##Kyooyk/P0zX6/98g6PDG////mwIA "RProgN 2 – Try It Online")
[Answer]
# [AWK](https://www.gnu.org/software/gawk/manual/gawk.html), ~~82~~ 80 bytes
```
{for(n=$1+2;++j<n;$j=j-1);for(srand();--n;){t=$(i=int(n*rand()+1));$i=$n;$n=t}}1
```
[Try it online!](https://tio.run/##JcsxCoAwDADAz2RIDB0qOMU8piBCK0SoBYfSt0fF@bh0H@59PyuaQuRZmMtqAkVLiCQfXDXZhiQhmFBvCpg1W0ObfuBIJJAV3mbaxojuywM "AWK – Try It Online")
`AWK` doesn't have a built-in shuffle, so this is the best I could come up with.

The `srand()` call is needed to prevent each execution from returning the same randomized sequence.
Thanks go to @ceilingcat for moving the call to *srand()* and the arithmetic tweaks to save 2 bytes.
[Answer]
# [Perl 5](https://www.perl.org/), 21 bytes
```
@a{0..<>}=$,=$/;say%a
```
[Try it online!](https://tio.run/##K0gtyjH9/98hsdpAT8/GrtZWRcdWRd@6OLFSNfH/f0PTf/kFJZn5ecX/dX1N9QwMDQA "Perl 5 – Try It Online")
]


[Question]
      [
In Haskell the list notation:
```
[a,b,c]
```
Is just syntactic sugar for:
```
a:b:c:[]
```
And the string notation:
```
"abc"
```
Is just syntactic sugar for:
```
['a','b','c']
```
This means that the string:
```
"abc"
```
Is the same as:
```
'a':'b':'c':[]
```
# Task
Given a string you should output what the de-syntaxed version would look like in Haskell.
# Rules
* You will receive a string by any valid input method, you should output a string ending with `:[]` with every character from the input surrounded by `'` and separated by `:`. The empty string should output `[]`.
* You can assume that you will not receive any characters that require escaping (e.g. `'`, newlines, tabs ...) and that input will be in the printable ascii range
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") you should aim to minimize the byte count of your answer
## Test Cases
```
"" -> []
"a" -> 'a':[]
"Hello, World" -> 'H':'e':'l':'l':'o':',':' ':'W':'o':'r':'l':'d':[]
```

[Answer]
# [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) 23 40 bytes
```
f=s=>!s?"[]":"'"+[...s].join("':'")+"':[]"
```
```
f=s=>!s?"[]":"'"+[...s].join("':'")+"':[]"
console.log(f() + "\n") // `"[]"`
console.log(f("") + "\n") // `"[]"`
console.log(f("abc") + "\n") // "'a':'b':'c':[]"
```
Using spread element to convert string to array, `Array.prototype.join()` to concatenate `":"` characters
[Answer]
# Ruby, 43 bytes
```
->a{a==''?'[]':"'#{a.chars.join"':'"}':[]"}
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~14~~ 13 bytes
A port of [Downgoat's JS solution](https://codegolf.stackexchange.com/a/126421/58974).
```
ç"'$&':" +"[]
```
[Try it](http://ethproductions.github.io/japt/?v=1.4.5&code=5yInJCYnOiIgKyJbXQ==&input=ImFiYyI=)
[Answer]
# [R](https://www.r-project.org/), ~~75~~ 50 bytes
```
function(x)cat(gsub("(.)","'\\1':",x),"[]",sep="")
```
[Try it online!](https://tio.run/##K/qfk5lUlFhUqZGbWpKRn1KsyZWmYKP7P600L7kkMz9Po0IzObFEI724NElDSUNPU0lHST0mxlDdSkmnQlNHKTpWSac4tcBWSUnzf5qGurqmNUi1ekyeOtAcCI0q4pGak5OvoxCeX5SToqiu@R8A "R – Try It Online")
Or for a non-regex approach:
# [R](https://www.r-project.org/), 63 bytes
```
function(x)cat(sprintf("'%s':",el(strsplit(x,''))),'[]',sep='')
```
[Try it online!](https://tio.run/##VYxNCsIwEIX3nqIWZGYgXsCfvTdwoV3UNsHAmISZEdrTx4grN@/xPvieVI4PGWXFl7dnnpU2oTvta3inyWJOuNA0GmqRmCxgDzuFQ@88o5po4Wi4OAAicnAbwKkv5zZrwJbHrwr3BO301//k4pmz665ZeN426QM "R – Try It Online")
It turns out that `sprintf` will recycle the format string to match the length of its input, which is a nice golf from the previous answer (which you can see in the edit history).
[Answer]
# Excel, 68 bytes
```
=IFERROR(CONCAT("'"&MID(A1,ROW(OFFSET(A1,,,LEN(A1))),1)&"':"),)&"[]"
```
Takes input from A1, outputs to whatever cell this formula is placed in. It's an array formula, so Ctrl-Shift-Enter instead of Enter to enter it.
11 of the bytes here are just for handling the empty string correctly, since Excel doesn't have a concept of arrays with zero elements.
The answer's pretty straightforward, but I did learn a couple things: IFERROR's second argument is taken to be `""` when left blank, and `&` will operate in an array-aware manner if and only if the construction is inside a function that will take an array (replacing `CONCAT(...)` with just `(...)` feels like it should work but it doesn't).
[Answer]
# [MATL](https://github.com/lmendo/MATL), 16 bytes
```
g39*Gyt19+v'[]'h
```
[Try it online!](https://tio.run/##y00syfn/P93YUsu9ssTQUrtMPTpWPeP/f/XEpGR1AA "MATL – Try It Online")
A bit surprised not to see a MATL submission already.
### Explanation:
```
	% implicit input, 'abc'
g	% convert to logical
	% STACK: {[1 1 1]}
39*	% multiply by 39, ASCII for ', elementwise.
	% STACK: {[39 39 39]}
G	% push input
	% STACK: {[39 39 39]; 'abc'}
yt	% copy from below and dup
	% STACK: {[39 39 39]; 'abc'; [39 39 39]; [39 39 39]}
19+	% add 19, elementwise, to get 58, ASCII for :
	% STACK: {[39 39 39]; 'abc'; [39 39 39]; [58 58 58]}
v	% vertically concatenate stack contents, implicitly converting to strings.
	% STACK: {'''
	%	  abc
	%	  '''
	%	  :::}
'[]'h	% push '[]' and horizontally concatenate, linearizing as needed
	% STACK: 'a':'b':'c':[]
	% implicit output
```
[Answer]
# [Julia 1.0](http://julialang.org/), 26 bytes
```
!x=join("'".*x.*"':")*"[]"
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/X7HCNis/M09DSV1JT6tCT0tJ3UpJU0spOlbpf0FRZl5JTp6GYrSSkp6eXqwmF5JIIqaQR2pOTr6OQnh@UU6KIkT6PwA "Julia 1.0 – Try It Online")
input is a list of characters
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `o`, 12 bytes
```
ƛ\'p‛':+₴;k[
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=o&code=%C6%9B%5C%27p%E2%80%9B%27%3A%2B%E2%82%B4%3Bk%5B&inputs=Hello%2C%20world!&header=&footer=)
```
ƛ        ;   # Map...
 \'p         # Prepend a '
    ‛':+     # Append a ':
        ₴    # Output without newline
          k[ # Push `[]`
             # Which is implicitly output
```
[Answer]
# [SOGL](https://github.com/dzaima/SOGL), 12 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
,{ļ'pō':}ō[]
```
Explanation:
```
,{      }     iterate over the chars of string input
  ļ'          output "'"
    p         output the current char
     ō':      output "':"
         ō[]  output "[]"
```
In theory 10 byte `ļ'pō':}ō[]` could work, but, alas, it doesn't.
[Answer]
# [Aceto](https://github.com/aceto/aceto), 26 bytes
```
:Lpp&p
'p|L
\'!d["
'M@,]"p
```
[Answer]
## PowerShell, 43 bytes
It's a `join(map(repr, input))` shape problem? That's simply 177 bytes of:
```
[linq.enumerable]::Aggregate([Linq.Enumerable]::Select(
[Object[]][Char[]]"$args", [Func[Object,String]]{"'$args'"})+(,'[]'),
[func[object,object,object]]{param($a,$b) $a+':'+$b})
```
Edit: can golf that down to a mere 171:
```
$e='[Linq.Enumerable]::';$o='Object';
"${e}Aggregate(${e}Select([$o[]][Char[]]""$args"",[Func[$o,$O]]{""'`$args'""})+(,'[]'),[func[$o,$o,$o]]{`$args[0]+':'+`$args[1]})"|iex
```
Oh all right, 43 bytes of:
```
(([char[]]"$args"|%{"'$_'"})+,'[]')-join':'
```
[Answer]
## Swift, ~~49~~ bytes
```
{$0.characters.reduce("",{$0+"'\($1)':"})+"[]"}
```
This is a lambda (closure in Swift). Because converting a `Character` Array to a string is `a.joined(seperator:"")` I've used `.reduce("",+)` as a golf. Kind of unreadable so broken down:
```
{
  $0.characters.reduce("", {
    $0 + "'\($1)':"
  }) + "[]"
}
```
because a map + converting to a string is too long, `reduce` will convert to a string for us as we go
[Answer]
# [><>](https://esolangs.org/wiki/Fish), 27 bytes
```
i:0(?vd3*:o$oo':'o
o'[]'/;o
```
[Try it online!](https://tio.run/##S8sszvj/P9PKQMO@LMVYyypfJT9f3Uo9nytfPTpWXd86////4pKizLx0AA "><> – Try It Online")
[Answer]
# Mathematica, 34 bytes
```
"'"<>#<>"':"&/@Characters@#<>"[]"&
```
Anonymous function. Takes a string as input and returns a string as output. Just separates the input's characters, inserts `'...':` around each, and adds `[]` to the end.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 11 bytes
```
ＦＳ⁺⁺'ι':¦[]
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9nmXv92x@1LgLiNTP7VS3OrQsOvb//8TilLT/uokA "Charcoal – Try It Online") Explanation provided as AST.
[Answer]
# [Noether](https://github.com/beta-decay/noether), 37 bytes
```
{I~sL0>}{sL("'"Psi/P"':"Pi1+~i)}"[]"P
```
[**Try it here!**](https://beta-decay.github.io/noether?code=e0l-c0wwPn17c0woIiciUHNpL1AiJzoiUGkxK35pKX0iW10iUA&input=ImNhdHMi)
Takes input between quotation marks.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~43~~ 28 + 1 = ~~44~~ 29 bytes
*A whopping -15 bytes thanks to Value Ink.*
+1 byte for the `-p` flag.
```
$_=gsub(/(.)/,"'\\1':")+"[]"
```
[Try it online!](https://tio.run/##KypNqvz/XyXeNr24NElDX0NPU19HST0mxlDdSklTWyk6Vun/f4/UnJx8HYXw/KKclH/5BSWZ@XnF/3ULAA "Ruby – Try It Online")
[Answer]
## Rust, 69 bytes
```
|s:&str|s.chars().map(|s|format!("'{}':",s)).collect::<String>()+"[]"
```
Couldn't find anything shorter than the trivial solution.
[Answer]
# Java, 60 bytes
```
String f(String s){return s.replaceAll(".","['$0']:")+"[]";}
```
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 48 bytes
```
-[-[<++>->++>-<<]>]<<,[<-.>.<.+<.>>,]<<<<+++.++.
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fN1o32kZb207XDkTY2MTaxdrY6ETb6OrZ6dnoadvo2dnpAEVsgGq09YDo//9EAA "brainfuck – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 10 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
╩8┼Φv╚▀╛┴►
```
[Run and debug it](https://staxlang.xyz/#p=ca38c5e876c8dfbec110&i=abc&a=1)
[Answer]
# Excel VBA, 51 bytes
Anonymous VBE immedate function that takes input as string from cell `[A1]`,
 iterates across the input string, splitting it by character and then outputs to the VBE immediate window
```
For i=1To[Len(A1)]:?"'"Mid([A1],i,1)"':";:Next:?"[]
```
### Previous, Longer Versions
```
1:  a=Split(StrConv([A1],64),Chr(0)):For i=0To[Len(A1)-1]:?"'"a(i)"':";:Next:?"[]"
2:  ?"'"Mid(Join(Split(StrConv([A1],64),Chr(0)),"':'"),1,4*Len([A1])-1)"[]"
3:  ?"'"Left(Join(Split(StrConv([A1],64),Chr(0)),"':'"),4*Len([A1])-1)"[]"
4:  ?"'"Replace(Left(Strconv([A1],64),2*Len([A1])-1),Chr(0),"':'")":[]"
5:  ?Replace(Left("'"&StrConv([A1],64),2*Len([A1])),Chr(0),"':'")"':[]"
6:  ?"'"Left(Replace(StrConv([A1],64),Chr(0),"':'"),4*Len([A1])-1)"[]"
7:  ?"'"Replace(Replace(StrConv([A1],64),Chr(0),"':'")&" ","' ","[]")
8:  For i=1To Len([A1]):?"'"&Mid([A1],i,1);"':";:Next:?"[]"
9:  For i=1To[Len(A1)]:?"'"&Mid([A1],i,1);"':";:Next:?"[]"
10: For i=1To[Len(A1)]:?"'"Mid([A1],i,1)"':";:Next:?"[]"
```
[Answer]
# [Kotlin](https://kotlinlang.org), 34 bytes
```
{it.fold(""){a,v->a+"'$v':"}+"[]"}
```
[Try it online!](https://tio.run/##LY2xCsIwFEX3fsXzITShrR8QsF0d3BwcxOFB0hKMiaRplpJvj9H2Thfu4dyXC0bbHMmAVPMykRfAbsFrO3HoetgqnPOqw2l0RjJEvlIbu54arI@xFpgafDwx5XGx8CZtGYe1gpKfdd4F4BXJq7aqrIMAxD/xKWNg@zPbWM6rlC/KGNfC3XkjD18 "Kotlin – Try It Online")
[Answer]
# [Ahead](https://github.com/ajc2/ahead), 25 bytes
```
v>"]["W@
>jri''r
^W"':"W<
```
[Try it online!](https://tio.run/##S8xITUz5/7/MTik2WincgcsuqyhTXb2IKy5cSd1KKdzm///EpOQUAA "Ahead – Try It Online")
[Answer]
## Burlesque - 21 bytes
```
m{bx"'~':"jf~}"[]"_+Q
```
Longer versions:
```
XX{bx"'~':"jf~}\m"[]"_+Q
```
Burlesque shows characters with a single `'` i.e. `'x` instead of `'x'` which is why we have to surround characters manually with two `'`s.
[Answer]
# Rust macro, 185 bytes
```
macro_rules!f{([])=>{['[',']']};([$c:expr]$($o:tt)*)=>{[$($o,)*'\'',$c,'\'',':','[',']']};([$c:expr$(,$r:tt)*]$($o:tt)*)=>{f!([$($r),*]$($o)*'\''$c'\''':')};($($r:tt)*)=>{f!([$($r)*])}}
```
Defines a macro that takes a comma-seperated sequence of character tokens and expands to an array of characters.
[try it online](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=macro_rules!%20f%20%7B%0A%20%20%20%20%2F%2F%20the%20macro%20is%20a%20tt%20muncher%20where%20the%20inputs%20are%20in%20brackets%20with%20the%0A%20%20%20%20%2F%2F%20accumulator%20after%20that.%0A%0A%20%20%20%20%2F%2F%20the%20base%20case%20for%20an%20empty%20array%0A%20%20%20%20(%5B%5D)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%2F%2F%20expand%20to%20the%20brackets%0A%20%20%20%20%20%20%20%20%5B%27%5B%27%2C%20%27%5D%27%5D%0A%20%20%20%20%7D%3B%0A%20%20%20%20%2F%2F%20the%20base%20case%20for%20a%20single%20element%0A%20%20%20%20(%5B%24c%3Aexpr%5D%20%24(%24o%3Att)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%5B%24(%24o%2C)*%20%27%5C%27%27%2C%20%24c%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5B%27%2C%20%27%5D%27%5D%0A%20%20%20%20%7D%3B%0A%20%20%20%20%2F%2F%20the%20recursive%20case%0A%20%20%20%20%2F%2F%20extract%20a%20characters%20from%20the%20input%20token%20stream%0A%20%20%20%20(%5B%24c%3Aexpr%20%24(%2C%24r%3Att)*%5D%20%24(%24o%3Att)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20f!(%5B%24(%24r)%2C*%5D%20%24(%24o)*%20%27%5C%27%27%20%24c%20%27%5C%27%27%20%27%3A%27)%0A%20%20%20%20%7D%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20entry%20point%0A%20%20%20%20(%24(%24r%3Att)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%2F%2F%20call%20the%20recursive%20part%20by%20wrapping%20the%20arguments%20in%20brackets%0A%20%20%20%20%20%20%20%20f!(%5B%24(%24r)*%5D)%0A%20%20%20%20%7D%0A%7D%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(%5B%27%5B%27%2C%20%27%5D%27%5D%2C%20f!())%3B%0A%20%20%20%20assert_eq!(%5B%27%5C%27%27%2C%20%27a%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5B%27%2C%20%27%5D%27%5D%2C%20f!(%27a%27))%3B%0A%20%20%20%20assert_eq!(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%27%5C%27%27%2C%20%27H%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27e%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27l%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%27%5C%27%27%2C%20%27l%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27o%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27%2C%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%27%5C%27%27%2C%20%27%20%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27W%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27o%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%27%5C%27%27%2C%20%27r%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27l%27%2C%20%27%5C%27%27%2C%20%27%3A%27%2C%20%27%5C%27%27%2C%20%27d%27%2C%20%27%5C%27%27%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%27%3A%27%2C%20%27%5B%27%2C%20%27%5D%27%0A%20%20%20%20%20%20%20%20%5D%5B..%5D%2C%0A%20%20%20%20%20%20%20%20f!(%27H%27%2C%20%27e%27%2C%20%27l%27%2C%20%27l%27%2C%20%27o%27%2C%20%27%2C%27%2C%20%27%20%27%2C%20%27W%27%2C%20%27o%27%2C%20%27r%27%2C%20%27l%27%2C%20%27d%27)%5B..%5D%0A%20%20%20%20)%3B%0A%7D)
## Explanation
```
macro_rules! f {
    // the macro is a tt muncher where the inputs are in brackets with the
    // accumulator after that.
    // the base case for an empty array
    ([]) => {
        // expand to the brackets
        ['[', ']']
    };
    // the base case for a single element
    ([$c:expr] $($o:tt)*) => {
        [$($o,)* '\'', $c, '\'', ':', '[', ']']
    };
    // the recursive case
    // extract a characters from the input token stream
    ([$c:expr $(,$r:tt)*] $($o:tt)*) => {
        f!([$($r),*] $($o)* '\'' $c '\'' ':')
    };
    // entry point
    ($($r:tt)*) => {
        // call the recursive part by wrapping the arguments in brackets
        f!([$($r)*])
    }
}
```
[Answer]
# [naz](https://github.com/sporeball/naz), 82 bytes
```
2a2x1v2m9m3a2x2v9a9a1a2x3v1x1f1r3x1v2e2x4v2v1o4v1o2v1o3v1o1f0x1x2f9m5m1a1o2a1o0x1f
```
Works for any input string terminated with the control character STX (U+0002).
**Explanation** (with `0x` commands removed)
```
2a2x1v                             # Set variable 1 equal to 2
2m9m3a2x2v                         # Set variable 2 equal to 39 ("'")
9a9a1a2x3v                         # Set variable 3 equal to 58 (":")
1x1f                               # Function 1
    1r                             # Read a byte of input
      3x1v2e                       # Jump to function 2 if it equals variable 1
            2x4v                   # Otherwise, store the byte in variable 4
                2v1o4v1o2v1o3v1o   # Output it, using variables 2 and 3 to format it as required
                                1f # Jump back to the start of function 1
1x2f                               # Function 2
    9m5m1a1o2a1o                   # Output "[]"
1f                                 # Call function 1
```
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), 16 bytes
```
÷⑷\&⑨ⁿ:"\:⅍⅀⑸`[]
```
[Try it online!](https://tio.run/##ATAAz/9rZWf//8O34pG3XCbikajigb86Ilw64oWN4oWA4pG4YFtd//9IZWxsbywgV29ybGQ "Keg – Try It Online")
This is what you call "the result of me not implementing things properly".
[Answer]
# [Erlang (escript)](http://erlang.org/doc/man/escript.html), 52 bytes
Pretty simple solution.
```
f(X)->lists:join(":",[["'"|[I|"'"]]||I<-X]++["[]"]).
```
[Try it online!](https://tio.run/##DcoxDsMgDEDRPaegXgpK6AFQlbk5QSNZHqIWKlduqAApC3cn/OUvzyfZ9o/1@ZX4X9rQgl6NnYVzye4bedfgYEKEK1Rcah9RrcvdrjSOCEhA5tZ@W4dIRtl5UD2OLhyJi9dBw8OLxEk9Y5L3BUznJw "Erlang (escript) – Try It Online")
[Answer]
# [Forth (gforth)](http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/), 47 bytes
```
: f bounds ?do ." '"i 1 type ." ':"loop ." []";
```
[Try it online!](https://tio.run/##NY0xDsIwDEX3nuLLCwtBKt1aCVZu0AExpE0ClQK2knTg9CGhMH2/72fZcUgPdXc1cu7hMPH6MhFnwzgQdrSgRXqL/VJPnlnqeL3RUHzB0axSNNjnkjbxD3XRdlDQU0QUPdtYL6FOoPJoDhiaJlIBqaF/ebHe8x4jB29KlT8 "Forth (gforth) – Try It Online")
### Code Explanation
```
: f          \ start a new word definition
  bounds     \ get the starting and ending addresses of the string
  ?do        \ loop from start to end (skip if start=end)
    ." '"    \ output '
    i 1 type \ print the character at the current address
    ." ':"   \ output ':
  loop       \ end loop
  ." []"     \ output []
;            \ end word definition
```
]


[Question]
      [
## Challenge
You need to generate a program or function that takes in a positive integer N, calculates the first N terms of the Fibonacci sequence in binary, concatenates it into a single binary number, converts that number back to decimal, and then outputs the decimal as an integer.
For example
```
1 -> [0] -> 0 to decimal outputs 0
3 -> [0, 1, 1] -> 011 to decimal outputs 3
4 -> [0, 1, 1, 10] -> 01110 to decimal outputs 14
```
You do not need to output the `->`, just the number (e.g. if the user types `4`, just output `14`). The arrows are just to help explain what the program must do.
## Test cases
```
1 -> 0
2 -> 1
3 -> 3
4 -> 14
5 -> 59
6 -> 477
7 -> 7640
8 -> 122253
9 -> 3912117
10 -> 250375522
11 -> 16024033463
12 -> 2051076283353
13 -> 525075528538512
14 -> 134419335305859305
15 -> 68822699676599964537
16 -> 70474444468838363686498
17 -> 72165831136090484414974939
18 -> 147795622166713312081868676669
19 -> 605370868394857726287334099638808
20 -> 4959198153890674493745840944241119317
```
The program must be able to output up to the limit of the language in use. No lookup tables or [common workarounds](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) allowed.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the answer with the shortest number of bytes wins!

[Answer]
# [Python](https://docs.python.org/), 64 bytes
```
f=lambda n,a=0,b=1,r=0:n and f(n-1,b,a+b,r<<len(bin(a))-2|a)or r
```
[Try it online!](https://tio.run/##DcxBDoMgEAXQdXuK2QnpkAjdEeldhigtif2aiRtjPTt185Zv3bfPgmdrJc3yzaMQWFLPOXnW1EeQYKRi4DxnlkdmHYZ5gskVRqx14Sd2UdJWLkEVpIL3ZDxT8Dbeb6tWbKZ0B2I4yb3ouDZ7drb9AQ "Python 3 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~7~~ 6 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ḶÆḞBẎḄ
```
**[Try it online!](https://tio.run/##ARoA5f9qZWxsef//4bi2w4bhuJ5C4bqO4biE////NA "Jelly – Try It Online")**
### How?
```
ḶÆḞBẎḄ - Link: integer, n
Ḷ      - lowered range -> [0,1,2,3,4,5,...,n]
 ÆḞ    - Fibonacci (vectorises) -> [0,1,1,2,3,5...,F(n)]
   B   - to binary (vectorises) -> [[0],[1],[1],[1,0],[1,1],[1,0,1],...,B(F(n))]
    Ẏ  - tighten -> [0,1,1,1,0,1,1,1,0,1,...,B(F(n))[0],B(F(n))[1],...]
     Ḅ - from binary -> answer
```
[Answer]
# [Python 3.6](https://docs.python.org/3/), 61 bytes
```
f=lambda n,a=0,b=1:n and int(f'{a:b}{f(n-1,b,a+b)*2:b}',2)//2
```
[Try it online!](https://tio.run/##LYxBCsIwEADP@oq9JatbatZbIP5llxoVdFtCL6Xk7WkLXoeZmZb5Pdq9tZy@8tNBwEjSjTSFaCA2wMdmn90qUeuavXWBlOSqeOGdOGLse255LGC7CkXs9fSBgAPG82kq/9wiV@gecCywOmwb "Python 3 – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 7 bytes
```
ḋṁḋ↑Θİf
```
[Try it online!](https://tio.run/##yygtzv7//@GO7oc7G4Hko7aJ52Yc2ZD2//9/IwMA "Husk – Try It Online")
### Explanation
```
ḋṁḋ↑Θİf                              4
     İf    The Fibonacci numbers     [1,1,2,3,5,8..]
    Θ      Prepends 0                [0,1,1,2,3,5..]
   ↑     Take n elements from list   [0,1,1,2]
  ḋ        Convert to binary digits  [[0],[1],[1],[1,0]]
 ṁ       Map function then concat    [0,1,1,1,0]
ḋ        Convert from base 2         14
```
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 397 bytes
```
>,[<++++++[->--------<]>>[->++++++++++<]>[-<+>]<<[->+<],]>+[-<<+>>[-[->+<]<<[->+>+<<]<[->+>+<<]>[-<+>]>>[-<<+>>]>]]<<[->+>>>>>+<<<<<<]>[-<+>]>+>>+>>>+<[[->-[<<]>]>[[-]<<<<<<<[->>[-<+>>+<]>[-<+>]<<<]<[->+>>>>>+<<<<<<]>[-<+>]>[-<+>]>[->>[-<+<<+>>>]<[->+<]<]>+>[-]>>+>]<<<<<[[->++>+>++<<<]>[-<+>]<<]>>>]>[-]<<<[-]<<[-]<<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>>>]<+[->++++++[-<++++++++>]<.<<<+]
```
Well, that was fun!
Takes ASCII input (e.g. `11`), outputs result in ASCII.
Note: to try this online, make sure you set the cell size to 32 bits (on the right side of the webpage). **If you do not enter an input, your browser might crash.**
The interpreter cannot handle input of `11` and higher because it only supports up to 32 bits.
[Try it on copy.sh](https://copy.sh/brainfuck/?c=PixbPCsrKysrK1stPi0tLS0tLS0tPF0-PlstPisrKysrKysrKys8XT5bLTwrPl08PFstPis8XSxdPitbLTw8Kz4-Wy1bLT4rPF08PFstPis-Kzw8XTxbLT4rPis8PF0-Wy08Kz5dPj5bLTw8Kz4-XT5dXTw8Wy0-Kz4-Pj4-Kzw8PDw8PF0-Wy08Kz5dPis-Pis-Pj4rPFtbLT4tWzw8XT5dPltbLV08PDw8PDw8Wy0-PlstPCs-Pis8XT5bLTwrPl08PDxdPFstPis-Pj4-Pis8PDw8PDxdPlstPCs-XT5bLTwrPl0-Wy0-PlstPCs8PCs-Pj5dPFstPis8XTxdPis-Wy1dPj4rPl08PDw8PFtbLT4rKz4rPisrPDw8XT5bLTwrPl08PF0-Pj5dPlstXTw8PFstXTw8Wy1dPDwtPls-KysrKysrKysrKzxbLT4tWz4rPj5dPlsrWy08Kz5dPis-Pl08PDw8PF0-Pj5dPCtbLT4rKysrKytbLTwrKysrKysrKz5dPC48PDwrXQ$$)
## Explanation
```
>,[<++++++[->--------<]>>[->++++++++++<]>[-<+>]<<[->+<],]>+
```
Get decimal input and add one (to mitigate off-by-one)
```
[-<<+>>[-[->+<]<<[->+>+<<]<[->+>+<<]>[-<+>]>>[-<<+>>]>]]
```
Generate fibonacci numbers on the tape.
```
<<[->+>>>>>+<<<<<<]>[-<+>]>+>>+>>>+<
```
Set up for the incoming binary concatenation loop
---
So the cells contain the value, starting from the first position,
```
1 | 0 | 1 | 1 | 2 | 3 | 5 | ... | f_n | 0 | 1 | 0 | 1 | 0 | f_n | 1 | 0 | 0 | 0...
```
Look at these cells:
```
f_n | 0 | 1 | 0 | 1 | 0 | f_n | 1
```
I'll label this:
```
num | sum | cat | 0 | pow | 0 | num | pow
```
`pow` is there to find the maximal power of 2 that is strictly greater than `num`. `sum` is the concatenation of numbers so far. `cat` is the power of 2 that I would need to multiply the `num` in order to concatenate `num` in front of the `sum` (so I would be able to simply add).
---
```
[[->-[<<]>]>
```
**Loop: Check whether `f_n` is strictly less than `pow`.**
**Truthy:**
```
[[-]<<<<<<<[->>[-<+>>+<]>[-<+>]<<<]<[->+>>>>>+<<<<<<]>[-<+>]>[-<+>]>[->>[-<+<<+>>>]<[->+<]<]>+>[-]>>+>]
```
Zero out junk. Then, add `num` \* `cat` to `sum`. Next, load the next Fibonacci number (= `f_(n-1)`; if it doesn't exist, exit loop) and set `cat` to `cat` \* `pow`. Prepare for next loop (zero out more junk, shift scope by one).
**Falsey:**
```
<<<<<[[->++>+>++<<<]>[-<+>]<<]
```
Set `pow` to 2 \* `pow`, restore `num`.
```
]
```
Repeat until there is no Fibonacci number left.
---
```
>[-]<<<[-]<<[-]<<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>>>]<+[->++++++[-<++++++++>]<.<<<+]
```
Clean garbage. Take each digit of the resulting number and output each (in ascii).
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 9 bytes
```
ÆMgX ¤Ã¬Í
```
[Run it](https://ethproductions.github.io/japt/?v=1.4.5&code=xk1nWCCkw6zN&input=NA==)
## Explanation:
```
ÆMgX ¤Ã¬Í
Æ     Ã     | Iterate X through the range [0...Input]
 MgX        |   Xth Fibonacci number
     ¤      |   Binary
       ¬    | Join into a string
        Í   | Convert into a base-2 number
```
[Answer]
# Pyth, 22 bytes
```
JU2VQ=+Js>2J)is.BM<JQ2
```
[Try it here](http://pyth.herokuapp.com/?code=JU2VQ%3D%2BJs%3E2J%29is.BM%3CJQ2&input=32&debug=0)
### Explanation
```
JU2VQ=+Js>2J)is.BM<JQ2
JU2                       Set J = [0, 1].
   VQ       )             <Input> times...
     =+Js>2J              ... add the last 2 elements of J and put that in J.
                  <JQ     Take the first <input> elements...
               .BM        ... convert each to binary...
              s           ... concatenate them...
             i       2    ... and convert back to decimal.
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 38 bytes
```
{:2([~] (0,1,*+*...*)[^$_]>>.base(2))}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/2spII7ouVkHDQMdQR0tbS09PT0szOk4lPtbOTi8psThVw0hTs/Z/cWKlQpqGSrymQlp@kYKhnp6hgfV/AA "Perl 6 – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 70 65 58 57 55 bytes
* thanks to Shaggy for reducing 2 bytes ('0b+C-0 to '0b'+C)
```
f=(n,a=C=0,b=1)=>--n?f(n,b,a+b,C+=b.toString(2)):'0b'+C
```
[Try it online!](https://tio.run/##ZZBLbsMwDET3vUgs2A5EUtSngNKFj9ATWGkcpAjkIjF6fYfqrtJGBB6pGXK@59/5eX7cfrYxr1@XfV9il4c5TlEPKYKKp3HMH4uwNMx9GqY@puO2fm6PW752qNT7QadDP@3nNT/X@@V4X6/d0snHqNXbf4gCoYYkkGpoyqSpKQvlUFMr1DhXYyfYWdMs4Ys0InJjGsomARCgEQMtPWRNjhmx6ZZrwWo0msjYRhjK4agZtLPoiVprKCmwGBR9z@QZWpe/UMgYCEVCs@cgbzNWUrLeI9oQrLMcpBgmp/YX "JavaScript (Node.js) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
LÅfbJC
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f53BrWpKX8///xgA "05AB1E – Try It Online")
---
1-indexed.
[Answer]
# J, 36 Bytes
```
3 :'#.;<@#:"0]2}.(,{:+_2&{)^:y _1 1'
```
### Explanation:
```
3 :'#.;<@#:"0]2}.(,{:+_2&{)^:y _1 1' | Explicit function
                 (,{:+_2&{)^:y _1 1  | Make n fibonacci numbers, with _1 1 leading
              2}.                    | Drop the _1 1
       <@#:"0]                       | Convert each item to binary and box
      ;                              | Unbox and join
    #.                               | Convert back from binary
```
[Answer]
# x86, ~~37~~ ~~22~~ 21 bytes
**Changelog**
* -13 by using [`bsr`](http://www.felixcloutier.com/x86/BSR.html). Thanks Peter Cordes!
* -2 by [zeroing registers with `mul`](https://codegolf.stackexchange.com/a/147775/17360).
* -1 by using a while loop instead of `loop` and `push`/`pop` `ecx` (credit Peter Cordes).
Input in `edi`, output in `edx`.
```
.section .text
.globl main
main:
        mov     $5, %edi            # n = 5
start:
        dec     %edi                # Adjust loop count
        xor     %ebx, %ebx          # b = 0
        mul     %ebx                # a = result = 0
        inc     %ebx                # b = 1
fib:
        add     %ebx, %eax          # a += b
        xchg    %eax, %ebx          # swap a,b
        bsr     %eax, %ecx          # c = (bits of a) - 1
        inc     %ecx                # c += 1
        sal     %cl, %edx           # result >>= c
        add     %eax, %edx          # result += a
        dec     %edi                # n--; do while(n)
        jnz     fib
        ret
```
Objdump:
```
00000005 <start>:
   5:   4f                      dec    %edi
   6:   31 db                   xor    %ebx,%ebx
   8:   f7 e3                   mul    %ebx
   a:   43                      inc    %ebx
0000000b <fib>:
   b:   01 d8                   add    %ebx,%eax
   d:   93                      xchg   %eax,%ebx
   e:   0f bd c8                bsr    %eax,%ecx
  11:   41                      inc    %ecx
  12:   d3 e2                   shl    %cl,%edx
  14:   01 c2                   add    %eax,%edx
  16:   4f                      dec    %edi
  17:   75 f2                   jne    b <fib>
  19:   c3                      ret
```
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), ~~26~~ 22 bytes
*4 bytes saved thanks to @H.PWiz*
```
{2⊥∊2∘⊥⍣¯1¨1∧+∘÷\~⍵↑1}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24Rqo0ddSx91dBk96pgBYvUuPrTe8NAKw0cdy7WBQoe3x9Q96t36qG2iYS1Qg8KhFY96NxsaAAA "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 89 76 75 bytes
```
f=0:scanl(+)1f
foldr1(\x y->y+x*2*2^floor(logBase 2.read.show$y)).(`take`f)
```
Ungolfed version:
```
import Data.Bits
fib = 0:scanl (+) 1 fib
catInt :: Integer -> Integer -> Integer
catInt x y = x' + y where
    position = floor $ succ $ logBase 2 $ realToFrac y
    x' = shift x position
answer :: Integer -> Integer
answer n = foldr1 catInt fib' where
    fib' = take n fib
```
[Answer]
# Pyth, 27 bytes
```
JU2V-Q2=aJ+eJ@J_2)is.BM<JQ2
```
[**Test suite**](https://pyth.herokuapp.com/?code=JU2V-Q2%3DaJ%2BeJ%40J_2%29is.BM%3CJQ2&test_suite=1&test_suite_input=1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A9%0A10%0A11%0A12%0A13%0A14%0A15%0A16%0A17%0A18%0A19%0A20&debug=0)
Python 3 translation:
```
Q=eval(input())
J=list(range(2))
for i in range(Q-2):
    J.append(J[-1]+J[-2])
print(int(''.join(map("{0:b}".format,J[:Q])),2))
```
---
## ~~37 bytes~~
```
J[Z1)W<lJQ=aJ+eJ@J_2)Ig1QZ.?ijkm.BdJ2
```
**[Test suite](https://pyth.herokuapp.com/?code=J%5BZ1%29W%3ClJQ%3DaJ%2BeJ%40J_2%29Ig1QZ.%3Fijkm.BdJ2&test_suite=1&test_suite_input=1%0A3%0A4%0A10%0A32&debug=0)**
Python 3 translation:
```
Q=eval(input())
J=[0,1]
while len(J)<Q:
    J.append(J[-1]+J[-2])
if 1>=Q:
    print(0)
else:
    print(int(''.join(map("{0:b}".format,J)),2))
```
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 59 bytes
```
n->fromdigits(concat([binary(fibonacci(i))|i<-[0..n-1]]),2)
```
[Try it online!](https://tio.run/##DcwxDoMwDEDRq1hMthSjUlWdWi6CGEIqIw84kZsFibuHLH94wy/RlffSBL7QjGfxfPx01/rHlC3FisumFv1E0S1bTElRiS798PIYR@NpXSk8qUl2tD6ZArxfAYqr1Q4D8NwjaETUbg "Pari/GP – Try It Online")
[Answer]
# APL+WIN, 55 bytes
Prompts for screen input of integer.
```
v←b←0 1⋄⍎∊(⎕-2)⍴⊂'v←v,c←+/¯2↑v⋄b←b,((1+⌊2⍟c)⍴2)⊤c⋄'⋄2⊥b
```
APL+WIN's maximum integer precision is 17 and integer limit is of the order of 10E300 therefore the maximum input number is 55 and the result is: 1.2492739026634838E300
[Answer]
# [Python 3](https://docs.python.org/3/), 94 bytes
```
f=lambda n,a=[0,1]:n>len(a)and f(n,a+[sum(a[-2:])])or int(''.join(bin(v)[2:]for v in a[:n]),2)
```
**[Try it online!](https://tio.run/##FcpLDoMwDEXRrWSGraYVn44iwUasDIwgKggcBBSpq3fN4E3uedvv/GRpVFO78NoP7MRzS6WvYpBuGQUYWQaXwPqDju8KTM86RIyYdzfJCUXxmvMk0NsuJLNkcpk5piARfY267fc1wRtR9Q8 "Python 3 – Try It Online")**
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
ḶÆḞBFḄ
```
[Try it online!](https://tio.run/##y0rNyan8///hjm2H2x7umOfk9nBHy////00A "Jelly – Try It Online")
`Ḷ`owered range -> *n*th `ÆḞ`ibonacci number -> from dec to `B`inary -> `F`latten -> from `Ḅ`inary to dec
[Answer]
# [MATL](https://github.com/lmendo/MATL), 21 bytes
```
0li:"yy+]xx&h"@B]&hXB
```
[Try it online!](https://tio.run/##y00syfn/3yAn00qpslI7tqJCLUPJwSlWLSPC6f9/QwMA "MATL – Try It Online")
### Explanation
```
0l        % Push 0, then 1 (initial terms of the Fibonacci sequence)
i:"       % Do n times, where n is the input
  yy+     %   Duplicate top two numbers and push their sum
  ]       % End
xx        % Delete the last two results. The stack now contains the
          % first n Fibonacci numbers, starting at 0
&h        % Concatenate all numbers into a row vector
"         % For each
  @       %   Push current number
  B       %   Convert to binary. Gives a vector of 0 and 1
]         % End
&h        % Concatenate all vectors into a row vector
XB        % Convert from binary to decimal. Implicitly display
```
[Answer]
# [Jotlin](https://github.com/jrtapsell/jotlin), 59 bytes
```
g(l(0,1)){l(a.sum(),a[0])}.take(this).j(""){a[0].s(2)}.i(2)
```
## Test Program
```
data class Test(val input: Int, val output: Long)
val tests = listOf(
    Test(1, 0),
    Test(2, 1),
    Test(3, 3),
    Test(4, 14),
    Test(5, 59),
    Test(6, 477),
    Test(7, 7640),
    Test(8, 122253),
    Test(9, 3912117),
    Test(10, 250375522)
)
fun Int.r() = g(l(0,1)){l(a.sum(),a[0])}.take(this).j(""){a[0].s(2)}.i(2)
fun main(args: Array<String>) {
    for (r in tests) {
        println("${r.input.r()} vs ${r.output}")
    }
}
```
It supports up to 10, changing `.i(2)` for `.toLong(2)` would support up to 14 if needed
[Answer]
# [J](http://jsoftware.com/), 25 bytes
```
2(#.;)<@#:@(1#.<:!|.)\@i.
```
[Try it online!](https://tio.run/##FcqhDoAgFAXQzldcIcDb2BsSn@j4EJuTicVgMei3o4bTzt7KiVEQ8GnRGR4oZSPZ9YaTdDfTnCs3Upphy18tPB5BOZVal@2A81x0IEyCyojhai8 "J – Try It Online")
## Explanation
```
2(#.;)<@#:@(1#.<:!|.)\@i.  Input: n
                       i.  Range [0, n)
                     \@    For each prefix
                  |.         Reverse
                 !           Binomial coefficient (vectorized)
               <:            Decrement
            1#.              Sum
        #:                   Convert to binary
      <                      Box
    ;                        Link. Join the contents in each box
2 #.                         Convert to decimal from base 2
```
[Answer]
# [Python 3](https://docs.python.org/3/), 86 bytes
```
def f(N):
 a,b,l=0,1,''
 for _ in range(N):l+=format(a,'b');a,b=b,a+b
 return int(l,2)
```
[Try it online!](https://tio.run/##Rc0xDgIhEIXhfk8xDRkmOyaCnQaP4BUMBFATnN0QLDw9QmX78v15@7c9Nzn1HlOGrG90XsBz4OKObBhxgbxVuMNLoHp5pCnK6sb49k17xoB0GYEL7NewQE3tU2Xwpgtb6rOWf23Ymnmx1ylQ2QiHK6iIoLRw1kJE/Qc)
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 113 bytes
```
D,f,@@@@*,V$2D+G1+dAppp=0$Qp{f}p
D,k,@,¿1=,1,bM¿
D,g,@,¿1_,1_001${f},1¿{k}
D,w,@,BBbR
D,l,@,ßR€gp€w@0b]@¦+VcG2$Bb
```
[Try it online!](https://tio.run/##JY5BaoQwFIbXySlEAoUawThdtVhSKwilXVSKdDPIaFQyYzWgM0NH3PQisyh01TsIzk16kKbPThbh53v/93grIZTSOqAF5fAuaUzcwAqZJe6UUp5DnlVfDAoHdEM5nUbmUUbTp2kEUp5JQlniOIxAj7Jp7DcDzPYw8/00glhBPB2jn4/vUsG350665NOXFWehS/xU3xgvedvJusRQ3tb5bjUbGJkXpuDr3UzXjazhPoCwoD93Boy4SB8XJMFo4d6fjq@g2LeGCTzm4cPsHeg1OK4TGSLe/ssVRv4yJH6G0fTZz3uHWuur30Z1sqlbbdvyTVUykx3EVuWZLN69wx8 "Add++ – Try It Online")
[Answer]
## PHP, 124 Bytes
[Try it online!](https://tio.run/##LczLCsIwEIXhV8lioDO0WCu6itF3SZrQgExiL7gIffY4Sjdn8cP58pTr/Zllw8ZujYlVQOAOojl3YE3TUFHxlx4QqYA9mdE7GxnntPGIOX0Ql/e84o3agfqLPKk/ApE@sHYQjPTuX4sv3k1JCSEQ/uteA15J1y8)
So I was looking for a way to output fibonacci numbers using the series, until I found [this](https://en.wikipedia.org/wiki/Fibonacci_number#Computation_by_rounding). It turns out you can calculate the fibonacci series via rounding, so I tried the challenge with a recursive function.
I found the approach of "rounding" really interesting, also a professor showed me this a while ago.
**Code**
```
function f($n,$i=0,$b=''){ if($n>$i){$b.=
decbin(round(pow((sqrt(5)+1)/2,$i)/sqrt(5)));f($n,$i+1,$b);}else{echo bindec($b);}}
```
**Explanation**
```
function f($n,$i=0,$b=''){           #the function starts with $i=0, our nth-fib number
if($n>$i){                           #it stops once $n (the input) = the nth-fib
    $b.=decbin(                      #decbin returns an integer as bin, concatenates
        round(pow((sqrt(5)+1)/2,$i)/sqrt(5))
                                       #the formula, basically roundign the expression
        );                           #it returns the (in this case) $i-th fib-number
    f($n,$i+1,$b);                   #function is called again for the next index
}else{                               #and the current string for fibonacci
    echo bindec($b);                 #"echo" the result, bindec returns the base 10
                                     #value of a base 2 number
}
}
```
Also check [this stackoverflow post](https://stackoverflow.com/questions/15600041/php-fibonacci-sequence) the best answer refers to the same article on Wikipedia.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 9 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
ü1∞╓♪εw≤+
```
[Run and debug it at staxlang.xyz!](https://staxlang.xyz/#p=8131ecd60dee77f32b&i=1%0A%0A2%0A%0A3%0A%0A4%0A%0A5%0A%0A6%0A%0A7%0A%0A8%0A%0A9%0A%0A10%0A%0A11%0A%0A12%0A%0A13%0A%0A14%0A%0A15%0A%0A16%0A%0A17%0A%0A18%0A%0A19%0A%0A20%0A&a=1&m=1)
## Unpacked (10 bytes) and explanation:
```
vr{|5|Bm|B
v             Decrement integer from input. Stax's Fibonacci sequence starts with 1 :(
 r            Integer range [0..n).
  {    m      Map a block over each value in an array.
   |5           Push nth Fibonacci number.
     |B         Convert to binary.
        |B    Implicit concatenate. Convert from binary. Implicit print.
```
[Answer]
# [Julia 0.6](http://julialang.org/), 65 bytes
```
f(n)=n<2?n:f(n-1)+f(n-2)
n->parse(BigInt,prod(bin.(f.(0:n-1))),2)
```
[Try it online!](https://tio.run/##FcqxCoMwFEbhuXmKIg73UhXN0CE0Frr1HbooJuEW@Q1p@vxRp3OG7/tfZbqXYGcXBMUT2OKhnzDHtgPfzmhWaMc4pZ@jl4Q3chPTttAs6Mh31JuTMjeai8Oi/JauYgeje3WJSZBXUFXLJ9cUSJgrVgcrOw "Julia 0.6 – Try It Online")
[Answer]
# [Factor](https://factorcode.org/) + `project-euler.025`, 37 bytes
```
[ iota [ fib >bin ] map-concat bin> ]
```
[Try it online!](https://tio.run/##Rcw9DsIwDEDhvafwAWhUKrGA1BWxsCCmKINruRB@kuC4Epw@BBhYnz69CUmjlONht9@u4Y56hsyPmQNxhiTxwqQtzzcW0/WrLzAJJbP8neGnCn44q76S@KA/KBhOdbNpmr4Du1yMrljwUREsTH6EYfQBXLWppRgIFWoYwJVaICvS1ZQ3 "Factor – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 44 bits1, 5.5 [bytes](https://github.com/Vyxal/Vyncode/blob/main/README.md)
```
ʁ∆FbfB
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=1#WyJ+PSIsIiIsIsqB4oiGRmJmQiIsIiIsIjEgLT4gMFxuMiAtPiAxXG4zIC0+IDNcbjQgLT4gMTRcbjUgLT4gNTlcbjYgLT4gNDc3XG43IC0+IDc2NDBcbjggLT4gMTIyMjUzXG45IC0+IDM5MTIxMTdcbjEwIC0+IDI1MDM3NTUyMlxuMTEgLT4gMTYwMjQwMzM0NjNcbjEyIC0+IDIwNTEwNzYyODMzNTNcbjEzIC0+IDUyNTA3NTUyODUzODUxMlxuMTQgLT4gMTM0NDE5MzM1MzA1ODU5MzA1XG4xNSAtPiA2ODgyMjY5OTY3NjU5OTk2NDUzN1xuMTYgLT4gNzA0NzQ0NDQ0Njg4MzgzNjM2ODY0OThcbjE3IC0+IDcyMTY1ODMxMTM2MDkwNDg0NDE0OTc0OTM5XG4xOCAtPiAxNDc3OTU2MjIxNjY3MTMzMTIwODE4Njg2NzY2NjlcbjE5IC0+IDYwNTM3MDg2ODM5NDg1NzcyNjI4NzMzNDA5OTYzODgwOFxuMjAgLT4gNDk1OTE5ODE1Mzg5MDY3NDQ5Mzc0NTg0MDk0NDI0MTExOTMxNyJd)
## Explained
```
ʁ∆FbfB
ʁ      # range [0, input)
 ∆F    # 0-indexed fibonacci number of each
   bf  # convert each to binary and flatten the list
     B # convert that from binary
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 61 bytes
```
->n,a=0,b=1,s=""{s+="%b"%a;a,b=b,a+b;(n-=1)>0?redo:s.to_i(2)}
```
[Try it online!](https://tio.run/##JVDLTtxAEDzDV1hGaEEYNP2cHtAsH5JEyIZFyQUi1hwi47/IIQe@jh/ZdM/6MFPuqequ6rf36c/huR6uty/DWNMwVRj2te@X/VXtz6f@fLwbvTgN49V0d/FyXeFym@7fdk@vt/ub@fXh1wVerofl9AS6uu3ScHqCAcABBSAH3CrsSAJJcaSBOGeHOWBWDrE1KiJKCEvrUAABgggp/lESZRHEqLSpoAk5EbGGCJoBTAIpKxpRawXNjbg4tCZkAq3D0RwxQwlqEpPiZzw1t2qGqKVoVil@sVDz0gLkxJnjcxYZKakpF4v3YyoEFSMA0lQSm0/hkrlQrACOYX0JRRSdqRmIAJOBeZ@sqo3WtqDJ5yavU2GTnNGjZY@c3BKZpZiJbT9cpEAx8IglqdsrlFnMmczIAJ4ztrne7MbHn93yMQ@7j@73@7zv@rPl@dv8o9Zdd99tvj7/brrbuP9t1u/z2TL7WbeBgrX26@E/ "Ruby – Try It Online")
]