Making Changes to Elements in Nested Lists In Racket

I wanted to make a program that changes elements in nested lists at the same time, recursively. The program should be something like this: (define (changeList nestedList value1 value2)...this is where the code goes).

This program should do something like this:

(list (list 1 2) (list 1 2)....) ;;this list can be an indefinite length

Let's say value1 = 1 and value2 = 1 as well. Then This list should become

(list (list 2 3) (list 2 3)....)

Where value1 is added to the first element of a nested list, and value2 is added to the second element of a nested list. The (list (list 1 2) (list 1 2)...) will only have nested lists consisting of 2 element lists.

So...any idea on how I should do this question? Thanks (:

Read more here:

Content Attribution

This content was originally published by valenciaboi at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: