text:
Hey, what time is it?
Challenge
Given a number width, number height, hours and minutes print the time using the following format style:
------  -  ------  ------  -    -  ------  ------  ------  ------  ------
|    |  |       |       |  |    |  |       |            |  |    |  |    |
|    |  |  ------  ------  ------  ------  ------       |  ------  ------
|    |  |  |            |       |       |  |    |       |  |    |       |
|    |  |  |            |       |       |  |    |       |  |    |       |
------  -  ------  ------       -  ------  ------       -  ------  ------

For numbers with a mid line, when the height is odd just place it in the middle (example for height = 3):
------
|    |
------
|    |
------

However, when the height is even you can choose up or down:
------  ------
|    |  |    |
|    |  ------
------  |    |
|    |  |    |
------  ------

Of course, you need to specify this and use it every time.

Input

W: The width of each number
H: The height of each number
HRS: Time hours
MINS: Time minutes

Output
You can either print the time, return a string (including the newlines) or return a list of strings (one string per line).

Rules

Assume number width > 2
Assume number height > 2
The space between numbers is fixed to 2
The space between hours and minutes is fixed to 4
If hours or minutes are < 10 (single digit), make sure to add a 0 (see example)
Assume that input hours and minutes will always be valid time
Digit 1 is a special case which always has the same width 1 and only it's height changes.
Height is considered the inner height, excluding the upper and lower rows of --- (see example)

Example
Here's an example for W=6, H=4, hrs=2, mins=18:
------  ------    -  ------
|    |       |    |  |    |
|    |  ------    |  ------
|    |  |         |  |    |
|    |  |         |  |    |
------  ------    -  ------

Are we allowed to return the result as a list of strings / list of character lists?

@HyperNeutrino Check the edit. Should be clear now.

@Arnauld Totally, missed to mention this. Yes, 1 always has a width of 1 and only it's height changes. I will edit.

@Arnauld Yes it is.

@Arnauld Should add this as a rule? I thought it's visible on the example.

It probably should. That's a bit disturbing, since H and W are not defined the same way.

@DimChtz Generally, you shouldn't even need test-cases to be able to make a valid answer, they're really only for making sure answers work

JavaScript (ES8), 258 245 242 239 bytes
(w,h,H,M)=>[2,h-1,2,h,2].map((r,y)=>`${(g=x=>((k=[876,,1284,260,8461,276,788,8484,780,268][x%10|0])?(s=x=>' -|'[[21,8,5,10,4,2][k*2>>y*3&7]>>x&3])().padEnd(w-2,s(4))+s(2):'-|||-'[y])+'  ')(H/10)+g(H)}  ${g(M/10)+g(M)}
`.repeat(r/2)).join``

Try it online!
Character encoding
Digits are made of 3 distinct characters:

0: space
1: -
2: |

Pattern encoding
Each digit is made of 5 patterns:
0:  -----  <-- top pattern
1:  |   |  <-- upper side repeated pattern
2:  -----  <-- middle pattern
3:      |  <-- lower side repeated pattern
4:  -----  <-- bottom pattern

Each pattern is made of a leading character \$L\$, followed by a repeated middle character \$R\$, followed by a trailing character \$T\$.
All digits can be built by using only 6 distinct patterns, which are encoded as:
$$L+R\times16+T\times4$$
 ID | Leading | Repeated | Trailing | Codes | Encoded as
----+---------+----------+----------+-------+------------
  0 |   "-"   |   "-"    |   "-"    | 1,1,1 |    21
  1 |   " "   |   " "    |   "|"    | 0,0,2 |     8
  2 |   "-"   |   " "    |   "-"    | 1,0,1 |     5
  3 |   "|"   |   " "    |   "|"    | 2,0,2 |    10
  4 |   " "   |   " "    |   "-"    | 0,0,1 |     4
  5 |   "|"   |   " "    |   " "    | 2,0,0 |     2

Digit encoding
Because of its non-standard width, \$1\$ is a special case and is processed separately.
All other digits are encoded as:
$$\frac{1}{2}\sum\limits_{n=0}^{4}2^{3n}P_n$$
where \$P_n\$ is the \$n\$-th pattern for this digit (0-indexed, from top to bottom).
 Digit | Patterns  | Encoded as
-------+-----------+------------
   0   | 0,3,3,3,0 |     876
   1   |    n/a    |     n/a
   2   | 0,1,0,5,0 |    1284
   3   | 0,1,0,1,0 |     260
   4   | 2,3,0,1,4 |    8461
   5   | 0,5,0,1,0 |     276
   6   | 0,5,0,3,0 |     788
   7   | 0,1,1,1,4 |    8484
   8   | 0,3,0,3,0 |     780
   9   | 0,3,0,1,0 |     268

Python 2, 296 270 256 249 244 241 bytes
w,h,H,M=input()
a,d,e='| -'
b,c=d*(w-2),e*w
f,g=e+b+e,d+b+e
l,r,m=a+b+d,d+b+a,a+b+a
E=eval
for L in['ceccfccccc']+~-h/2*['marrmllrmm']+['macccccrcc']+h/2*['malrrrmrmr']+['ceccgccgcc']:print E(L[H/10]),d+E(L[H%10]),d+d,E(L[M/10]),d+E(L[M%10])

Try it online!

I find it interesting how we're converging towards the same size, while implementing quite different methods in 2 different languages. :p

@Arnauld Yeah, I noticed that. Also that you edged ahead ;)

