<html><head><base href="x-msg://93/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><br><div><div>On Mar 30, 2011, at 10:10 PM, Jay wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Lucida Grande'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; ">Hi,<br><br>I have two unrelated questions, and I hope no one will mind my bundling them together:<br><br>1) I'm stumped by the "cross" problem (17.1.2). Although I did manage to dig up someone else's solution, and do understand it, I would never have recognized it from the problem description as an instance of two-lists-with-one-treated-atomically. Aside from its location in the text, is there a way of looking at this problem that helps identify the technique? Even knowing the answer, I'm not sure what should have been on my auxiliary function "wish list."<br></div></span></blockquote><div><br></div><div><div><br></div><div>Would you find this more comprehensible? </div><div><br></div><div>#lang racket </div><div><div><br></div><div>(require rackunit)</div><div><br></div><div>;; cross : [Setof X] [Setof Y] -> [Setof [List X Y]]</div><div>(define (cross s t)</div><div> (for*/set ((1s s) (1t t)) (list 1s 1t)))</div><div><br></div><div>(check-equal? (cross (set 1 2 3) (set 'a 'b)) (set '(1 a) '(1 b) '(2 a) '(2 b) '(3 a) '(3 b)))</div><div><br></div></div></div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; ">2) Is there a post or other resource that describes how HTDP methodology can be applied to programming in other languages? I'm interested in C++, but I imagine discussions of any imperative language would be helpful.</div></blockquote><br></div><div>Of course. See HtDC. </div></body></html>