> Exercise 12.4.2 is notorius. When looking to (list 'a 'b 'c), you should > exspect 6 distinct permutations. > Jos
Thanks for your response but that really doesn't help me much. I'm focusing on insert-everywhere/in-single-word now. I understand what arrangements does and what permutations to expect. > My first suggestion is to check the function examples to make sure the values > they expect are consistent with your data definitions. Can you explain please? I'm not sure I fully understand. The only thing I could see was in my base case the function should return a list of words but before returned a single word. Is that what you mean? (define (insert-everywhere/in-single-word s w) (cond [(empty? w) (cons (cons s empty) empty)] [else ... (first w) ... (insert-everywhere/in-single-word s (rest w))])) > Amen. > > -- Make sure you truly understand list vs cons. If you have any doubts, > stick to cons.-- For your template, spell out what each expression produces > before you finish the definition.-- Use the examples, especially the ones > that fail.-- Figure out what you need to combine the pieces.-- Ideally, > arrange the thing in a table: > input | (first input) | .... | recursive result | expected result > > and keep adding examples until it clicks: i.e., until you know how to > combine recursive result with some other things to get the expected result. > > And do stick to the design recipe all the way down. Thanks! I will try those suggestions and see if they help. _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users