Canvas, 101 98 96 bytes
┘｛ｌ２∔0×；＋｛ø；┤“\⤢ＹJ>`Ｓ‰/„２┬７ｎ＠｛⁴Ｙ？ｙ５＜？⁸»├⁸⇵|＊-∔ｙ３＜？↕；┐１；｝１ｙ２％‽⁷＋╷｝┘╋］⁷-×１ｙ５－⁸╵×⇵╵╋╋｝｝｝｝  ×＋｝ ４××＋

Try it here!
Nothing too fancy - stores the 7 bytes of info of each number and draws according to them.
While making this I fixed 3 bugs in Canvas (though only one resulted in shortening the answer; this is how the result would've looked without that commit)
Explanation:
┘{                   for each item of the 3rd input
  l2∔0×;+              prepend 2-length 0s to the item
  {                    for each character
    ø;                   push an empty canvas below the character
    ┤                    cast the character to a digit
    “...„２┬７n            the number 741859858201224148989 base-2 decoded & split into chunks of 7 - the digit data
    @                    pick the item in that list corresponding to the current number
    {                    for each bit there
      ⁴Y                 store the index in the loop in Y
      ?                  if the current bit is set:
        ｙ5<?               if y < 5 (aka one of the vertical parts)
          ⁸»├                push height>>1 + 2 (y position of the part)
          ⁸⇵|*               push a list of ceil(height/2) "|"s
          -∔                 prepend a "-" to that
          y3<?               if y < 3 (aka the top parts)
            ↕                  reverse that list
            ;┐１;               replace the y position with 1
          }
          1                  push 1 (x position of the part)
          y2%‽               if y%2 is 0
            ⁷+╷                add the width to that, then decrement
          }
          ┘╋                 at those coordinates enter that array in the canvas pushed earlier
        ]                  else (aka y >= 5, the horizontal parts)
          ⁷-×                repeat "-" width times
          1                  push 1
          y5-⁸╵×⇵╵           push ceil((y-5) * (height+1) / 2) + 1
          ╋╋                 at (1; above line) in the canvas, place the dashes, without smart overlapping
        }
      }
    }
  }
    ×＋                 join the 2 digits with 2 spaces
}
  4××＋               join the 2 numbers with 4 spaces

Charcoal, 101 bytes
ＮθＮη⊞υ¶Ｆ-|Ｆ⟦ι◧ιθ⁺◨ι⊖θι×ιθ⟧⊞υ⁺κ¶ＦＥ⪫Ｅ²◧ＩＮ²:⭆§⪪”)⧴9;ïjÞ⊟Pj%Uδ>LτS·Ｑr^ψＱ”⁵﹪℅ι¹⁶×÷§⟦²⊖η²η⟧μ²§υＩλ«Ｐι§⪪ι¶⁰→→

Try it online! Link is to verbose version of code. Explanation:
ＮθＮη

Input the height and width.
⊞υ¶

Push a newline to the predefined empty list.
Ｆ-|

Loop over the characters - and |.
Ｆ⟦ι◧ιθ⁺◨ι⊖θι×ιθ⟧

Loop over the four values given by the character, the character padded to the width, the character on both sides of the width, and the character repeated across the width.
⊞υ⁺κ¶

Push those values plus a newline to the list. This results in the following elements for a width of 6:
-
     -
-    -
------
|
     |
|    |
||||||

(Note that the last one is unused, and the first and fifth elements are only one character wide.)
ＦＥ⪫Ｅ²◧ＩＮ²:

Input two numbers, convert to string, left pad to a width of 2, join them with :, then loop over the characters in that string.
⭆§⪪”)⧴9;ïjÞ⊟Pj%Uδ>LτS·Ｑr^ψＱ”⁵﹪℅ι¹⁶

Split the compressed literal 4777415551464544646437462454644547446662474744746400000 into blocks of 5, then take the block indexed by the code point of the current character modulo 16, thus mapping space to 0 and : to 10. Map over those characters.
×÷§⟦²⊖η²η⟧μ²§υＩλ

Look up the character in the predefined list, then multiply it according to its index; the first, middle and last strings get multiplied by 2/2 while the intermediate strings get multiplied according to the height.
«Ｐι§⪪ι¶⁰→→

Print the string without moving the cursor, then print the first line of the string again, then move the cursor a further two squares to the right. This means that 1 is special-cased because its first line is only a - while : is special-cased to have no intrinsic with at all and merely ends up doubling the space between digits.


text:
Permutation Encoding
Write a program which can encode text to avoid reusing characters, and convert back.
Both normal and encoded forms are restricted to a particular character set: the space character  with code point 32, the tilde character ~ with code point 126, and all characters between. This is 95 total characters. It's a printable subset of ASCII.
The encoded text can be up to 95 characters long. The normal text can be up to 75 characters long, because above 75 it would be impossible to uniquely encode all messages.
Encoding
There are some requirements for the encoding:

Uses only characters from the character set described above
Uses each character at most once
Uniquely encodes all valid messages

Other than that, you're free to pick any variant.
Input
Input will consist of 2 items:

A boolean: false to encode, true to decode
A string: the message to be encoded/decoded

How you receive the input is up to you.
The boolean can be as a boolean or integer in the range [-2, 2] in your language's format. If the esoteric language doesn't have booleans or integers, use the closest analogue. I'm not doing the "or any 2 distinct values" because then you could use an encoding and decoding program as the values and evaluate them.
Output
Output should consist of only the encoded/decoded string. Leading and trailing newlines are okay.
Scoring
Your score is the length of your program, shorter is better.
I still encourage you to try harder languages even if they won't win.
Testing
Testing will generally be done with Try it Online!. For convenience, please provide a link to your program with some test input already filled in.
These are the steps to test a program:

Pick a valid normal string.
Encode it using the program.
Check that the encoded form is valid.
Decode it using the program.
Check that the final result matches the original string.

This can be repeated with other test strings for confidence.
If you show a working case and no failing cases have been found, we will assume your program works.
Reference Implementation
I am providing a reference implementation that shows one possible method, in hopes of making this problem more approachable. I used it to generate the examples. I recommend you try the problem yourself before looking at how I did it, that way you may independently come up with a better mapping.
Examples
Since you can choose a different encoding, as well as different input/output methods, your program might not match these examples.
Empty

Input:
0

Output:
(none)
Input:
1

Output:
(none)

Small

Input:
0
Hello, world!

Output:
 #mvcD_YnEeX5?

Input:
1
 #mvcD_YnEeX5?

Output:
Hello, world!

Max Size

Input:
0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Output:
C-,y=6Js?3TOISp+975zk}.cwV|{iDjKmd[:/]$Q1~G8vAneoh #&<LYMPNZB_x;2l*r^(4E'tbU@q>a!\WHuRFg0"f%X`)

