Implement makeAdder(x) returning a function that adds x to its argument. Input: line 1 is x; line 2 is a JSON array of numbers. Print the array with the adder applied, as JSON.
Input: two lines. Output: one JSON array.
Your program reads from stdin and prints to stdout.
Example 1
Input: 5 [1,2,3]
Output: [6,7,8]
Hints
Implement makeAdder(x) returning a function that adds x to its argument. Input: line 1 is x; line 2 is a JSON array of numbers. Print the array with the adder applied, as JSON.
Input: two lines. Output: one JSON array.
Your program reads from stdin and prints to stdout.
Example 1
Input: 5 [1,2,3]
Output: [6,7,8]
Hints