Dear All,<div><br></div><div>I've recently started hacking Racket again, and am loving the for/* constructs. </div><div>Awesome stuff. However, I have two questions about for/hash.</div><div><br></div><div>(1) How can I *not* add a hash entry for a given iteration?</div>
<div><br></div><div>When I use for/list, can I abuse the nature of empty and append* (I cringe as I write this):</div><div><br></div><div><div>(append* (for/list ([i '(1 2 3 4 5)])</div><div> (cond [(even? i) (list (* i 100))]</div>
<div> [else empty])))</div></div><div><br></div><div>Surely there is a better way to do this for for/list, and a way in general for for/hash?</div><div><br></div><div>(2) How can I add multiple entries (that is, >1 key-value pair) in a given iteration?</div>
<div><br></div><div>Again, using for/list I can cheat via append*:</div><div><br></div><div><div>(append* (for/list ([i '(1 2 3 4 5)])</div><div> (list (* i 100) (* i 200))))</div></div><div><br></div><div>What's the right way to do this in for/hash?</div>
<div><br></div><div>Thanks,</div><div>- Tim</div><div><br></div>