0
votes

I'm trying to make a procedure called map-odd-mapper where I take a proc that can then be applied to a list

ex:

((make-odd-mapper add-one) (list 14 38 29 10 57))
(15 30 58)

I was thinking of putting it as a let function as in (define (make-odd-mapper f) (let (..........something using ret-odds to allow for the indices so that you can get the odd numbers....

ret-odds is defined as (define (ret-odds lst) (if (null? lst) null (cons (car lst) (if (null? (cdr lst)) null (ret-odds (cdr (cdr lst))))))) the point of this is just to make a proc which will allow me to apply a procedure such as add-one to a list of odd indices....

2
how to write the procedure i'm not sure on how to make it work so like how do i get started an such i realized that you dont need the filter and is odd since its odd on the aspect of indices.....but i'm still not sure how to write it..... - Terrill Mckinney
It smells like homework. - knivil

2 Answers

1
votes

This problem can be broken down into two smaller ones. At the risk of being pedantic: can you describe what these two smaller problems would be, and provide test cases for them?

0
votes

(define (make-odd-mapper f) (lambda (lst) (ret-odds (map f lst))))