I am trying to get a list of positions of a value in a list in Intermediate Student Language.
For instance I wish a list of positions for value "A" in the following list
(list false A false false false false A false false false )
The output must be something like
(list 1 6)
I'll give you some hints to solve this problem, it's much better if you reach a solution by your own means. Fill-in the blanks:
Notice that the
idxparameter is necessary to keep track of the index we're currently over, starting at zero. When the recursion advances, you must advance both the input list and the index. Don't forget to test the procedure: