Closed jackfirth closed 2 years ago
This code:
(define (point-radius p) (match p [(point x y) (sqrt (+ (sqr x) (sqr y)))]))
can be better written with match-define instead, like this:
match-define
(define (point-radius p) (match-define (point x y) p) (sqrt (+ (sqr x) (sqr y))))
Resyntax ought to suggest this. The logic is similar to let-to-define, with the added condition that it should only happen for (tail-position) match expressions that have a single clause.
let-to-define
match
This code:
can be better written with
match-define
instead, like this:Resyntax ought to suggest this. The logic is similar to
let-to-define
, with the added condition that it should only happen for (tail-position)match
expressions that have a single clause.