On Wed, Oct 28, 2020 at 03:54:29AM -0700, Jack Firth wrote:
> So I'm a little tired of writing code like this:
> 
> (define x ...)
> (cond
>   [(take-shortcut? x) (shortcut x)]
>   [else
>    (define y (compute-y x))
>    (cond
>     [(take-other-shortcut? x y) (other-shortcut x y)]
>     [else
>      (define z ...)
>      (cond ...)])])

Perhaps you could use parendown
https://docs.racket-lang.org/parendown/index.html 

#lang parendown racket/base
(define x ...)
(cond
  [(take-shortcut? x) (shortcut x)]
  #/ else
  (define y (compute-y x))
  #/ cond
  [(take-other-shortcut? x y) (other-shortcut x y)]
  #/ else
  (define z ...)
  #/ cond ...
)

> 
> That is,
Frequently the lase element of a list is another list, and a large one 
at that.
Using #/ makes that a kind of tail-recursive syntax and eliminates some 
explicit parentheses.

Of course when you start using this it becomes so common that you'd like
to drop the ugly #'s, but unfortunately, / is already taken.

-- hendrik

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20201028134830.54plnv6nv5j3lcmt%40topoi.pooq.com.

Reply via email to