8. Totally
In this problem, you’re asked to enter your own APL function, without giving it any arguments. Your function will be checked by the APL Challenge system using several tests to see whether it is correct.
The function , (Join) creates a single larger list or matrix by joining its arguments (each of which can be a number, a list, or a matrix). For example:
10 , 1 2 3
10 1 2 3
1 2 3 , 40 50 60
1 2 3 40 50 60
[1 2 3
4 5 6] , [70 80
90 100]
1 2 3 70 80
4 5 6 90 100
When joining a matrix with another matrix, they must have the same number of rows.
When joining matrix with a list, the list must have as many numbers as the matrix has rows. Each number from the list is joined to a row of the matrix:
10 20 , [1 2 3
4 5 6]
10 1 2 3
20 4 5 6
Write a function that takes a matrix and uses , and + with / (from problem 4) to join the matrix (on the left) with the total of each of its rows (on the right). For example:
{answer} [1 0 1 0
1 1 1 1
1 1 0 1]
1 0 1 0 2
1 1 1 1 4
1 1 0 1 3
{answer} [1 2 3
7 8 9]
1 2 3 6
7 8 9 24