Skip to content

[Bioc-devel] GenomicFiles reducer and iterate argument

10 messages · Ryan, Michael Lawrence, Martin Morgan +1 more

#
On 06/15/2014 07:34 AM, Michael Lawrence wrote:
My 'rationale' was that one would choose iterate=FALSE when one required all 
elements to perform the reduction. I thought of the list (rather than ...) as 
the general R data structure for representing N elements, with a special case 
(consistent with Reduce) made for the pairwise reduction of iterate=TRUE. Either 
way, the two cases (x, y vs. list(), x, y vs. ...) seem to require some 
explaining to the user. Is there a clear better choice? You're the second person 
to trip over this, so I guess there's a crack in the sidewalk...

Martin

  
    
#
What about having two separate reducer arguments, one for a reducer 
that takes two elements at a time and combines them, and the other for 
a reducer that takes a list and combines all the elements of the list? 
Specifying both at once would be an error. I think it makes more sense 
to say "these two arguments expect different things" than "this one 
argument expects a different thing depending on the value of another 
argument".

-Ryan
On Sun Jun 15 11:17:59 2014, Michael Lawrence wrote:
1 day later
#
Hi Michael, Ryan,

Yes, it would be ideal to have a single signature for both cases of 
'iterate'. We went over the pros/cons again and at the end of the day 
decided to keep things as they are. No perfect solution here.

These were the primary points:

- Disadvantages of defining REDUCER with only '...' is that '...' can 
represent variables other than just the output from MAPPER.

- The unappealing aspect of the variadic approach is introducing a new 
check each time REDUCER is called.

- Going the other direction, considering a single arg for REDUCER 
instead two, requires coercing 'last' and 'current' to a list before 
pulling them apart again.


Valerie
On 06/15/14 16:36, Michael Lawrence wrote:
#
Val's out today and I'm at least part of the problem so...
On 06/17/2014 10:13 AM, Michael Lawrence wrote:
reduceBy* takes an argument ... and this is currently available to both the 
MAPPER and REDUCER, see below.
it's not the list construction but the lost convenience of named arguments, in 
addition to consistency with Reduce when the data are presented iteratively -- 
REDUCER=`+` instead of REDUCER=function(lst) sum(unlist(lst, use.names=FALSE)).
The variadic adapter concept is easy enough to understand in context, but would 
send me for a head scratch at some later time.

Martin

  
    
#
We'll try a single arg to REDUCER and see how it goes.

BTW I'm also going to swap out DataFrame for Vector in the rowData. 
DataFrame has been more difficult than anticipated (storing names, 
subsetting to get ranges out) and doesn't give any clear advantage over 
Vector.

Val
On 06/17/2014 02:59 PM, Michael Lawrence wrote: