Write a function called `Chunk` that receives as parameters a slice, `slice []int`, and an number `size int`. The goal of this function is to chunk a slice into many sub slices where each sub slice has the length of `size`.
Write a function called `Chunk` that receives as parameters a slice, `slice []int`, and a number `size int`. The goal of this function is to chunk a slice into many sub slices where each sub slice has the length of `size`.
- If the `size` is `0` it should print `\n`
- If the `size` is `0` it should print a newline (`'\n'`).
The function should have as parameters a function, `f func(int, int) int` a slice of integers, `slice []int` and an int `acc int`. You should apply for each element of the slice the arithmetic function, saving and printing it. The function will be tested with our own functions `Add, Sub, and Mul`.
The function should have as parameters a function, `f func(int, int) int` a slice of integers, `slice []int` and an int `acc int`. For each element of the slice, it should apply the arithmetic function, save the result and print it. The function will be tested with our own functions `Add, Sub, and Mul`.
Write a program that receives two strings and replicates the use of brackets in regular expressions. Brackets in regular expressions returns the words that contain the expression inside of it.
The program should handle the "`|`" operator, that searches for both strings on each side of the operator.
The program should handle the "`|`" operator, which searches for both strings on each side of the operator.
The output of the program should be the results of the regular expression by order of appearance in the string, being themselves identified by a number.
The output of the program should be, the results of the regular expression,numbered and displayed by the order of appearance in the string.
If the number of arguments is different from 2, if the regular expression is not valid, if the last argument is empty or there are no matches the program should print nothing.
If the number of arguments is different from 2, if the regular expression is not valid, if the last argument is empty or if there are no matches, the program should print nothing.
The function should have as parameters a slice of integers,`a []int` and a function `f func(int, int) int`. You should apply for each element of the slice the arithmetic function, saving it and printing.
The function should have as parameters a slice of integers `a []int` and a function `f func(int, int) int`. For each element of the slice, it should apply the function `f func(int, int) int`, save the result and then print it.