Re: [racket] An example of let-vs-define: SICP 2.64

2012-11-08 Thread Matthias Felleisen
That happens to the best and worst of us. I switch among syntax-rule, syntax-rules, syntax-case, and syntax-parse. I have made the same mistake as your friend. On Nov 8, 2012, at 10:06 AM, Greg Hendershott wrote: > In general I love internal define and have been using it heavily. > > A

Re: [racket] An example of let-vs-define: SICP 2.64

2012-11-08 Thread Greg Hendershott
In general I love internal define and have been using it heavily. After the initial infatuation, I still love it. I've also come to appreciate that sometimes let can be clearer. I like having the choice. Another way internal define can bite you is if you're not real crisp on your understanding of

Re: [racket] An example of let-vs-define: SICP 2.64

2012-11-02 Thread Neil Van Dyke
Here's a different comparison of let-vs-internal-define, using your code. Your internal define example (hopefully whitespace doesn't get mangled by however you're reading this message): (define (partial-tree elts n) (cond [(= n 0) (values EMPTY-TREE elts)] [else (de

Re: [racket] An example of let-vs-define: SICP 2.64

2012-11-02 Thread Grant Rettke
On Fri, Nov 2, 2012 at 4:33 PM, Sam Tobin-Hochstadt wrote: > Just a cautionary tale,+++ > > Good point. Thanks for sharing. Racket Users list: http://lists.racket-lang.org/users

Re: [racket] An example of let-vs-define: SICP 2.64

2012-11-02 Thread Sam Tobin-Hochstadt
On Fri, Nov 2, 2012 at 5:29 PM, Grant Rettke wrote: > Internal define is awesome. I agree in general, but I did recently fix a bug in Typed Racket that was made possible entirely by use of internal `define`: https://github.com/plt/racket/commit/0e71f2d5dc#L1R16 The original code had a `let`, whi

Re: [racket] An example of let-vs-define: SICP 2.64

2012-11-02 Thread Grant Rettke
Internal define is awesome. On Fri, Nov 2, 2012 at 4:17 PM, Matthias Felleisen wrote: > > I guess we should take this also as a confirmation of the style guide :-) > > > On Nov 2, 2012, at 5:05 PM, Danny Yoo wrote: > > > I was just looking at exercise 2.64 of SICP, one that creates a BST out > o

Re: [racket] An example of let-vs-define: SICP 2.64

2012-11-02 Thread Matthias Felleisen
I guess we should take this also as a confirmation of the style guide :-) On Nov 2, 2012, at 5:05 PM, Danny Yoo wrote: > I was just looking at exercise 2.64 of SICP, one that creates a BST out of an > ordered list of elements: > > http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-16.h

[racket] An example of let-vs-define: SICP 2.64

2012-11-02 Thread Danny Yoo
I was just looking at exercise 2.64 of SICP, one that creates a BST out of an ordered list of elements: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-16.html#%_thm_2.64 However, because of all the nested lets, I have to admit that I was having a hard time reading it! So I rewrote it w