Unfortunately I don't think you can combine def with destructuring, because then you can't use it for functions afaik. I think two forms is necessary.<br><br><div class="gmail_quote">On Thu, May 10, 2012 at 1:20 PM, Greg Hendershott <span dir="ltr"><<a href="mailto:greghendershott@gmail.com" target="_blank">greghendershott@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">To combine what Neil and Luke said, maybe one new thing `def' could do<br>
is include destructuring.<br>
<br>
In other words it's really an alias for `match-define'.<br>
<br>
And<br>
(match-define x 1)<br>
<br>
is the same as<br>
(define x 1)<br>
<br>
correct?<br>
<br>
<br>
I'd also like to see a syntax if possible that lets you (as with<br>
`let') do multiple defines in one shot:<br>
<br>
(let ([x 1]<br>
[y 2])<br>
...)<br>
<br>
could perhaps be:<br>
<br>
(def ([x 1]<br>
[y 2])<br>
...)<br>
<br>
or even just:<br>
<br>
(def x 1<br>
y 2)<br>
<br>
?<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, May 10, 2012 at 12:58 PM, Luke Vilnis <<a href="mailto:lvilnis@gmail.com">lvilnis@gmail.com</a>> wrote:<br>
> +1000 to "def" idea<br>
><br>
> I think the super verbose keywords can be an impediment to code readability.<br>
> The increase in signal-to-noise, along with (imo) sexier looking code<br>
> samples to show to prospective Racketeers is worth it. As silly as it might<br>
> sound, when I started out, Scheme's notoriously long keywords gave it a<br>
> superficial appearance of impracticality.<br>
><br>
> ;; hot!<br>
> (def x 12)<br>
> (def y 15)<br>
> (def z 12)<br>
> (+ x y z)<br>
><br>
> ;; not!<br>
> (define x 12)<br>
> (define y 15)<br>
> (define z 12)<br>
> (+ x y z)<br>
><br>
> On a related note - if we're looking to shorten some offending keywords,<br>
> making a nice alias for "match-define" would be fantastic. It is a shame to<br>
> have to use a 12-letter keyword to get something that is accomplished with<br>
> "let" in other languages, especially since Racket's pattern matching is too<br>
> awesome not to use. I sometimes define "val" or "mdef" as an alias for<br>
> "match-define", but I'm always too embarassed to let such code escape my<br>
> laptop.<br>
><br>
> On Thu, May 10, 2012 at 12:29 PM, Neil Van Dyke <<a href="mailto:neil@neilvandyke.org">neil@neilvandyke.org</a>><br>
> wrote:<br>
>><br>
>> Making new names for key things is a good time to revisit what those<br>
>> things look like and mean.<br>
>><br>
>> I have no major requests for changes to "define", but perhaps someone else<br>
>> does. (I do, however, have a major request for the "let" family, but not a<br>
>> lot of time at the moment to advocate it, unless someone is going to mess<br>
>> with "let" now.)<br>
>><br>
>> Neil V.<br>
>><br>
>><br>
>> ____________________<br>
>> Racket Users list:<br>
>> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
</div></div></blockquote></div><br>