File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,32 @@ task ConcatenateFiles {
245245 }
246246}
247247
248+ task AddIntegers {
249+ meta {
250+ description :
251+ "Add an array of integers."
252+ warn :
253+ "Be cautious with large arrays and/or arrays with very large values due to potential integer overflow."
254+ }
255+ input {
256+ Array [Int ] integers
257+ }
258+ output {
259+ Int sum = read_int ("result.txt" )
260+ }
261+ command <<<
262+ set -euxo pipefail
263+
264+ echo ~{sep =' ' integers } \
265+ | awk '{s=0; for(i=1;i<=NF;i++)s+=$i; print s}' \
266+ > result.txt
267+ >>>
268+ runtime {
269+ disks : "local-disk 10 HDD"
270+ docker : "marketplace.gcr.io/google/ubuntu2404:latest"
271+ }
272+ }
273+
248274struct HelperStructForUnzip {
249275 Array [Pair [String , String ]] contents
250276}
You can’t perform that action at this time.
0 commit comments