#| Hello all, in a quest for greater concision, I'm looking for a way to abstract over the following code containing mostly definitions. Is there an accepted practice for abstraction over definition introduction?|#
(define top-right-x (lambda (a-grid-plane a-cell) ;;The next three definitions are what I am looking to abstract over, as they show up in many similarly defined functions.|# (match-define (cell row-pos col-pos) a-cell) (define cell-size (grid-plane->cell-size a-grid-plane)) (match-define (size cell-w cell-h) cell-size) (+ cell-w (* col-pos cell-w)))) (define top-right-y (lambda (a-grid-plane a-cell) (match-define (cell row-pos col-pos) a-cell) (define cell-size (grid-plane->cell-size a-grid-plane)) (match-define (size cell-w cell-h) cell-size) (* row-pos cell-w))) #|How should I approach this? are my options parameters, leaving as is, a with- macro? Much appreciated all, -Patrick |#
____________________ Racket Users list: http://lists.racket-lang.org/users