<div dir="ltr"><div><div><div>What is the reason for not allowing internal definitions in the "then" and "else" parts of an "if"?<br><br></div>This fails with "define: not allowed in an expression context":<br>
(if (< 3 4)<br> 5<br> (begin<br> (define a 7)<br> a))<br><br></div>But the equivalent "cond" works fine:<br>(cond<br> [(< 3 4) 5]<br> [else (define a 7)<br> a])<br><br></div>I notice that the expansion of "cond" encloses the clauses inside (let-values () ...). Why doesn't "if" allow this?<br>
<br>Justin<br></div>