Input:
1
C-,y=6Js?3TOISp+975zk}.cwV|{iDjKmd[:/]$Q1~G8vAneoh #&<LYMPNZB_x;2l*r^(4E'tbU@q>a!\WHuRFg0"f%X`)

Output:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Extras
How did I get the 75 characters limit? I could have brute force checked it of course, but there's a slightly more mathematical method for counting the number of possible encoded messages for a given character set:
$$
F(n)=\sum_{k=0}^{n}{\frac{n!}{(n-k)!}}=e\Gamma(n+1,1)\approx en!
$$
Here are the relevant bounds. There's plenty more valid encoded messages than normal messages, but still enough normal messages that you'll need a variable length encoding.
$$
F(95)\approx 2.81\times 10^{148} \\
{95}^{75}\approx 2.13\times 10^{148} \\
95!\approx 1.03\times 10^{148}
$$
The problem was inspired by a phenomenon on the Discord chat platform. In Discord, you can "react" to chat messages, which adds a little emoji underneath. You can react many times on a single chat message. Each emoji can only be added once. They remember the order they were added and display oldest to newest, left to right. You can add some non-emojis too. People sometimes write short messages in reactions, and when their message has repeat characters they're forced to get creative, usually they opt for lookalike characters.

Welcome to PPCG! Great first challenge! Here's a link to the Tour if you haven't seen it, and the Sandbox where you can get challenges reviewed before posting.

Do we really need to use TIO? If so, then it sounds very restricting.

I ask for a link to some online compiler/interpreter since it makes it convenient for others to test. It doesn't have to be TIO. If you don't link at all, it will be frustrating trying to test your submission, it's hard to tell if the submission doesn't work or we're just running it wrong.

Python 3, 339 338 bytes
lambda b,s:b and G(f(s))or F(g(s))
a=''.join(chr(32+i)for i in range(95))
f=lambda s:95*f(s[1:])+ord(s[0])-31if s else 0
F=lambda n:chr((n-1)%95+32)+F((n-1)//95)if n else ''
g=lambda s,d=a:1+d.find(s[0])+len(d)*g(s[1:],d.replace(s[0],''))if s else 0
G=lambda n,d=a:d[(n-1)%len(d)]+G((n-1)//len(d),d.replace(d[(n-1)%len(d)],''))if n else''

Try it online!
Same length, uses a list instead of a string for the ASCII chars Try it online!.
Overview: WIP

Because the number of printable ASCII strings with 75 or fewer characters is 21570794844237986466892014672640809417999612393958961235356099871415520891159490775110725336452276983325050565474469409911975201387750975629116626495, which is less than the number of valid encoded strings (28079792812953073919740255779032193344167751681188124122118245935431845577725060598682278885127314791932249387894125026034584206856782082066829102875)

All we need to do is theoretically sort the valid encoded strings and the valid non-encoded strings, take the index in the correct list of our given input, then return the string at that index in the other list.

f: Converts an input (non-encoded) string to an integer based on its index in the theoretical list of ASCII strings sorted by length and then lexicographically.

The empty string is 0
Single-char strings are 1 to 95
Two-char strings are 96 to 9120, etc.

F: Undoes f, converts an integer to a (non-encoded) string.
g: Converts an input (encoded) string to an integer (<= 28079792812953073919740255779032193344167751681188124122118245935431845577725060598682278885127314791932249387894125026034584206856782082066829102875 for valid inputs) based on its index in the theoretical list of valid encoded strings sorted by length and then lexicographically.

The empty string is 0
Single-char strings are 1 to 95
Two-char strings are 96 to 9025, etc.

G: undoes g, converts an integer to an (encoded) string.
Main function: Unnamed lambda b,s:b and G(f(s))or F(g(s)): Uses the boolean b to determine whether to encode G(f(s)) or decode F(g(s)) the string, and does so.

Charcoal, 94 bytes
≔⁰ζ¿Ｎ«≔γδ≔¹εＦＳ«≧⁺×ε⊕⌕γιζ≧×Ｌγε≔Φγ¬⁼κιγ»Ｗζ«§δ⊖ζ≔÷⊖ζ⁹⁵ζ»»«Ｆ⮌Ｓ≔⁺×⁹⁵ζ⊕⌕γιζＷζ«≦⊖ζ§γζ≔Φγ¬⁼κ§γζγ≧÷⊕Ｌγζ

Try it online! Link is to verbose version of code. Explanation:
≔⁰ζ

Set z, which represents the permutation index, to zero, as both sides of the condition need it.
¿Ｎ«

If the first input (as a number) is non-zero, then we're doing encoding.
≔γδ

Save a copy of the predefined ASCII character set g in d, as we need to change it.
≔¹ε

Assign 1 to e. This represents the place value of each encoded character.
ＦＳ«

Loop over the encoded characters.
≧⁺×ε⊕⌕γιζ

Update the permutation index.
≧×Ｌγε

Update e with the place value of the next encoded character.
≔Φγ¬⁼κιγ»

Remove the character from the encoding set.
Ｗζ«

Repeat while the permutation number is non-zero.
§δ⊖ζ

Print the next decoded character.
≔÷⊖ζ⁹⁵ζ»»

Divide the bijective representation by 95. This completes decoding.
«Ｆ⮌Ｓ

Loop over the plain text in reverse, to avoid having to calculate the powers of 95.
≔⁺×⁹⁵ζ⊕⌕γιζ

Convert the plain text as bijective base 95 to the permutation index.
Ｗζ«

Repeat while the permutation index is non-zero.
≦⊖ζ

Decrement the permutation index.
§γζ

Print the next encoded character.
≔Φγ¬⁼κ§γζγ

Remove that character from the encoding set.
≧÷⊕Ｌγζ

Divide the permutation index by the previous length of the encoding set.

Haskell, 346 472 bytes
After fixing of the bug noticed by Anders Kaseorg the program unfortunately grew larger.
(x:y)?f|f x=(0,x)|0<1=(p+1,q)where(p,q)=y?f
a!n=take n a++drop(n+1)a
x#f=fst$f?(x==)
a x y z=y!!(q z-1)+b z s x
b[]_ _=0
b(x:y)f c=u(x#f)+v f*(b y(c f x)c)
c=const
e=divMod
f n|n<2=1|1<2=n*f(n-1)
g y z x=h(x-r)l s y where(l,r)=z?(x<)
h n l f c|l<1=[]|0<1=f!!w m:h d(l-1)(c f m)c where(d,m)=n`e`v f
i=r(k^)
k=95
o=r(\x->f k`div`f(k-x))
q=length
r f=scanl(+)0$map f[1..k]
s=[' '..'~']
u=toInteger
w=fromInteger
v=u.q
x=g(\a->(\b->a!w b))o.a c i
y=g c i.a(\a->(\b->a!(b#a)))o

Try it online!
Use x "Hello World" to encode and y "TR_z" to decode.
How?
We can enumerate all possible input sequences and all possible encoded sequences, so the encoding is rather simple:
1) determine the number for the input sequence;
2) construct the output sequence corresponding to that number.
(The decoding is done in the reverse order).
Explanation
This is an original (pre-golf) version for ease of understanding.
-- for ord
import Data.Char

-- all possible characters
s = [' ' .. '~']

-- get the first position in a list where the predicate returns True
(x:y) `firstPosWhere` fn
    | fn x = 0
    | 0<1 = 1 + firstPosWhere y fn

-- the same as above but return both the position and the list element
(x:y) `firstPosAndElemWhere` fn
    | fn x = (0, x)
    | 0 < 1 = (p + 1, q) where (p, q) = firstPosAndElemWhere y fn

-- the sets of numbers corresponding to input strings and to encoded strings are divided into ranges
inputRanges = scanl (+) 0 [95 ^ x | x <- [1..95]]
outputRanges = scanl (+) 0 [fac 95 `div` fac (95 - x)  | x <- [1..95]]

-- convert an input string into a number
toN s = inputRanges !! (length s - 1) + toN' s
toN' [] =0
toN' (x:y) = toInteger (ord x - 32) + 95 * toN' y

-- convert a number into an (unencoded) string
fromN n = fromN' (n - r) l where
    (l, r) = inputRanges `firstPosAndElemWhere` (n <)
    fromN' n l
        | l < 1 = []
        | 0 < 1 = s !! fromInteger m : fromN' d (l - 1) where
            (d, m) = n `divMod` 95

-- factorial
fac n|n<2=1|1<2=n*fac(n-1)

-- remove nth element from a list
a `without` n = take n a ++ drop (n + 1) a

-- construct an encoded string corresponding to a number
encode n = encode' (n - r) l s where
    (l, r) = outputRanges `firstPosAndElemWhere` (n <)
    encode' n l f
        | l < 1 = []
        | otherwise = (f !! m') : encode' d (l - 1) (f `without` m') where
            (d, m) = n `divMod` (toInteger $ length f)
            m' = fromInteger m

-- convert an encoded string back into number
decode z = r + decode' z s  where
    r = outputRanges !! (length z - 1)
    decode' [] _ = 0
    decode' (x:y) f = toInteger p + (toInteger $ length f) * (decode' y (f `without` p)) where
        p = f `firstPosWhere` (x ==)

('~' <$ [1..75]) ## 0 gives a division by zero exception. (The string of ~s in your tests is only 65 long, and the string you label as “Longer Than 75” isn’t.)

Clean, 182 bytes
import StdEnv,Data.List
$b s=hd[v\\(u,v)<-if(b)id flip zip2(iterate?[])[[]:[p\\i<-inits[' '..'~'],t<-tails i,p<-permutations t|p>[]]]|u==s]
?[h:t]|h<'~'=[inc h:t]=[' ': ?t]
?[]=[' ']

Try it online!
Enumerates every valid encoding and every valid message, returning one or the other depending on the order of the arguments zip2 receives. Explained:
$ b s                         // function $ of flag `b` and string `s` is
 = hd [                       // the first element in the list of
  v                           // the value `v`
  \\ (u, v) <-                // for every pair of `u` and `v` from
   if(b)                      // if `b` is true
    id                        // do nothing
    flip                      // otherwise, flip the arguments to
   zip2                       // a function which creates pairs applied to
    (iterate a [])            // repeated application of ? to []
    [[]: [                    // prepend [] to
     p                        // the value `p`
     \\ i <- inits [' '..'~'] // for every prefix `i` in the character set
     , t <- tails i           // for every suffix `t` of `i`
     , p <- permutations t    // for every permutation of the characters in `t`
     | p > []                 // where `p` isn't empty
    ]]
   | u == s                   // where the second element `u` equals `s`
  ]
? [h: t]                      // function ? of a list
 | h < '~'                    // if the first element isn't a tilde
  = [inc h: t]                // increment it and return the list
 = [' ': ? t]                 // otherwise change it to a space
? []                          // function ? when the list is empty
 = [' ']                      // return a singleton list with a space

It's really, really slow! Faster (in practice) version below (but with similar time complexity):
import StdEnv,Data.List,Data.Func,StdStrictLists,StdOverloadedList

increment :: [Char] -> [Char]
increment []
    = [' ']
increment ['~':t]
    = [' ':increment t]
increment [h:t]
    = [inc h:t]

chars =: hyperstrict [' '..'~']

? :: *Bool [Char] -> [Char]
? b s
    = let
        i :: *[[Char]]
        i = inits (chars)
        t :: *[[Char]]
        t = filter (not o isEmpty) (concatMap tails i)
        p :: *[[Char]]
        p = concatMap permutations t
    in (if(b) encode decode) [] [[]:p]
where
    encode :: [Char] *[[Char]] -> [Char]
    encode d l
        | d == s
            = Hd l
        | otherwise
            = encode (increment d) (Tl l)
    decode :: [Char] *[[Char]] -> [Char]
    decode d l
        | Hd l == s
            = d
        | otherwise
            = decode (increment d) (Tl l)

Try it online!

Jelly, 32 28 27 bytes
ØṖµœ!95Ż¤,ṗ75Ż¤$Ẏ€³œ?µḢi⁴ịḢ

Try it online!
Since this code generates all the permutations and therefore would take very long to finish, TIO link is to a limited version that supports characters abcdefg, message length 4 and encoded length 5. I checked that these numbers follow similar constraints as the actual ones. Only the constants are changed, so the true version should also (theoretically) work.
Explanation
ØṖµœ!95Ż¤,ṗ75Ż¤$Ẏ€³œ?µḢi⁴ịḢ   Dyadic link that accepts the boolean flag and message
ØṖ                            ASCII printable characters
  µ                           Feed into new monadic chain
   œ!                         Permutations of size
     95Ż¤                     0..95
         ,     $              Pair with
          ṗ                   Cartesian power
           75Ż¤               0..75
                Ẏ€            Flatten both lists (non-recursively)
                  ³œ?         Reverse the pair if the boolean flag is set
                     µ        Feed into new monadic chain
                      Ḣ       Pop first item of the pair
                       i⁴     Find index of the message
                         ịḢ   Index into the head of what used to be the pair

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Are all three integers distinct?
You will be given 3 integers as input. The inputs may or may not be
 different from each other.
You have to output 1 if all three inputs
 are different from each other,
and 0 if any input is repeated more
 than once.
This is code-golf, so make your code as short as possible!

Welcome to PPCG. Nice first challenge. We are quite strict about objective winning criteria on this site. [tag:code-golf] seems to be the obvious choice here, so I will add that to your post. Correct me if I'm wrong.

Some test cases would be nice.

Whoever is downvoting all answers should at least explain why...

@Adám I think a more accurate title would be Are all three integers distinct?

@Arnauld Yes, you're right. Fixed.

My dupe-vote is  a hammer, but Possible duplicate of "Determine if all decimal digits are unique" Slightly different, but most answers can still be ported.

@Adám According to the meta consensus, we should tell the OP to add the winning criteria themself.

its not a duplicate, the small amount of input yields to different solutions. id wager if you asked this to electrical engineers youd get a whole different approach to the answer (primarily due to the small number of inputs).. i realize the golfing languages all have de-dup but there is still something to be said for the 'normal' languages and what people's backgrounds are.

Python 3, 23 21 20 bytes
lambda*a:len({*a})>2

Try it online!

OP asked for 1 vs. 0, so maybe you need one more byte: lambda*a:len({*a})//3

@tsh in Python 1 == True, I think there's a meta post about it somewhere

@tsh - relevant meta "if it quacks like a number, it's a number" - in Python: False * True is 0; False + True is 1; etc...

From the relevant meta: "this does not apply to challenges where an exact string output is required", so I'm not sure what really applies here.

Perl 6, 7 bytes
*.Set>2

Try it online!

R, 13 bytes
A different solution to @Kirill by using mad() for an unintended purpose!
mad(scan())>0

Try it online!

Well input is not specified at all, so IMO accepting 3 values as input means we can accept a vector

R almost competing with golf languages ! :D

I believe Gauss invented mad exactly for this purpose.

JavaScript, 22 bytes
If we can output boolean values then the last 2 bytes can be removed.
a=>new Set(a).size>2&1

Try it online
For the same byte count, this works on arrays of any size but assumes the input will never contain a 0 and output is a boolean.
a=>!a[new Set(a).size]

Try it online

Assuming that we can take the input as an array and return a Boolean: a=>new Set(a).size>2

@Arnauld, yeah I had that too but as it stands the spec won't allow it - will be updating if the spec changes, though.

Oh, wait. I can just tack on &1 for 22 bytes.

R, 24 22 20 bytes
all(table(scan())<2)

Try it online!
Returns a boolean, but as folks have already discussed on the Python answer, this should be OK.
Thanks to digEmAll for saving 2 bytes.

20 bytes porting the R solution to a very similar question

11 bytes - if you are allowed to have any number > 0 as truthey. Otherwise, append >0 for TRUE/FALSE output in 13 bytes.

Wow, didn't even know about this function. I'd suggest you post it separately (edit and revive your deleted answer), but I think you have to stick with 13 bytes - while T/F indeed acts like 1/0, 1.48 doesn't.

Ruby, 16 bytes
->a{1-(a<=>a|a)}

Try it online!

-3 bytes with uniq!

Boolean and Integer are different types in Ruby.

Ah, you're right. I didn't read the challenge closely enough, and assumed a truthy/falsey output would suffice.

Cubix, 55 25 bytes
-29 thanks to Jo King
O@O1u|@O@II-!/;I-!/;u^?-p

Try it online!
It should be possible to golf off quite a few bytes.

26 bytes

Thanks a lot. I managed to shave off 1 more byte to arrive at 25 bytes in total

I think you might be missing a @ in place of the . in the 9th spot.  Makes it do some funky things for 1 2 2.

05AB1E, 2 bytes
ÙQ

Try it online or verify some more cases.
Explanation:
Ù     # Uniquify the (implicit) input
 Q    # Check if it's still equal to the (implicit) input

Using standard truthy/falsy rules for [tag:decision-problem], keeping in mind that 1 is the only truthy value in 05AB1E, ¢P works as well as an alternative 2-byter.

@Mr.Xcoder I'm not sure that's actually currently valid - the question asks for outputs 1 and 0 - 4, for example, is neither 1 nor 0, nor does not act like 1 or 0 (like True and False do in Python). The question should probably ask for Truthy/Falsey but at present it does not.

Mathematica, 13 bytes
Boole[E!=##]&

Pure function. Takes three integers as input and returns 0 or 1 as output. I know that this is rather similar to David G. Stork's answer, but it exploits SlotSequence to shave off a byte (as compared to Boole@*Unequal).

J, 4 bytes
-:~.

Try it online!
Explanation:
Is the argument equal -: to itself after removing the duplicates ~.

K (oK), 4 bytes
3=#?

Try it online!
Does the count of the distinct elements equal 3?

brainfuck, 91 bytes
,>,>,[-<-<->>]>>+++++++[>+++++++<-]+<<<<[>]>>[<<<[-<->]<[>]>>->[>.<<<->>-]<+]<+[>>>[>]<-.>]

Try it online!
How it works
,>,>,                   'read input as A, B, and C
[-<-<->>]>>+            'compute A-C, B-C
++++++[>+++++++<-]+     'prepare output
<<<<[>]>>               'if A-C != 0 && B-C != 0
[
    <<<[-<->]           'compute A-B
    <[>]>>->            'if A-B != 0
    [>.<<<->>-]         'print 1
    <+
]
<+
[                       'else (this else is for both of the if statements, even though they are nested... wierd, I know)
    >>>[>]
    <-.>                'print 0
]

Japt -N, 3 bytes
eUâ

Try it

Explanation
Uâ deduplicates the input and e tests if it's equal to the original.

C (gcc), 25 26 bytes
f(a,b,c){a=a-b&&a-c&&b-c;}

Try it online!

Fails on [4,2,3]

@GB Quite right!

Powershell, 27 25 bytes
-2 bytes thanks @AdmBorkBork
+!(($args|group).Count-3)

Test script:
$f = {
+!(($args|group).Count-3)
}

&$f 1 2 3
&$f 3 2 1
&$f 2 1 3
&$f 2 2 3
&$f 2 1 1
&$f 2 1 2

Explanation:
    $args|group           # Group arguments
   (           ).Count    # Count of groups
  (                   -3) # is 0 if inputed integers are unique
 !                        # operator not converts int to boolean: true if integers are unique
+                         # converts boolean to int: 1 if integers are unique, otherwise 0

26 bytes -- +(($args|group).count-eq3)

Jelly, 2 bytes
QƑ

Try it online!

Common Lisp, 25 2 bytes
/=

Try it online!
-23 bytes thanks to @ceilingcat!

Jelly, 5 6 bytes
ɠḲQL=3

Try it online!
From 5 to 6 bytes because this is my first time and I messed up (whoops) fixed it now
ɠḲQL=3
^^^^^
||||Is it equal to three?
|||How many unique numbers do we have? (length of unique numbers array)
||Sort By Unique
|Split by Spaces
Read Input

Hello and welcome to PPCG. Does your code also work for 3 integers, or is it only functional for three digits?

@Jonathan Frech Sadly, it only works for three 1 Digit numbers, it does this by sorting the input by unique characters, then testing if the amount of unique characters is the same length as the input. Maybe there is a way to get it to work with any 3 integers, but I think this is a good attempt for me at least!

The challenge specifies You will be given 3 integers as input. which seems to render your answer invalid.

@JonathanFrech Fixed it now! Was my first time doing this sort of thing so, I'm not the greatest at it.

Pyth, 3 bytes
s{I

Takes input as a list.
Try it here
Explanation
s{I
 {IQ     Check if the (implicit) input is invariant under deduplication.
s        Cast to int.

If we're allowed to treat True and False as 1 and 0 (which they are under the hood in Pyth), we can drop the s to get down to 2 bytes.

SmileBASIC, 25 24 bytes
READ A,B,C?A-B&&B-C&&C-A

APL (Dyalog Unicode), 3 bytesSBCS
Anonymous tacit prefix function. Takes list as argument.
∪≡⊢

Try it online!
∪ does the set of unique elements from the argument
≡ match
⊢ the unmodified argument?

Clean, 32 bytes
import Data.List
$l|hasDup l=0=1

Try it online!

Java 9, 43 27 bytes
thanks to @Olivier Grégoire
(a,b,c)->a!=b&b!=c&a!=c?1:0

Previous attempt:
(a)->a[0]==a[1]||a[0]==a[2]||a[1]==a[2]?0:1

Why not count it as 43 bytes

27 bytes: (a,b,c)->a!=b&b!=c&a!=c?1:0.

Also, the first code (100 bytes) doesn't compile and uses == which is not applicable on String without issues which you encounter here (after compilation fix), and in the second code, Set.of method will throw IllegalArgumentException if any duplicate is provided. I'm tempted to -1 for not testing at all.

@olivier Apologies-it was late and I mixed up a few different ideas in my head. As for Set.of, I was just experimenting with Java 9 kinks and don’t have Java 9 myself. I should’ve read the documentation more carefully, sorry about that. I’ll edit once I get on my computer.

Attache, 10 bytes
`==#Unique

Try it online!
This is a fork of the operator `== and Unique, equivalent to:
{ _ == Unique[_] }

Alternatives
{#_=#Unique[_]} (15 bytes)
Any##Same=>Pairs@Sort (21 bytes)
Any@{`=&>_[[0'1,1'2,2'0]]} (26 bytes)
&${not(x=y or y=z or x=z)} (26 bytes)
&${x/=y and y/=z and x/=z} (26 bytes)
{Any!Same=>Chop&2!_[0'1'1'2'2'0]} (33 bytes)

><>, 19 17 bytes
-2 bytes by Jo King.
:{:{:{=}=}=++0=n;

Try it online!

17 bytes

I should have definitely caught that, thanks!

@RushabhMehta Please do not golf other user's posts using other user's golfing suggestions.

Ruby, 11 bytes
->a{a==a|a}

Try it online!
Assuming we can return a boolean. Which everyone is doing nowadays.

Brachylog, 6 bytes
d?∧1|0

Try it online!
short explanation
d? deduplcates input an test if still equal to input(?)
∧1 if true return 1
|0 else return 0

Red, 21 bytes
func[b][b = unique b]

Try it online!

T-SQL, 39 bytes
SELECT IIF(a=b OR b=c OR c=a,0,1)FROM s

Input is taken as separate columns a, b, c from a pre-existing table s, per our IO standards.
Tried a variation using COUNT DISTINCT from input taken as separate rows, but that was a couple bytes longer.

JavaScript (Node.js), 67 bytes
f=a=>a.map((m,i)=>a.map((n,j)=>m==n&i!=j).every(z=>!z)).every(y=>y)

Try it online!

Sorry, but J answer is already here and the code is exactly the same.

my bad @Bubbler didn't see that coming.

changed to JS answer

@Bubbler Duplicate entries are not disallowed.

q 14 bytes
{x~distinct x}

Technically this solution will return '1b' or '0b', which is the way a boolean value is distinguished  from a numeric type, though it retains all arithmetic functionality, and so is in essence a 1 or 0:
q)1b +35
36

To return 1 or 0 non-boolean you have the below, which takes the byte count to 21
{$[x~distinct x;1;0]}

{1&/0N>':x?x}

PHP, 38 bytes
echo(4==count(array_unique($argv)))*1;

Called with e.g. php codegolf.php 2 3 4. $argv always contains the filename of the script, hence 3 unique numbers make 4 elements.

Vyxal, 1 byte
≠

Try it Online!
Easy peasy

Julia 1.0, 18 11 bytes
~x=x==x∪x

Try it online!
-7 bytes (!!) thanks to MarcMush: replace length(x∪x)>2 with x==x∪x

I think x∪x==x works

Julia 1.0, 24 bytes
f(x...)=length(Set(x))>2

Try it online!

Triangularity, 17 bytes
..i..
.MiC.
}u)3=

Try it online!
How it works
Excluding the mandatory triangular padding, we're left with:
iMiC}u)3=

Which can minimally be explained as: Push all STDIN as an array of strings (representing each line of  input), count the occurrences of all of STDIN's elements in itself (which, in case all are distinct, should yield [1, 1, 1]), sum, then check whether the sum is equal to 3. There are 2 tricks here (which together save no less than 14 bytes):

Using i and treating the inputs as strings rather than integers – which is quite uncommon, as )IE is frequently used instead, taking input as a list.
Instead of checking whether they all are equal to 1 and then taking the product – or equivalently, taking the product and checking whether it is equal to 1 – this takes the sum and compares it with 3. Proving the validity of this method is obviously trivial: [1, 1, 1] is the only valid way to partition 3 into 3 positive integers summing to it and the contents of this list are always positive, as every element of a collection must occur at least once in it :P.

Charcoal, 14 bytes
≔Ｅ³ＮθＩ¬⊖⌈Ｅθ№θι

Try it online! Link is to verbose version of code. 5 bytes could be saved by using a slightly non-standard input format [[x, y, z]]. Explanation:
≔Ｅ³Ｎθ

Input 3 numbers and make a list.
Ｉ¬⊖⌈Ｅθ№θι

Count the number of occurrences of each number in the list. Take the maximum, subtract 1, take the logical not, then cast to string for implicit print.

PHP, 30 bytes
<?=array_unique($argv)==$argv;

takes input from command line arguments; prints 1 for truthy, empty string for falsy

Flobnar, 25 bytes
$-<*\\\!!@
::*<&&&
-$$>
$

Try it online!
Given integers a,b,c, evaluates !!((c-b)*(b-a)*(c-a))

C (gcc), 50 41 bytes
-9 bytes thanks to GB !
m(int*a){a=*a==a[2]^*a==*++a^*a==*++a^1;}

Try it online!
No built-in sets in C, and iterating is too long, but at least i can shave off a few bytes by taking advantage of the fact that *a == a[0] ...

41 bytes

Thanks, I had thought about incrementing the pointer but couldn't figure out how to make it as short !

SWIFT 37 Bytes
Set(Array(readLine()!)).count==3 ?1:0

Your current answer is a snippet; either put a wrapper around it or call your language Swift REPL.

Stax, 3 bytes
ä▼Z

Run and debug it
Explanation
ux=         #Full program, unpacked, implicit input as array
u           #Keep only unique elements in array, maintaining first order of appearance
 x=         #Copy original input onto stack, is it equal to unique-ified array.

Short and sweet. Wish Stax would implicitly check against "X" register if there was nothing to check against, but it works out regardless.

Pari/GP, 12 bytes
a->#Set(a)>2

Try it online!

Pepe, 85 77 bytes
rEeEREeErrEEEEEeRrEeErrEEEEEerEEEEEEERerEEEEEerRrEEEEEEeErREEREEEEErEeReeReEE

Try it online! Input is a,b,c. Change the "separated by" box to , to make it work!

Rust, 29 23 bytes
|a,b,c|a!=b&&b!=c&&a!=c

Try it online!

Haskell, 26 bytes
g a b c=and$map(==)[a,b,c]

I don't think this works, can you provide an example on how your function is used?

Math++, 40 29 bytes
?>a
?>b
?>c
(a-b)&(b-c)&(a-c)

I think the non-competing rule is a thing of the past.

Also, could you provide an implementation link for Math++?

@JonathanFrech OK, I just added a link to the esolang page; the article includes a link to the reference implementation.

Lua, 38 bytes
x,y,z=...print(x~=y and x~=z and y~=z)

Try it online!

Unfortunately, this doesn't work for the case when y==z (returns true, should be false). You'll need to add a third test to check for that possibility.

Opposed to equality, inequality is not transitive, so $x\neq y\neq z$ does not imply $x\neq z$.

Your answer in its current form is invalid. Please either fix or delete it.

Thank you guys, I really didn't noticed it.

C (clang), 32 bytes
f(a,b,c){return a!=b&b!=a&a!=c;}

Try it online!

The integers 0, 1, 2 are distinct, yet 0&... = 0.

f(a,b,c){return a-b&&b-a&&a-c;}

b-a=>b-c mistake from your code

JavaScript, 25 24 28 27 23 bytes
Using bitwise, comparison and logical operators Try it online!
(4 bytes saved courtesy of Jonathan Frech)
(a,b,c)=>a!=b&a!=c&b!=c

You can pull the 1^ inside the parentheses, changing == to != and | to & and then remove said parentheses to save four bytes.

@JonathanFrech Updated

MathGolf, 2 bytes
▀=

Try it online!
Explanation
▀    Get unique elements
 =   Check if equal to the input

Braingolf, 5 bytes
ul3-n

Try it online!
Edit: fixed from identical -> distinct

Pyth, 5 bytes
s<2l{

Try it online!
Looks like someone already did pyth but I didn't know about the I for testing invariants.

Rust, 17 bytes
Anything XORd with itself yields zero. So. Any language with multiplication and XOR can do this:
(a^b)*(b^c)*(a^c)

Since input specifics were rather vague I chose a liberal interpretation. Or if you want to be more strict, we can define it as a closure (kind of like a lambda function),
24 bytes
|a,b,c|(a^b)*(b^c)*(a^c)

Try it on the Rust Playground

Husk, 3 bytes
S=U

Try it online! Takes the three numbers in a list.

Dash, 27 24 bytes
$(($1-$2&&$2-$3&&$3-$1))

Try it online!
Sorry for a boring answer; at first if bashism would work, but I could not get out of POSIXism.
The code above evaluates to a string of either 0 or 1.

Pxem, Filename: 28 bytes + Content: 0 bytes = 28 bytes.

Filename: ._._._.e.z.c.c.z1.o.d.a.a0.o
Content: enpty.

Try it online! (with pxem.posixism)
With comments
XX.z
# for three times; do push( read integer); done
.a._._._XX.z
# call subroutine
## NOTE. When DOT-e is performed when stack is a,b,c,bottom,
## then subroutine begins with same content of stack
## And when subroutine ends when stack is d,e,f,bottom,
## then previous stack would be d,e,f,a,b,c,bottom
## to continue origimal procedure
## In this program content is empty, so is subroutine
## thus x,y,z,bottom to x,y,z,x,y,z,bottom,
## which duplicates entire stack
.a.eXX.z
# while size < 2 && pop != pop; do
.a.zXX.z
  # dup; dup; while size<2 && pop!=pop; do
  ## this is equal to while stack is empty; do
  .a.c.c.zXX.z
    # push '1'; putc pop; exit
    .a1.o.dXX.z
  # done
  .a.aXX.z
# done
.a.aXX.z
# push '0'; putc pop; (implicity) exit
.a0.oXX.z
.a

Factor, 11 bytes
all-unique?

Try it online!

K (ngn/k), 10 bytes
{(#x)=#?x}

Try it online!
A little bit more interesting answer in my opinion, but still boring. Takes a list of integers as input.
Explanations:
{(#x)=#?x}  Main function. x is input
       ?    Unique (Remove all duplicated elements)
      #     Length
     =      Is it equal to
 (#x)       The length of x itself

Pascal, 91 B
This is a complete program conforming to ISO standard 10206 “Extended Pascal” and at 91 bytes certainly more readable than brain****.
program p(input,output);var x,y,z:integer;begin read(x,y,z);write(ord(card([x,y,z])=3))end.

The [x,y,z] denotes a set, thus duplicate values get collapsed.
This means, the set literal [4, 4, 4] is identical to [4].
The card function returns the number of distinct elements in the set.
Here this will be anything between 1 and 3 inclusive.
We test for equality to 3 (… = 3) which evaluates to a Boolean expression (denoted by the built-in constants false and true) and convert this enumeration value into an integer using ord.

Pyt, 6 bytes
ĐỤ=Ʃ3=

Try it online!
Đ         implicit input; Đuplicate
 Ụ        get Ụnique items
  =       is equal element-wise?
   Ʃ      Ʃum of list (coerce booleans to ints)
    3=    is equal to 3?; implicit print

Alice, 22 bytes
3&/ M \.!-~?-Zn'0+O@

Try it online!
3&/ M \                   Reads the three arguments and puts them on the stack
       .!-~?-             Compares the two last arguments, then the first with the last
                          It leaves [0, 0] on the stack if the two numbers are the same
                          Otherwise any other pair of numbers
             Z            Packs the two numbers together [0, 0] yields 0
              n           Logical not, if the pack result is 0 return 1 and any other number returns 0
               '0+O@      Output and bye

Piet + ascii-piet, 37 bytes (24×2=48 codels)
TAbTlTiTrTtTLDqMmMEuAkAaAqQIBSAMVcRrr

Try Piet online!
Probably not the golfiest that could happen but manipulating the stack order in Piet is a bit of a pain.
Pointer Path

GolfScript, 4 bytes
..|=

Try it online!
Input is taken as an array of three numbers
Explanation
..|=
 .|  # Setwise OR the input array with itself
.  = # Is it equal to the initial input?

Thunno 2, 2 bytes

U⁼: Attempt This Online!

ċ⁼: Attempt This Online!

ȯ⁼: Attempt This Online!

Explanation
U   # Uniquify the input list
ċ   # Or, take the set union of the input list with itself
ȯ   # Or, take the set intersection of the input list with itself
 ⁼  # Then, check if this new list is equal to the input list

Of all of these, only U⁼ and ċ⁼ seem to be valid; the question asks if all are distinct, while you are checking if they aren't all equal, which fails for inputs like [123, 123, 456]

@noodleman oh yeah, thanks for telling me. ȯ⁼ works as well btw.

Python 2
def e(a,b,c):return 1 if len(set([a,b,c]))>2 else 0

...could be shortened to
def e(a,b,c):return len(set([a,b,c]))>2

I'm afraid you misunderstood the task. Your code should check whether all 3 integers are distinct not identical.

what if a==b but a!=c?

I'm afraid that is not all. Now it says correctly that 1,1,1 is false (not all distinct) and 1,2,3 is true (all distinct), but for 1,2,2 gives also true, though they are not all distinct.

Fixed it with a set. Should be working correctly now.

@Milbrae I think your ternary if is nigh a no-op.

if the 3 integers are provided in a list: lambda a:len(set(a))>2

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Multi-dimensional reversal
Given an N-dimensional orthogonal (non-ragged) array of non-negative integers, and an indication of which dimensions to reverse, return the array but reversed along those dimensions. The indication may be given as a Boolean list of length N or a list of a subset of the first N dimensions indexed from 0 or 1.
Please state your input formats. Code explanations are much appreciated.
Walked-through example
We are given the 2-layer 3-row 4-column 3D-array
[[[ 1, 2, 3, 4],
  [ 5, 6, 7, 8],
  [ 9,10,11,12]],

 [[13,14,15,16],
  [17,18,19,20],
  [21,22,23,24]]]

and one of
[true,false,true] (Boolean list)
[0,2] (0-indexed list)
[1,3] (1-indexed list)
We need to reverse order of the first and last dimensions, that is the layers and the elements of the rows (the columns), but not the rows of each layer. First (the actual order you do this in does not matter) we reverse the order of the layers:
[[[13,14,15,16],
  [17,18,19,20],
  [21,22,23,24]],

 [[ 1, 2, 3, 4],
  [ 5, 6, 7, 8],
  [ 9,10,11,12]]]

and then we reverse the order of the elements of each row:
[[[16,15,14,13],
  [20,19,18,17],
  [24,23,22,21]],

 [[ 4, 3, 2, 1],
  [ 8, 7, 6, 5],
  [12,11,10, 9]]]

Test cases
[[[1,2,3,4],[5,6,7,8],[9,10,11,12]],[[13,14,15,16],[17,18,19,20],[21,22,23,24]]]
[true,false,true]/[0,2]/[1,3]
 ↓
[[[16,15,14,13],[20,19,18,17],[24,23,22,21]],[[4,3,2,1],[8,7,6,5],[12,11,10,9]]]

[[1,2,3],[4,5,6]]
[true,false]/[0]/[1]
 ↓
[[4,5,6],[1,2,3]]

[[1],[4]]
[true,false]/[0]/[1]
 ↓
[[4],[1]]

[[7]]
[true,true]/[0,1]/[1,2]
 ↓
[[7]]

[1,2,3,4,5,6,7]
[true]/[0]/[1]
 ↓
[7,6,5,4,3,2,1]

[]
[true]/[0]/[1]
 ↓
[]

[[],[]]
[false,false]/[]/[]
 ↓
[[],[]]

[[[[3,1,4,1],[5,9,2,6]],[[5,3,5,8],[9,7,9,3]]],[[[2,3,8,4],[6,2,6,4]],[[3,3,8,3],[2,7,9,5]]]]
[true,false,true,true]/[0,2,3]/[1,3,4]
 ↓
[[[[4,6,2,6],[4,8,3,2]],[[5,9,7,2],[3,8,3,3]]],[[[6,2,9,5],[1,4,1,3]],[[3,9,7,9],[8,5,3,5]]]]

[[[[3,1,4,1],[5,9,2,6]],[[5,3,5,8],[9,7,9,3]]],[[[2,3,8,4],[6,2,6,4]],[[3,3,8,3],[2,7,9,5]]]]
[false,true,false,false]/[1]/[2]
 ↓
[[[[5,3,5,8],[9,7,9,3]],[[3,1,4,1],[5,9,2,6]]],[[[3,3,8,3],[2,7,9,5]],[[2,3,8,4],[6,2,6,4]]]]

[[[[3,1,4,1],[5,9,2,6]],[[5,3,5,8],[9,7,9,3]]],[[[2,3,8,4],[6,2,6,4]],[[3,3,8,3],[2,7,9,5]]]]
[false,false,false,false]/[]/[]
 ↓
[[[[3,1,4,1],[5,9,2,6]],[[5,3,5,8],[9,7,9,3]]],[[[2,3,8,4],[6,2,6,4]],[[3,3,8,3],[2,7,9,5]]]]

I feel like the hardest part in most statically typed languages will be golfing the type signatures involved.

@Οurous How do those languages normally deal with arbitrary array data?

there's three cases for "normal" use as I see it: only worrying about one level of the array (eg: reverse works on arbitrary arrays but only cares about the first level), generics, or recursive classes (type / object classes depending on functional or OOP, but similar use-case). The latter two are usually far more verbose.

Can we store the matrix as arrays of pointers to pointers (in C or asm), instead of proper multi-dimensional arrays where everything is contiguous in memory?  I'm pretty sure all the normal higher-level / dynamically-typed languages with arbitrary nesting of lists are already treating things as lists of lists, not matrices, so I'm going to assume it's fine.

@PeterCordes Sure, go ahead.

APL (Dyalog), 20 9 bytes
⊃{⌽[⍺]⍵}/

Try it online!
How?
/ - reduce - take the rightmost element in the input (the array) and apply the function with next left element as left argument
{⌽[⍺]⍵} - reverse in the left argument (⍺) dimension
⊃ - flatten the enclosed array

APL (Dyalog Unicode), 9 bytes
⊃{⊖[⍺]⍵}⌿

Try it online!
It looks like Uriel edited into something almost identical first, but I developed it independently. I thought this input format is invalid.

JavaScript (Node.js), 58 55 53 45 bytes
Saved 8 bytes thanks to @Shaggy
Takes input as (indications)(array), where indications is a Boolean list.
f=([r,...b])=>a=>1/r?a.sort(_=>r).map(f(b)):a

Try it online!
Commented
f = (                // f is a function taking:
  [r,                //   r = next 'reverse' Boolean flag
      ...b]          //   b = array of remaining flags
) =>                 // and returning an anonymous function taking:
  a =>               //   a = array (or sub-array) to process, or atomic element
    1 / r ?          // if r is defined:
      a.sort(_ => r) //   reverse a if r = 1; leave it unchanged otherwise
      .map(f(b))     //   for each element in the resulting array: do a recursive call,
                     //   using f to generate a new callback function for the next flag
    :                // else:
      a              //   a must be an atomic element and is simply left unchanged

Just using r inplace of r||-1 seems to work.

Would f=([r,...b])=>a=>1/r?a.sort(_=>r).map(f(b)):a work? On my phone so can't test properly.

@Shaggy Nice! I like this rather unusual processing flow.

Python 2, 56 55 bytes
f=lambda a,t:t and[f(l,t[1:])for l in a][::1|-t[0]]or a

Try it online!

Haskell, 120 119 bytes
the function f takes the N-dimensional list and a list of bool as input
class F r where f::[Bool]->r->r
instance F Int where f=seq
instance F r=>F[r]where f(a:y)=last(id:[reverse|a]).map(f y)

You don't need parentheses around F r.

TIO link with test cases and OJ's 1-byte golf.

Jelly, 8 bytes
”€ẋ”ṚpFv

Takes a 0-indexed list of dimensions.
Try it online!
How it works
”€ẋ”ṚpFv  Main link. Left arg: D (dimensions, 0-based), Right arg: A (array)

”€ẋ       Repeat '€' d times, for each d in D.
   ”Ṛp    Perform Cartesian product of ['Ṛ'] and each string of '€'s, prepending a
          'Ṛ' to each string of '€'s.
      F   Flatten the result.
          If, e.g., D = [0,2,4], we build the string "ṚṚ€€Ṛ€€€€".
       v  Eval the resulting string, using A as left argument.

That's horrible. Very nice!

R, 80 78 77 bytes
Create the call to R's extractor [ by creating a list of sequences reversed where indicated. They actually contain zeros, which are silently ignored. The drop=F is needed to prevent R's default dropping of dimensions. We need the rev call to the dimension reverse indicator, because of the way R fills arrays.
-2 thanks @Giuseppe
-1 using in-line assignment.
function(x,a,d=dim(x))do.call("[",c(list(x),Map(seq,r<-d*rev(a),d-r),drop=F))

Try it online!
Honorable mention to @JayCe who came up with a variation that gets the same result in the same length:
function(x,a,d=dim(x))array(x[t(t(expand.grid(Map(seq,r<-d*rev(a),d-r))))],d)

Try it online!

78 bytes very nice answer!

Very profound answer. It took me a while to understand it completely. I tried replicating it without using do.call - it's longer at 83 bytes, still posting this here as a comment for reference: TIO

Well actually, @JayCe, your great answer can also be golfed to 78 bytes!

05AB1E, 23 11 10 bytes
'€s×'R«J.V

Try it online.
-12 bytes thanks to @Mr.Xcoder.
Input as 0-indexed truthy-values (i.e. [0,2,3]), which is the first input.
Explanation:
'€s×           # Repeat "€" the indices amount of times
               #  i.e. [0,2,3] → ["","€€","€€€"]
    'R«        # Append each with "R"
               #  i.e. ["","€€","€€€"] → ["R","€€R","€€€R"]
        J      # Join them all together
               #  i.e. ["R","€€R","€€€R"] → R€€R€€€R
         .V    # Execute string as 05AB1E code

For example: if the indices input-list is [0,2,3], it will create the following string:
R€€R€€€R

Which will:
    €€€R    # Reverse the items in the most inner (4th level) lists
 €€R        # Reverse the most inner (3rd level) lists themselves
            # Do nothing with the inner (2nd level) lists
R           # Reverse the entire outer (1st level) list

Original 23 byte answer:
ćURvy„ RèJ…εÿ}}„ RXèJ.V

Input as boolean-list (i.e. [1,0,1,1]), which is the first input.
Try it online.
Explanation:
ćU                 # Pop and save the first boolean in variable `X`
  R                # Reverse the remaining boolean-list
   v    }          # Loop `y` over each of them:
    „ Rè           #  Take the string "R ", and index the current boolean (0 or 1) in it
    J              #  Join it together with the string of the previous iteration
    …εÿ}           #  Surround it with "ε" and "}"
         „ RXè     # Index variable `X` also in "R "
              J    # Join it together with the rest
.V                 # Execute string as 05AB1E code

For example: If the boolean input-list is [1,0,1,1], it will create the following string:
εεεR}R} }R

Which will:
  εR}         # Reverse the items in the most inner (4th level) lists
 ε   R}       # Reverse the most inner (3rd level) lists themselves
ε       }     # Do nothing with the inner (2nd level) lists
         R    # Reverse the entire outer (1st level) list

Nice answer, but... uhm... would this 11 byter work?

@Mr.Xcoder Thanks! That's indeed a lot easier. And been able to golf 1 more byte by appending each, instead of prepending and then reversing.

@Mr.Xcoder Btw, why does 'x* work to repeat x n amount of times without using a swap, but it doesn't work with '€*?.. EDIT: Only in the legacy though..

The legacy version is quite buggy, it might be due to the fact that € is still parsed as an operator even though it's in a char literal? Not sure to be honest. In the new version, * doesn't behave the same way nonetheless.

JavaScript (Node.js), 60 bytes
A different (recursive) approach. doesn't beat Arnauld's answer ... yet....
Takes the input as array, boolean list
f=(a,r)=>r>[]?(r[0]?a.reverse():a).map(c=>f(c,r.slice(1))):a

f=(a,r)=>r>[]?(r[0]?a.reverse():a).map(c=>f(c,r.slice(1))):a

console.log(f([[[[3,1,4,1],[5,9,2,6]],[[5,3,5,8],[9,7,9,3]]],[[[2,3,8,4],[6,2,6,4]],[[3,3,8,3],[2,7,9,5]]]],[true,false,true,true]))

Japt, 15 14 bytes
With some inspiration from Arnauld's solution.
Takes the indications as the first input, as a boolean array of 1s and 0s.
Ê?Vn@ÎÃ£ßUÅX:V

Try it

Explanation
                   :Implicit input of boolean array U=indications and multi-dimensional integer array V
Ê                  :Get the length of U
 ?                 :If truthy (i.e., >0)
  Vn               :  Sort V
    @ÎÃ            :   Function that gets the first element of U; 0 will leave the array untouched, 1 will reverse it.
       £           :  Map each X
        ß          :  Run the programme again with the following inputs
         UÅ        :   U with the first element removed
           X       :   X will serve as the new value of V
            :      :Else
             V     :  Just return V

Pyth, 15 bytes
.v+jk.n*\_*L\ME

Try it here!
Annoyingly, handling the empty dimension list case takes no less than 2 bytes... I'd rather use ss in place of jk.n but :| Assumes that the list to be transformed can be given in native Pyth syntax, as a string. I've written a converter to Pyth syntax to make testing easier. In the unfortunate case that the OP chooses not to allow this, a 17-byter will "fix" it:
.v+jk.n*\_*L\ME\E

Clean, 122 112 bytes
import StdEnv
class$r::[Bool]->r->r
instance$r where$_=id
instance$[r]| $r where$[a:y]=if(a)reverse id o map($y)

Try it online!
A version of Damien's Haskell answer using Clean's golfier type system. Really shows the extensive similarities between the two languages.
Explained:
import StdEnv                 // import basic stuff
class $ r :: [Bool] -> r -> r // $ takes a boolean list and returns a function on r to r
instance $ r                  // instance on all types, taken when no more specific instances exist
    where $ _ = id            // return the identity function for all arguments
instance $ [r] | $ r          // instance for lists of a type which has an instance itself
    where $ [a: y]
        = if(a) reverse id    // reverse if the head of the argument is true
            o map ($ y)       // composed with the map function acting on $ applied to the tail

Ruby, 54 bytes
f=->a,d{r,*z=d;r&&a.reverse!;d==[]?a:a.map{|w|f[w,z]}}

Try it online!

Mathematica, 7 bytes
Reverse

Function. Give it a nested list as the first argument, and the 1-based list of levels/dimensions to reverse as the second argument. Try it online!
Finally, another challenge where Mathematica has a builtin!

layers to reverse? TIO link maybe?

@Adám That is, the list of dimensions to reverse, generally referred to as levels in Mathematica.

(untested but I think correct.  compiler asm output looks like what I expect.  Will update if/when I find time to write a test harness that creates and prints this data structure.)
GNU C++ (portable) 148 bytes
#include<algorithm>
#include<cstdint>
struct m{intptr_t d,l,a[];void R(int*r){if(*r)std::reverse(a,a+l);for(int i=0;d&&i<l;((m*)a[i++])->R(r+1));}};

GNU C++ (int=pointer and falls off a non-void function UB) 120 bytes
#include<algorithm>
struct m{int d,l,a[],R(int*r){if(*r)std::reverse(a,a+l);for(int i=0;d&&i<l;((m*)a[i++])->R(r+1));}};

This is a struct of depth counter, length, array of {integers or pointers}.  In the bottom level of this non-binary tree (depth==0), the array of intptr_t is an array of integers.  In higher levels, it's a struct m* stored in intptr_t.  Traversal takes a cast.
The R() reverse function is a member function because that saves declaring an arg, and saves a lot of p-> syntax to reference the struct members vs. the implicit this pointer.
The only GNU extension is the C99 flexible array member to make a variable-sized struct, which is supported in C++ as a GNU extension.  I could have used a *a member pointing to a separately-allocated array and have this be plain ISO C++.  (And that would actually save a byte without requiring any other changes).  I wrote this as a mockup / reference implementation for an asm version.

The shorter version with just int also declares R() as returning int instead of void.  These two bits of hackery are unrelated; this is just the "works on at least one implementation" version.
It should work fine on 32-bit targets (where int can hold a pointer), as long as you compile with gcc7 or older, or disable optimizations.  (gcc8 -O3 assumes that execution can't reach the bottom of a non-void function because that would be UB.)  x86 gcc -m32 -O3 should work fine with gcc7, like on Godbolt where I included both versions (in different namespaces) and a non-member-function version.
Ungolfed
The function arg, int r[], is an array of 0 / non-zero integers that indicate whether a given depth should be swapped, starting with the outer-most level.
#include<algorithm>  // for std::reverse
#include<cstdint>    // for intptr_t.  GNU C defines __intptr_t, so we could use that...

struct m{
    __intptr_t d,l,a[];    // depth = 0 means values, >0 means pointers.
    // l = length
    //__intptr_t a[];  // flexible array member: array contiguous with the struct

    void R(int r[]) {
        if(*r)
            std::reverse(a, a+l);   // *r && std::reverse() doesn't work because it returns void.

        if(d) // recurse if this isn't the bottom depth
            for(int i=0 ; i<l ; i++)  // tree traversal
                ((m*)a[i])->R(r+1);   // with the rest of the depth list
    }

}; // struct m

When we recurse, we pass r+1, so checking the current depth is always *r.
An earlier version just passed r unchanged, and checked r[d].  With a flexible array member, I needed to store some kind of last-level indicator because a[] is not a pointer, it's a true array with no indirection.  But with a intptr_t *a member, I couldn't just have that be nullptr for the leaf level, because I want it to be values.
Reversing the current level before or after the tree traversal shouldn't matter.  I didn't try to do it during.
I'm not sure that std::reverse is worth the byte count vs. a manual loop, especially if I can work in calling R() on each pointer exactly once somewhere inside that loop.  But only if d!=0

Whoa, impressive.

@Adám: thanks, it golfed down surprisingly naturally and well after I wrote it.  I'm curious to see what I can do in x86 machine code :P

Uiua SBCS, 6 bytes
∧(⍉⍥⇌)

Try it!
Takes the array and a mask of which dimensions to reverse like [1 0 1].
∧(⍉⍥⇌)
∧(   )  # fold over mask and array, using array as accumulator
   ⍥⇌   # reverse the array either 0 or 1 times
  ⍉     # transpose


text:
Find the hash in the text

I hate hashes because they remind me of hashtags, help me find them in the input
Input
A piece of text
This is an #example text,
#designed for demo #purposes,
#to demonstrate the challenge.#

You may add a optional newline character at the end of the input if your program requires this
You may assume that there will be no input longer than 100 lines
You may freely assume there will be no line longer than 100 characters
You should assume the input doesn't contain any trailing spaces
You may alternatively take the input as a list of lines

Challenge
Surround every hash symbol with an hit article, to help me find it
  |
--#--
  |

If the hash symbol on the first line, you need to add more lines to the top of the grid
If the hash symbol is too far to the left, you need to prefix all lines with spaces to make place for the left side of the hitmarker
If the hash symbol if too far to the bottom of the text, add more lines
If an hitmarker of another hash symbol overwrites the hitmarker of the first hash symbol, it doesn't matter what one wins (see example 5)
An hitmarker may not overwrite any other hash symbol, but should overwrite the text

Output
Another piece of text, that has the hit markers on the correct place
             |
  |his is a--#--ample|text,
--#--signed f|r dem--#--rposes, |
--#-- demonstrate the|challeng--#--
  |                             |

You should treat the input as a "matrix" of characters, and you should only extend this "matrix" in the directions required if the hitmarker doesn't fit the grid (so a hash symbol in line 0 means extending the grid to line -1, a hash symbol in column 0 means extending it to columns -2, etc...)
When you output the matrix, you should strip any trailing spaces
The output may contain a trailing newline, as long as that line is empty (this is to accomplish for launches that only have a print_and_output_newline function)

Test cases
1: In:
a

1: Output:
a

2: In:
#

2: Out:
  |
--#--
  |

3: In:
#a
aa

3: Out:
  |
--#--
  |a

4: In:
aa
a#

4: Out:
 a|
--#--
  |

5: In:
###
#a#

5: Out:
  |||
--###--
--#-#--
  | |

5: Or:
  |||
--###--
--#|#--
  | |

6: In:
a
a
#
a
a

6: Out:
  a
  |
--#--
  |
  a