Good question. I know I have done exactly that in the past, but I guess I
just forgot about that pattern in my more recent code. Other possible
reasons include "because I don't like the unnecessary parens around a
single id" and "because I like the indentation of let* (4 chars) much
better than
On Wed, 20 Oct 2021 09:44:42 -0700 (PDT), Ryan Kramer
wrote:
> :
>The other feature of let++ is that it also supports let-values. (Having to
>nest "let, then let-values, then let again" was another reason my code
>would get too indented for my taste.)
> :
Possibly a stupid question, but ...
W
I guess I'll pile on too. My approach was `let++` which I rename to `let*`
because (I think) it is backwards compatible. The pattern for early exit is
`#:break (when test-expr result-expr)` so the previous example would look
like this:
(let* (#:break (when (not (foo? x))
#f)
Oh well, since everyone is at it, here's my version that no-one asked for.
It's similar to parendown, but uses a more standard (but also specific)
macro `cond/else` from
https://github.com/Metaxal/bazaar/blob/master/cond-else.rkt :
(*cond/else*
[(*not* (foo? x)) #f]
#:else
(*define* y (bar x))
Here's my solution:
(define/guard (f x)
(guard (foo? x) else
#false)
(define y (bar x))
(define z (jazz x y))
(guard (loopy? z) else
#false)
(define a (yowza z))
(guard (string? a) else
(error 'ugh))
(define b (bonkers a))
(guard (number? (hoop x b)) else
(error 'um
On Fri, Oct 01, 2021 at 02:32:52PM -0400, David Storrs wrote:
> On Fri, Oct 1, 2021 at 11:58 AM Hendrik Boom wrote:
>
> > On Fri, Oct 01, 2021 at 02:22:14PM +, Jesse Alama wrote:
> > > Hello,
> > >
> > > Have you ever wished you could do a C-style return in the middle
> > > of a block of Rack
On Fri, Oct 1, 2021 at 11:58 AM Hendrik Boom wrote:
> On Fri, Oct 01, 2021 at 02:22:14PM +, Jesse Alama wrote:
> > Hello,
> >
> > Have you ever wished you could do a C-style return in the middle
> > of a block of Racket code? When you're in the heat of things with
> > a complicated problem wh
On Fri, Oct 01, 2021 at 02:22:14PM +, Jesse Alama wrote:
> Hello,
>
> Have you ever wished you could do a C-style return in the middle
> of a block of Racket code? When you're in the heat of things with
> a complicated problem where input values need a fair amount of
> multi-stage extraction a
8 matches
Mail list logo