That is not an internal definition. This is an internal definition:<div><br></div><div>(define (foo x)</div><div> (define i 10)</div><div> (define j 12)</div><div> (+ x i j))</div><div><br></div><div>It is preferred because there is no right-ward shift and it unifies the top-level more with local definition contexts---which in my mind is good for understanding and copy/pasting it.</div>
<div><br></div><div>The only reason you wouldn't like it, IMHO, is when you would use a let* that re-binds:</div><div><br></div><div>(let* ([x 2] [x (+ x 4)] ...)</div><div><br></div><div>!=</div><div><br></div><div>(define x 2) (define x (+ x 4)) ...</div>
<div><br></div><div>It would be nice if we had a define* like define-package has.</div><div><br></div><div>Jay</div><div><br><div class="gmail_quote">On Tue, Nov 15, 2011 at 9:50 PM, Jordan Schatz <span dir="ltr"><<a href="mailto:jordan@noionlabs.com">jordan@noionlabs.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">From Racket v5.2 release notes:<br>
<br>
> Internal-definition expansion has changed to use let* semantics for<br>
> sequences that contain no back references. This change removes a<br>
> performance penalty for using internal definitions instead of let in<br>
> common cases, and it only changes the meaning of programs that capture<br>
> continuations in internal definitions. Internal definitions are now<br>
> considered preferable in style to let.<br>
<br>
I'm not sure that I understand, but if I have it figured out then this:<br>
<br>
(define (foo x)<br>
(local [(define i 10)<br>
(define j 12)]<br>
(+ x i j)))<br>
<br>
Is now considered better style then this?<br>
<br>
(define (foo2 x)<br>
(let ([i 10]<br>
[j 12])<br>
(+ x i j)))<br>
<br>
Why?<br>
<br>
Shalom,<br>
Jordan<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>Assistant Professor / Brigham Young University<br><a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>"The glory of God is Intelligence" - D&C 93<br>
</div>