[racket] `def' ?

From: Luke Vilnis (lvilnis at gmail.com)
Date: Thu May 10 13:34:32 EDT 2012

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.

On Thu, May 10, 2012 at 1:20 PM, Greg Hendershott <greghendershott at gmail.com
> wrote:

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

Posted on the users mailing list.