Write a function that, given a right argument `Y`

which is a scalar or a non-empty vector and a left argument `X`

which is a single non-zero integer so that its absolute value is less or equal to `β’Y`

, splits `Y`

into a vector of two vectors according to `X`

, as follows:

- If
`X>0`

, the first vector contains the first`X`

elements of`Y`

and the second vector contains the remaining elements. - If
`X<0`

, the second vector contains the last`|X`

elements of`Y`

and the first vector contains the remaining elements.

π‘ Hint: The Take function `XβY`

might be useful for this problem.

```
9 (your_function) 'SplittingHairs' β using ]Boxing on
βββββββββββ¬ββββββ
βSplittingβHairsβ
βββββββββββ΄ββββββ
Β―3 (your_function) 'DyalogAPL'
ββββββββ¬ββββ
βDyalogβAPLβ
ββββββββ΄ββββ
10 (your_function) β³10
ββββββββββββββββββββββ¬β
β1 2 3 4 5 6 7 8 9 10ββ
ββββββββββββββββββββββ΄β
1 (your_function) 'works' 'with' 'words' 'also'
βββββββββ¬ββββββββββββββββββ
βββββββββββββββ¬ββββββ¬ββββββ
ββworksβββwithβwordsβalsoββ
βββββββββββββββ΄ββββββ΄ββββββ
βββββββββ΄ββββββββββββββββββ
```

UTF-8 encodes Unicode characters using 1-4 integers for each character. Dyalog APL includes a system function, `βUCS`

, that can convert characters into integers and integers into characters. The expression `'UTF-8'ββUCS`

converts between characters and UTF-8.

Consider the following:

```
'UTF-8'ββUCS 'DΒ₯βΊββ9'
68 194 165 226 141 186 226 140 138 226 151 139 57
'UTF-8'ββUCS 68 194 165 226 141 186 226 140 138 226 151 139 57
DΒ₯βΊββ9
```

How many integers does each character use?

```
'UTF-8'ββUCSΒ¨ 'DΒ₯βΊββ9' β using ]Boxing on
ββββ¬ββββββββ¬ββββββββββββ¬ββββββββββββ¬ββββββββββββ¬βββ
β68β194 165β226 141 186β226 140 138β226 151 139β57β
ββββ΄ββββββββ΄ββββββββββββ΄ββββββββββββ΄ββββββββββββ΄βββ
```

The rule is that an integer in the range 128 to 191 (inclusive) continues the character of the previous integer (which may itself be a continuation). With that in mind, write a function that, given a right argument which is a simple integer vector representing valid UTF-8 text, encloses each sequence of integers that represent a single character, like the result of `'UTF-8'ββUCSΒ¨'UTF-8'ββUCS`

but does not use any system functions (names beginning with `β`

).

π‘ Hint: Use `βUCS`

to verify your solution.

```
(your_function) 68 194 165 226 141 186 226 140 138 240 159 148 178 57 β using ]Boxing on
ββββ¬ββββββββ¬ββββββββββββ¬ββββββββββββ¬ββββββββββββββββ¬βββ
β68β194 165β226 141 186β226 140 138β240 159 148 178β57β
ββββ΄ββββββββ΄ββββββββββββ΄ββββββββββββ΄ββββββββββββββββ΄βββ
(your_function) 68 121 97 108 111 103 β 'Dyalog'
ββββ¬ββββ¬βββ¬ββββ¬ββββ¬ββββ
β68β121β97β108β111β103β
ββββ΄ββββ΄βββ΄ββββ΄ββββ΄ββββ
(your_function) β¬ β '' (any empty vector result is acceptable here)
```

A Microsoft Excel spreadsheet numbers its rows counting up from 1. However Excelβs columns are labelled alphabetically β beginning with AβZ, then AAβAZ, BAβBZ, up to ZAβZZ, then AAAβAAZ and so on.

Write a function that, given a right argument which is a character scalar or non-empty vector representing a valid character Excel column identifier between A and XFD, returns the corresponding column number.

π‘ Hint: The Decode function `Xβ₯Y`

.

```
(your_function) 'A'
1
(your_function) 'APL'
1104
```

Write a function that, given a right argument which is an integer array of year numbers greater than or equal to 1752 and less than 4000, returns a result of the same shape as the right argument where 1 indicates that the corresponding year is a leap year (0 otherwise).

A leap year algorithm can be found here.

π‘ Hint: The Residue function `X|Y`

and the Outer Product operator `β.`

could be useful for this problem.

