[racket] arrangements exercise
On Jul 6, 2012, at 5:48 AM, Sean Kemplay wrote:
> I am going through htdp first edition (at chapter 17 which refers to arrangements from chapter 12 which is why I revisited the exercise). Would you suggest continuing with this edition or moving to the draft second edition
>
I would switch to '2e' if I were you. It's more fun but you will learn mostly the same ideas. ('2e' provides an event-driven program context as playground for developing design skills. '1e' provides no real context.)
> Do you mean the contract for insert-everywhere/word should be symbol word -> list of words? And will the words returned be the same length? Ie am I aiming for the same result as the current definition?
>
Letter List-of-Words -> List-of-Words
insert letter l in all positions in all words in lw
(define (insert-everywhere/all-words l lw)
lw)
Letter Word -> List-of-Words
insert letter l in all positions in one word (w)
(define (insert-everywhere/1word l w)
(list w))
;; ---
I recommend you make up examples (with check-expect) first and send them back to the list.
The above 'stub' implementations should fail most of your examples. (A stub/silly/stupid/obviously-wrong
implementation is something '2e' suggests.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120706/0c3b7d9d/attachment.html>