[Question]
  [
Jelly has an "untruth" atom: `·π¨`. This takes a non-empty array of positive integers and returns a Boolean array with **1**s at the indexes in the input. For example:
```
[1,3,5,6]·π¨ ‚Åº [1,0,1,0,1,1]
[5]·π¨       ‚Åº [0,0,0,0,1]
[2,1,1,2]·π¨ ‚Åº [1,1]
[5,4,3]·π¨   ‚Åº [0,0,1,1,1]
[1]·π¨       ‚Åº [1]
```
[Try it online!](https://tio.run/##y0rNyan8///hzjX/D7c/alpzdNLDnTP@/4821DHWMdUxi9VRiDYFEUY6hkBoBObrmOgYgxiGsQA "Jelly ‚Äì Try It Online")
Note that Jelly uses 1-indexing, and that duplicate values in the array have no effect.
Your job is to take a non-empty array of positive integers and output the result of applying `·π¨` on the array. If your language has a builtin with this exact behaviour, you may not use it. You may also choose to use zero indexing if you wish (so the above examples become `[0,2,4,5], [4], [1,0,0,1]` etc) and take non-negative integers in the input array.
You may use your language‚Äôs `true` and `false` values instead of `1` and `0`, so long as they are the Boolean values rather than general truthy and falsey values (e.g. `0` and non-zero integers). You may also take input as a set if your language has that type. The input is not guaranteed to be sorted and may be in any order. The output may not have trailing zeros (or any other "trailing" values).
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the shortest code in bytes wins.
  
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 3 bytes
```
√ó¬Ø‚ç∏
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn///D0Q@sf9e74n/aobcKj3r5HXc2H1hs/apv4qG9qcJAzkAzx8Az@n6ZgqGCsYKpgxpWmYArERkC@oYIRAA "APL (Dyalog Extended) ‚Äì Try It Online")
A tacit function. Banning only the *exact* built-in actually gives APL a massive advantage!
### How it works
```
√ó¬Ø‚ç∏
  ‚ç∏  ‚çù Takes a vector v and gives another vector containing v[i] copies of i
     ‚çù for each index i
 ¬Ø   ‚çù Inverse of the above, which counts occurrences of i which becomes v[i]
√ó    ‚çù Signum of each number, converting any positive count to 1
```
---
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 7 [bytes](https://github.com/abrudz/SBCS)
```
‚ä¢‚àä‚ç®‚àò‚ç≥‚åà/
(‚ç≥‚åà/)‚àä‚ä¢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1HXokcdXY96VzzqmPGod/Ojng59Lg0oQxMk07Xof9qjtgmPevsedTUfWm/8qG3io76pwUHOQDLEwzP4f5qCoYKxgqmCGVeago4pkDACChgqGAEA "APL (Dyalog Unicode) ‚Äì Try It Online")
Non-Extended solution. Works exactly like the [3-byte Jelly solution](https://codegolf.stackexchange.com/a/216740/78410).
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 7 [bytes](https://github.com/abrudz/SBCS)
```
‚à®‚åø-‚Üë‚ç§0√ó
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1HHikc9@3UftU181LvE4PD0/2mP2iY86u171NV8aL0xSLhvanCQM5AM8fAM/p@mYKhgrGCqYMaVpqBjCiSMgAKGCkYA "APL (Dyalog Unicode) ‚Äì Try It Online")
A fun way to do the job. For each number `n`, create a length-`n` vector that has a 1 at the end and 0 for the rest. Then promote the entire array to a matrix (padding as necessary) and take the logical OR of the rows.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~42~~ 41 bytes
*-1 thanks to @ovs*
```
lambda a:[i+1in a for i in range(max(a))]
```
[Try it online!](https://tio.run/##DcYxDoAgDADAr3QskcWoi4kvQYcaQZtAJQSNvr560@W3Hqd0GqZZI6V1I6DRcdOyAEE4CzD8LSS7x0QPkjGL5sJSMaC/KSJLviqan7rB9rZbPg "Python 3 ‚Äì Try It Online")
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 11 bytes
```
{~l,1}·µêz‚ÇÅ‚åâ·µê
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/qv@6ip8eHWCYc2VZcrKejaKSiV2z9q2/Coqenhrs5aoMT/6rocHUMQqwqo8lFPJ0jsf3S0oY6xjqmOWaxOtCkQG@kYAqFRbCwA "Brachylog ‚Äì Try It Online")
It's certainly interesting to consider what approach is the best in a language without a concept of a Boolean. 0-indexed. For some reason the unbound variables that are *pretty much* 0 are actually displaying as variables, so tack a `‚âú` onto the end if that's a problem.
```
{    }·µê        For each element of the input:
   ,1          append 1 to
 ~l            something that long.
       z‚ÇÅ      Ragged zip. (i.e. non-cycling, doesn't stop until all lists are exhausted)
         ‚åâ·µê    Take the maximum of each column.
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 20 bytes
```
SparseArray[#->1^#]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7P7ggsag41bGoKLEyWlnXzjBOOVbtf0BRZl4JiKtRZJvmoKypo6Rgq6Ck45NZXOLgUBSrVhecnJhXV81VbahjrGOqY1arw1VtCiKMdAyB0AjM1zHRMQYxDGu5av8DAA "Wolfram Language (Mathematica) ‚Äì Try It Online")
Returns a `SparseArray`.
[Answer]
# [Haskell](https://www.haskell.org/), 30 bytes
```
f a=map(`elem`a)[1..maximum a]
```
[Try it online!](https://tio.run/##XU7NisIwEL7nKeYgmMDYbfw7iNmbB2FPegwBpzS6YZtY2gpefZ99AcGX0Rfp9kcWcYZhYL6/@abyx2ZZXe@BlKec72xm/Y6EllHk6ez8yQOZ2pMLKj0y0JzQxcIsR7ywlJaLxaZZW70OlRHLwefBVl8uWAaZrSBRLScqQzoocwr8Qw31ULiYQV64UPEmEPbF0a/CyfPmA6FUgoSJYNAG1lriBGc4N/frLzwuN2gOMfYjDdOzDuirg2PsuwXHLQnHr9pOg1OcPHX/Gvk0lO@G0vwB "Haskell ‚Äì Try It Online")
The relevant function is `f`, which takes as input a list of integers `a` (1-indexed) and returns a list of `Bool`s.
[Answer]
# [Neim](https://github.com/okx-code/Neim), 5 bytes
```
ùê†ùêàŒì‚ÇÅùïö
```
[Try it online!](https://tio.run/##y0vNzP3//8PcCQuAuOPc5EdNjR/mTp31/3@0oYKxgqmCWSwA "Neim ‚Äì Try It Online")
Explanation:
```
ùê†        # Get Greatest element
 ùêà       # Inclusive range: (0 .. n]
  Œì      # For each element in range do: 
   ‚ÇÅ     # 1st input line
    ùïö    # Check that the int is in the list
```
[Answer]
# [Factor](https://factorcode.org/), 35 bytes
```
[ 0 [ 2^ bitor ] reduce make-bits ]
```
[Try it online!](https://tio.run/##NY29CoNAEIR7n2JeIKImlYG0wcZGUomBy2aD4s@ZvbMQ8dnNYhK2mBlm2O9lyFvZbkWWX1O0LAN3cOwdeuNrde@JB@JvDB@NFqOw9/MozeBhRMzscA6yPIUjMZ7qYAmABQmOOGHd/V9jRHrxL0Wq61aqlkju0OdWUEH4ORErsOXDDqx0c9lJCLUn24/WMdhQDerYyPYB "Factor ‚Äì Try It Online")
Takes a sequence of 0-based indices and returns a virtual boolean sequence of `t` (true) and `f` (false).
### How it works
```
[
  0 [ 2^ bitor ] reduce  ! Reduce all 2^n bitmasks by bitwise OR
                         ! for each n in the sequence
  make-bits  ! Create a virtual sequence of bits from the integer
]
```
[Answer]
# [Ruby 2.7](https://www.ruby-lang.org/), 33 bytes
```
->a,n=[0]*a.max{a.map{n[_1]=1};n}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y5RJ8822iBWK1EvN7GiGkQWVNdk1uRFZ8baGtZa59X@L1BIi4420DHSMdExjY3lAnNNYAxDHQMgNIRxTYGKjGEcg9jY/wA "Ruby ‚Äì Try It Online")
Uses the 0-indexing. TIO uses an older version of Ruby, whereas in Ruby 2.7, we've numbered parameters, which saves two bytes.
[Answer]
# [Java (JDK)](http://jdk.java.net/), 82 bytes
```
a->{int m=0,r[];for(int i:a)m=i>m?i:m;r=new int[m];for(int i:a)r[i-1]=1;return r;}
```
[Try it online!](https://tio.run/##bZBNboMwEIX3OcXIUiRoDQpp00UoqbrprqssEQuXQOQUGzQeUkURN@oFepyehJqfNKlSIWOP37z5xrMTe@HtNu@tVFWJBDsb@zXJwr8JJ1d3ea1TkqXuxLQQxsCrkBqOE4CqfitkCoYE2W1fyg0oqzlrQqm3cQICt8btUwFexjqPUlOc8P6/ghyiVnirow1BRTOOcRLmJTpdLJfCVZFcqSe5VCFGOvuAzqb@pmAsvSCJghAzqlEDhk0b9sieYdugzJCBaGwE4BjwO77gDw0/XSzOxzkP7De/0Pg9vzuHwXhsBobtBJy9wB6yHFDuL@kk2IlY/jOiOBifymFATqe4PmZVIdLMYcA4MObCLbDvr08WXtTAzNQF2RK5L6qqOAzW64z/OYN2TTr51wdDmfLLmvzKGih32NSbz7qRTc1U2@TxDfyMGc3NpFtN@wM "Java (JDK) ‚Äì Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 4 bytes
```
v1i(
```
[Try it online!](https://tio.run/##y00syfn/v8wwU@P//2hDHWMdUx2zWAA) Or [verify all test cases](https://tio.run/##y00syfmf8L/MMFPjv0vI/2hDHWMdUx2zWK5oUyA20jEEQiMQT8dExxhIG8YCAA).
### Explanation
```
v   % Concatenate stack contents vertically. Gives an empty array
1   % Push 1
i   % Take input
(   % Assignment indexing: write 1 into the array at the input positions.
    % This automatically extends the array and fills with 0
    % Implicit display
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
·πÄe‚Ç¨
```
[Try it online!](https://tio.run/##y0rNyan8///hzobUR01r/h9uB5KR//9HG@oY65jqmMXqRJsCsZGOIRAaxQIA "Jelly ‚Äì Try It Online")
This does seem somewhat difficult to outdo.
```
  ‚Ç¨    Map over (the range from 1 to)
·πÄ      the largest element of the input:
 e     is it in the input?
```
Silly, 0-indexed bonus:
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
2*BUo/
```
[Try it online!](https://tio.run/##y0rNyan8/99Iyyk0X///o4aZh9sfNa2J/P8/2lDHWMdUxyxWJ9oUiI10DIHQKBYA "Jelly ‚Äì Try It Online")
```
2*        For each element of the input, raise 2 to that power.
  B       Convert to binary
   U      and reverse each,
     /    then reduce by
    o     vectorizing logical OR.
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 7 bytes
```
mo¬±‚Ç¨¬π·∏£‚ñ≤
```
[Try it online!](https://tio.run/##ASEA3v9odXNr//9tb8Kx4oKswrnhuKPilrL///9bMCwyLDQsNV0 "Husk ‚Äì Try It Online")
I feel like I'm missing a way to do this with `Œ∑`.
## Explanation
```
mo¬±‚Ç¨¬π·∏£‚ñ≤
     ·∏£‚ñ≤ range 1..max(input)
mo      map each to
   ‚Ç¨¬π   whether it's present in the input(index if present, 0 if not)
  ¬±     and take the sign of that
```
[Answer]
# [Scala](https://www.scala-lang.org/), 19 bytes
```
i=>1 to i.max map i
```
[Try it online!](https://scastie.scala-lang.org/MgwzKES7QeG56E8pB0d5qg)
Returns a `Seq` of `Boolean`s. Takes a `Set[Int]` as input, since sets are also predicates in Scala. If a list is taken as input, `i.contains` would have to be used instead.
[Answer]
# [J](http://jsoftware.com/), 12 bytes
```
e.~1 i.@+>./
```
[Try it online!](https://tio.run/##DcZBCkBAGEDhvVO8LJgJP4OxMJFSVlauIMLGDVx9TK@v3uNjSU@GnpScij4ohHlbF3/IZ7hlykYpvY6Ijv16Ue7UiYwoQ4Olc1hHjQnV4WlpHEb7Hw "J ‚Äì Try It Online")
0-indexed; similar to Bubbler's APL solution
# [K (oK)](https://github.com/JohnEarnest/ok), ~~14~~ 12 bytes
-2 bytes thanks to coltim
```
{~^x?!1+|/x}
```
[Try it online!](https://tio.run/##y9bNz/7/P82qui6uwl7RULtGv6L2f5q6hqGCsYKpgpm1ho6pprWRgiEQGlmbKpgoGAOFDDU1/wMA "K (oK) ‚Äì Try It Online")
0-indexed
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 17 bytes
```
@(x){y(x)=1,y}{2}
```
Anonymous function that takes a row (or column) vector as input and produces a row vector as output.
Uses the last trick on [this list](https://codegolf.stackexchange.com/a/104753/36398) to effectively include several statements in an anonymous function.
[**Try it online!**](https://tio.run/##y08uSSxL/Z9mq6en999Bo0KzuhJI2BrqVNZWG9X@T9OINlQwVjBVMIvV5AJyTCGUkYIhEBpBxRRMFIwhTMNYzf8A)
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 45 bytes
1-indexed, which felt weird to do in a 0-indexed language. Accepts only non-negative integers; negative indexing in powershell is 1-based, so this answer breaks down for negative cases.
```
$a=,0*($args|sort)[-1];$args|%{$a[$_-1]=1};$a
```
[Try it online!](https://tio.run/##hVBNT4NAEL3zKyabrYBdTKl6qSFprFVPPaiJB0IapGMlpYC7S6qh/HZcQFpMQ5w97Hy8ffP2pckOufjAKCrpexYHMkxiRwMVeUl9h43ODerztdiLhEvTtWzvpqkHOfVdulQNxy5Uryw0KlHImS9QgANTo2aZ5vVVRRinmaySamizMbs2DzP8SjGQuKpnxAYbRurYpEEUrJeml@Lfp2N2ya76nqvd1WlJNLP7uT0MIK/rRbZ9Q64MaHbQegED2iGjy4umq5K23YA5iiySCnJ2cB6mNbaZiywIUFRekl8sAQs/VdXykBr4ykOJ1mMiJBD3RamCjjYPCJyGtUgWuIvCGE8ZqGHo934YZRx1pj83InTTbfV4pke6DGDd@sFmzZMsXs2SKOGgCO58vnnClSKosgeOGP@hOFk7geMf@8UpbQTceevuwQiPMFdIHsZrbzKZb1P53V1GoDH06MpwqBXlDw "PowerShell ‚Äì Try It Online")
[Answer]
# [Julia 1.0](http://julialang.org/), ~~25~~ 21 bytes
```
x->1:max(x...).‚àà[x]
```
[Try it online!](https://tio.run/##bY5NCoNADIX3OUWQLkZIxdG2i4JexM5C6gyMWCs6hTmC@0JXPZ0XsY4/4KIJWSTve4@Ur0rn3I4KExztMeXXR26ZDYLAD4a@z6wYjexMN8kZZJxiOtNFYJLitIS0DBcE2VngUk4LaelZiRxC0eZaaDpRLHY033L4PsddBACoZ4tMU@mjrnF@CMAxSk@PKab9edNqPiRYwpqBTatrU9XMG75v9Ai1i1UrL6tO/iM/O5LQuxkmbSPvRhZ4KH1vNdcFTDP@AA "Julia 1.0 ‚Äì Try It Online")
[Answer]
# [R](https://www.r-project.org/), ~~32~~ ~~25~~ 24 bytes
```
function(x)1:max(x)%in%x
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP0@jQtPQKjexAkirZuapVvxP00jWMNQx1jHVMdPU5ErTMAURyRpGOoZAaKQJ4ZnqmOgYg9mGmv8B "R ‚Äì Try It Online")
Taking advantage of `%in%` operator and abusing weird precedence.
*-1 thanks to [Dominic van Essen](https://codegolf.stackexchange.com/users/95126/dominic-van-essen)*
### 21 bytes using `scan`
```
1:max(x<-scan())%in%x
```
[Try it online!](https://tio.run/##K/r/39AqN7FCo8JGtzg5MU9DU1M1M0@14r@hgrGCqYLZfwA "R ‚Äì Try It Online")
[Answer]
# [R](https://www.r-project.org/), ~~24~~ 23 bytes
*Edit: -1 byte thanks to pajonk*
```
F[scan()]=1;F&!is.na(F)
```
[Try it online!](https://tio.run/##K/r/3y26ODkxT0Mz1tbQ2k1NMbNYLy9Rw03zv7GCmYL5fwA "R ‚Äì Try It Online")
A different approach to [pajonk's R answer](https://codegolf.stackexchange.com/a/216763/95126).  
Shorter at time of posting, but this is a precarious situation, as it would be longer in a fair 'apples-with-apples' comparison (using `scan()` for both approaches).
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~45~~ 44 bytes
```
a=>a.map(b=>c[b]=1,c=[])&&[...c].map(d=>d|0)
```
[Try it online!](https://tio.run/##dY4xDoMwDEX3niITSiQ3xJSOzkWiDCGBqhUlCKpOvXtKYQAhalte/P/zf7i3G/1w71/nLoY6NZQcaSefrucVaW8qSwiejBVZZqSU3s63QDp8lEg@dmNsa9nGG2@4UVBACVcrBMtzZhgCU7BuZPa0c5Q/7VKzQ8E6B3IENTVuHxxB4QLFAt5A8V8GtcswSdIX "JavaScript (Node.js) ‚Äì Try It Online")
This implementation uses zero indexing and returns an array of `0`s and `1`s.
I think the code isn't very difficult to understand. Here's a summary explanation:
* `c=[]`: create the output array.
* `a.map(b=>c[b]=1 )`: for each value of the input array, set 1 at the respective index in the output array.
* `[...c].map(d=>d|0)`: convert the output array into a non-sparse array, then map each element to a 32-bit integer. This will map `1` to `1` and `undefined` to `0`.
Thanks to [Neil](https://codegolf.stackexchange.com/users/17602) for -1 byte.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~4~~ 3 bytes
```
ZL√•
```
[Try it online!](https://tio.run/##yy9OTMpM/f8/yufw0v//o410DIHQKBYA)
Yes it is just a port of every other answer.
## Explained
```
ZL√•
ZL   # Push the range: [1, max(input)]
  √•  # Vectorise: is item in input? over that range
```
[Answer]
## x86\_64 (zero indexed, length given), 19 16 bytes
Raw machine code:
```
31 c0 57 f3 aa 5f 89 d1 8d c6 04 07 01 e2 f9 c3
```
Uncommented assembly:
```
        .intel_syntax noprefix
        .globl untruth
untruth:
        xor     eax, eax
        push    rdi
        rep stosb byte ptr [rdi]
        pop     rdi
        mov     ecx, edx
.Lloop:
        lodsd   dword ptr [rsi]
        mov     byte ptr [rdi + rax], 1
        loop    .Lloop
.Lend:
        ret
```
### Explanation
I'm not too good at x86, so I am pretty sure there is a better way to do this.
C signature:
```
// System V ABI (rdi, rsi, rdx, rcx)
void untruth(bool *out, const uint32_t *indices, uint32_t indices_len, uint32_t out_len);
```
It's my function, I can order the parameters however I please. üòè
First: `memset(out, 0, out_len)` using `rep stosb`. Since we need to save the pointer and `stosb` clobbers it, we `push` and `pop` it.
The standard calling conventions say that the direction flag is always cleared when calling, so we know this will be a forwards operation.
```
untruth:
        xor     eax, eax
        push    rdi
        rep stosb byte ptr [rdi]
        pop     rdi
```
Using the fancy `loop` instruction, loop through each index in the array, storing 1 to `out[index]`
```
        mov     ecx, edx
.Lloop:
        lodsd   dword ptr [rsi]
        mov     byte ptr [rdi + rax], 1
        loop    .Lloop
```
At the end of the loop, return.
```
.Lend:
        ret
```
Note: It also happens to be x86-compatible on the binary level.
Thanks to Neil for the -3 bytes (using lodsd)!
## x86\_64 (zero indexed, calculates max), 28 bytes
Raw machine code:
```
31 c0 57 51 af 0f 42 47 fc e2 f9 91 56 56 5f f3
aa 5f 59 5e ad c6 04 07 01 e2 f9 c3
```
Assembly:
```
        .intel_syntax noprefix
        .globl untruth
        # void untruth(const uint32_t *indices{rdi}, char *out{rsi}, uint32_t indices_len{rcx})
untruth:
        xor     eax, eax
        push    rdi
        push    rcx
.Lfind_max:
        scasd   eax, dword ptr [rdi]
        cmovb   eax, dword ptr [rdi - 4]
        loop    .Lfind_max
.Lfind_max.end:
        xchg    ecx, eax
        push    rsi
        push    rsi
        pop     rdi
        rep stos byte ptr [rdi], al
        pop     rdi
        pop     rcx
        pop     rsi
.Lloop:
        lodsd   eax, dword ptr [rsi]
        mov     byte ptr [rdi + rax], 1
        loop    .Lloop
.Lloop_end:
        ret
```
This version will check for the maximum itself, *but the output buffer provided must be large enough.*
Probably many things here can be optimized.
## Explanation
Note that the parameters are different than the first: `indices` is in `rdi`, `out` is in `rsi`, `rdx` is unused, and `indices_len` is in `rcx`.
I don't know why `scasd` uses `rdi` but whatever.
This is a simple max loop. It compares each dword in `indices`, and sets `eax` to the maximum.
This seems to be smaller than doing something with `lodsd`, although that 4 byte `cmovb` is pretty yucky.
```
untruth:
        xor     eax, eax
        push    rdi
        push    rcx
.Lfind_max:
        scasd   eax, dword ptr [rdi]
        cmovb   eax, dword ptr [rdi - 4]
        loop    .Lfind_max
```
Since we know `ecx` will be zero due to the loop condition, we can set `ecx` to the maximum *and* set `eax` to zero in one byte.
```
.Lfind_max.end:
        xchg    ecx, eax
```
Unfortunately, our output array is in `rsi`, not `rdi`. We `push` and `pop` twice to mov without the `REX` tax and save a copy, then do a `memset` with `rep stosb`.
```
        push    rsi
        push    rsi
        pop     rdi
        rep stos byte ptr [rdi], al
        pop     rdi
```
Now we need to get `indices` and `indices_len` from the stack. Note that this time, we put `indices` into `rsi`.
```
        pop     rcx
        pop     rsi
```
For each dword in indices, `out[indices[i]]` to 1 using `lodsd` and `loop`
```
.Lloop:
        lodsd   eax, dword ptr [rsi]
        mov     byte ptr [rdi + rax], 1
        loop    .Lloop
```
Return.
```
.Lloop_end:
        ret
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 49 bytes
```
a=>Enumerable.Range(1,a.Max()).Select(a.Contains)
```
[Try it online!](https://tio.run/##pY49C8IwFEX3/opHpwSegSh16cciCkpddHBOQyyB@gJNioL422NE0F250@UeDlf7mfY2bibSVWt9qCyFBmG7puliRtUNpuqcG5oGzgmBGqKqm@8oDop6wyQqsVc3xrk4msHowJRYOQrKkuexzLJUvEv4abTBtJYM82G01Iuds8RyzPGlZ2Su8HnBONxBIiwQCoQlPDjn5e@m4l@BxHmKfGviEw "C# (Visual C# Interactive Compiler) ‚Äì Try It Online")
Saved 3 bytes thanks to caird
Saved 1 byte thanks to didymus
Saved 2 bytes thanks to NonlinearFruit
[Answer]
# [Nim](http://nim-lang.org/), 60 58 bytes
```
func t[S](n:S):S=
 for i in 1..n.max:result.add int i in n
```
[Try it online!](https://tio.run/##y8vM/f8/rTQvWaEkOjhWI88qWNMq2JZLIS2/SCFTITNPwVBPL08vN7HCqii1uDSnRC8xJQUoXAKRzPufmpyRr@AQbaijYKyjYKqjYBarV8IFFTRFYhvpKBiCkRGyAh0FE6BGJBFDIPs/AA "Nim ‚Äì Try It Online")
[Answer]
# [Uiua](https://uiua.org), 4 [bytes](https://codegolf.stackexchange.com/a/265917/97916)
```
>0‚çò‚äö
```
[Try it!](https://uiua.org/pad?src=ZiDihpAgPjDijZjiipoKCmYgWzAgMiA0IDVdCmYgWzRdCmYgWzEgMCAwIDFdCmYgWzQgMyAyXQpmIFswXQo=)
0-indexed
```
>0‚çò‚äö
  ‚çò‚äö  # inverse where (occurrences)
>0    # where is it greater than zero?
```
[Answer]
# [Perl 5](https://www.perl.org/), `-pa` 33 bytes
```
@r[@F]=(1)x@F;map$_+=0,@r;$_="@r"
```
[Try it online!](https://tio.run/##K0gtyjH9/9@hKNrBLdZWw1CzwsHNOjexQCVe29ZAx6HIWiXeVsmhSOn/f0MFAyA0/JdfUJKZn1f8X9fXVM/A0OC/bmJBDgA "Perl 5 ‚Äì Try It Online")
`0` indexed. Input and output are space separated.
[Answer]
# JavaScript (ES6), 50 bytes
```
a=>a.map(g=(x,i)=>x&&g(--x,g,o[x]|=++i/i),o=[])&&o
```
[Try it online!](https://tio.run/##bY1BDoIwEEX3noJV04YpUBB35SJNFw1CU4MMAWO68O7VpjFGZSaz@Mmb9y/mbrZ@dcuNz3gewiiDkZ0prmahVlIPjsnOE2Ip5x4soPL6IfPclY4BSqUZIRh6nDechmJCS0eqBDTQwkkzlpVl9ooVpBP68IO2EUoT0QrS/oN1fIf649xxwRGa5Hu7xG6p@C4VOjwB "JavaScript (Node.js) ‚Äì Try It Online")
### Commented
```
a =>                // a[] = input array
  a.map(            // for each ...
    g = (x, i) =>   // ... value x at position i in a[]:
      x &&          //   if x is not equal to 0:
        g(          //     do a recursive call:
          --x,      //       decrement x
          g,        //       force i to a non-numeric value
          o[x] |=   //       update o[x]:
            ++i / i //         set it to 1 if i is numeric (‚â• 0)
                    //         or just coerce it to a number otherwise
                    //         (i.e. undefined values are turned into 0's)
        ),          //     end of recursive call
      o = []        //   start with o[] = empty array
  ) && o            // end of map(); return o[]
```
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 9 bytes
```
L,dbMR$‚Ç¨e
```
[Try it online!](https://tio.run/##S0xJKSj4/99HJyXJN0jlUdOa1P8qOYm5SSmJCoZ20YYKxgqmCmaxXP5cXEjCpugCRgqGQGgEFP4PAA "Add++ ‚Äì Try It Online")
Given that no-one besides me really uses Add++, I figured I wouldn't be sniping anyone
## How it works
```
L,dbMR$‚Ç¨e - Anonymous lambda function
L,        - Define the lambda function. Takes l as input
  d       - Duplicate; STACK = [l l]
  bM      - Maximum;   STACK = [l max(l)]
  R       - Range;     STACK = [l [1 2 ... max(l)]]
  $       - Swap;      STACK = [[1 2 ... max(l)] l]
  ‚Ç¨       - Over each:
    e     -   In l?
```
[Answer]
# [Zsh](https://www.zsh.org/), 25 bytes
```
for x;a[x]=1
<<<${a/#%/0}
```
[Try it online!](https://tio.run/##qyrO@P9w5xoNTY3/aflFChXWidEVsbaGXDY2NirVifrKqvoGtf81ubiAahQMFYwVTBXMwGxTMGkEFDNUMIKIKJgoGEPU/QcA "Zsh ‚Äì Try It Online")
The `#` and `%` in globs act like the regex `^` and `$` anchors, but for full words instead of lines.
Altenatively, `<<<${a:///0}` works.
---
[Very similar Zsh solution to another question](https://codegolf.stackexchange.com/a/194813/86147)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
r√î√µ!√∏U
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=ctT1IfhV&footer=bSsw&input=WzEsMyw1LDZdCi1R)
```
√ç√å√Ü√∏X√Ñ
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=zczG%2bFjE&footer=bSsw&input=WzEsMyw1LDZdCi1R)
]