```
(your_function) 2020
1
(your_function) β¬ β returns an empty vector
(your_function) 1900+10 10β΄β³100
0 0 0 1 0 0 0 1 0 0
0 1 0 0 0 1 0 0 0 1
0 0 0 1 0 0 0 1 0 0
0 1 0 0 0 1 0 0 0 1
0 0 0 1 0 0 0 1 0 0
0 1 0 0 0 1 0 0 0 1
0 0 0 1 0 0 0 1 0 0
0 1 0 0 0 1 0 0 0 1
0 0 0 1 0 0 0 1 0 0
0 1 0 0 0 1 0 0 0 1
```

Write a function that, given a right argument of 2 integers, returns a vector of the integers from the first element of the right argument to the second, inclusively.

π‘ Hint: The Index Generator function `β³Y`

function could be useful when solving this problem.

```
(your_function) 3 10
3 4 5 6 7 8 9 10
(your_function) 4 Β―3
4 3 2 1 0 Β―1 Β―2 Β―3
ββrβ(your_function) 42 42
42
β΄r β this is also a vector
1
```

Write a function that, given a right argument which is an integer vector and a left argument which is an integer scalar, reorders the right argument so any elements equal to the left argument come first while all other elements keep their order.

π‘ Hint: The Grade Up function `βY`

could be helpful for this problem.

```
3 (your_function) 1 2 3 4 1 3 1 4 5
3 3 1 2 4 1 1 4 5
3 (your_function) ,1 β the , makes 1 into a vector
1
42 (your_function) β¬ β empty right argument gives empty result
```

A common technique for encoding a set of on/off states is to use a value of 2^{n} for the state in position *n* (origin 0), 1 if the state is βonβ or 0 for βoffβ and then add the values. Dyalog APLβs component file permission codes are an example of this. For example, if you wanted to grant permissions for read (access code 1), append (access code 8) and rename (access code 128) then the resulting code would be 137 because thatβs 1 + 8 + 128.

Write a function that, given a non-negative right argument which is an integer scalar representing the encoded state and a left argument which is an integer scalar representing the encoded state settings that you want to query, returns 1 if all of the codes in the left argument are found in the right argument (0 otherwise).

π‘ Hint: The Decode function `Xβ₯Y`

and the derived Inverse operator `β£Β―1`

could be helpful for decoding the states.

```
2 (your_function) 7 β is 2 in 7 (1+2+4)?
1
4 (your_function) 11 β is 4 in 11 (1+2+8)?
0
3 (your_function) 11 β is 3 (1+2) in 11 (1+2+8)?
1
4 (your_function) 0 β is 4 in 0?
0
```

A zigzag number is an integer in which the difference in magnitude of each pair of consecutive digits alternates from positive to negative or negative to positive.

Write a function that takes a single integer greater than or equal to 100 and less than 10^{15} as its right argument and returns a 1 if the integer is a zigzag number, 0 otherwise.

π‘ Hint: Your solution might make use of *N-wise Reduction* `X f/ Y`

.

```
(your_function) 123
0
(your_function) 132
1
(your_function) 31115
0
(your_function) 3141514131415
1
```

Write a function that, given a right argument which is an integer scalar or vector, returns a 1 if the values of the right argument conform to the following pattern (0 otherwise):

- The elements increase or stay the same until the βapexβ (highest value) is reached
- After the apex, any remaining values decrease or remain the same

π‘ Hint: The *Reverse* function `β½Y`

and the *Maximum* function `XβY`

combined with *N-wise Reduction* `X f/ Y`

or *Scan* `f\ Y`

can help with solving this problem.

```
(your_function) 1 3 3 4 5 2 1
1
(your_function) 42
1
(your_function) 1 3 2 4
0
(your_function) 23 23 23
1
(your_function) β¬ β empty vector
1
```

Write a function that takes as its right argument a vector of simple arrays of rank 2 or less (scalar, vector, or matrix). Each simple array will consist of either non-negative integers or printable ASCII characters. The function must return a simple character array that displays identically to what `{βββ΅}Β¨`

displays when applied to the right argument.

π‘ Hint: The *Mix* `βY`

, *Split* `βY`

, and *Format* `βY`

functions could be helpful for solving this problem.

All results will look identical with `]Boxing on`

as they are simple (non-nested) character arrays.

```
(your_function) 'Hi' 'Earth'
Hi
Earth
(your_function) (3 3β΄β³9)(β'Adam' 'Michael')(β³10) '*'(5 5β΄β³25)
1 2 3
4 5 6
7 8 9
Adam
Michael
1 2 3 4 5 6 7 8 9 10
*
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
(your_function) 'O' 'my!'
O
my!
(your_function) ,ββ³4
1 2 3 4
(your_function) ,'A'
A
```