Not sure this answers exactly to the specs, but it does avoid the
duplication:
(define get-pos
(lambda (pos 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)
--- On Mon, 5/7/12, Patrick Mahoney wrote:
> 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
> (la
Thank you all, you have given me much to think on here. I had versions that
used a generic function as suggested, but I wasn't sure if the cognitive
overhead in understanding the generic strategy outweighed the benefits to
concision. I think it probably does in some cases, probably related to how
d
Here's one way to do it:
(define-values (top-right-x top-right-y)
(let ()
(define (mk x?)
(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-s
On May 7, 2012, at 5:41 PM, Patrick Mahoney wrote:
> #|
> 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-ri
On Mon, 07 May 2012 19:43:37 -0400
users-requ...@racket-lang.org wrote:
> #|
> 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?|#
>
#|
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 a
7 matches
Mail list logo