>>Of course. See HtDC. 


Thanks, I didn't know you had a Java book in the works (though I probably 
should have guessed).



>>Would you find this more comprehensible? 



Perhaps I would understand the code better if I ran it (still haven't 
had the opportunity). Prof. Bloch posted an explanation on the plt-edu 
list that's a bit closer to my level.



Thanks again.





Jay



Subject: Re: [racket] HTDP 17.1.2; applying methodology to imperative languages
From: [email protected]
Date: Wed, 30 Mar 2011 22:23:33 -0400
CC: [email protected]
To: [email protected]





On Mar 30, 2011, at 10:10 PM, Jay wrote:Hi,

I have two unrelated questions, and I hope no one will mind my bundling them 
together:

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."


Would you find this more comprehensible? 
#lang racket 
(require rackunit)
;; cross : [Setof X] [Setof Y] -> [Setof [List X Y]](define (cross s t)  
(for*/set ((1s s) (1t t)) (list 1s 1t)))
(check-equal? (cross (set 1 2 3) (set 'a 'b)) (set '(1 a) '(1 b) '(2 a) '(2 b) 
'(3 a) '(3 b)))

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.
Of course. See HtDC.                                      
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to