How do I change the list using mutable lists in Racket or Scheme?
Posted
by
exOne
on Stack Overflow
See other posts from Stack Overflow
or by exOne
Published on 2011-01-18T00:57:11Z
Indexed on
2011/01/18
2:53 UTC
Read the original article
Hit count: 208
I need your help Can anyone help me?
first question
This procedure should modify each element which’s index in the list is even. The value of the element should be equal to the new-element. For example: (define number-list (1 56 8 1 43 9 78)) (modify-even-indices number-list 10) The new list: 1 10 8 10 43 10 78
second question
This problem is the extended version of Question 1.
(modify-even-odd-indices my-list new-element modification-type) This procedure should modify each element according to the modification-type. The modification-type can be even or odd. For example: (define number-list (1 56 8 1 43 9 78)) (modify-even-odd-indices number-list 10 ‘even’) The new list: 1 10 8 10 43 10 78 (modify-even-odd-indices number-list 10 ‘odd’) The new list: 10 56 10 1 10 9 10
© Stack Overflow or respective owner