octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dataframe dereferencing


From: CdeMills
Subject: Re: dataframe dereferencing
Date: Tue, 7 Sep 2010 08:04:58 -0700 (PDT)


Judd Storrs-2 wrote:
> 
> On Tue, Sep 7, 2010 at 2:10 AM, Jaroslav Hajek <address@hidden> wrote:
> 
>> Also, to access individual elements, overload {I,J} to give the
>> corresponding element(s) directly.
>>
> 
> It seems like sometimes you would want to treat the dataframe as a matrix
> and sometimes you would want to treat it as a cell array. For example,
> maybe
> you want to call some function that works generically on cell arrays or on
> matrices without rewriting the functions to have special cases for
> dataframes.
> 
> Additionally, how does one extract a range as a matrix without specifying
> a
> type? If df{1:3,1:3} always returns a cell array and df(1:3,1:3) always
> returns a dataframe, I think we'd be stuck with constantly annotating
> types
> either by sometype(df(1:3,1:3)) or df(1:3,1:3).sometype which seems
> somewhat
> tedious. I suppose something like native(df(1:3,1:3)) or
> df(1:3,1:3).native
> could be used to tell dataframe not to convert types, but I think were
> stuck
> again with requiring functions to know about the dataframe interface?
> 

For the first point, this is why I think that dataframe subreferencing
should be polymorphic, even if it breaks the principle of least surprise.
This permit to use dataframes with all numeric functions expecting numeric
matrices as input, without knowing they use df. In such view, it is the
programmer which has to make sure that the referenced elements are all of
the same type.

The problem with something(dataframe(some_range)) is that we have (Jaroslav,
correct me if I'm wrong), two steps: a call to @dataframe/subrefs, then a
call so @dataframe/something, provided the first call returned a dataframe.
OTOH, is the chaining determined at run time ? I mean, before determining
which 'something' is called, the program has to determine the class of
df(some_range). So we could make things simpler if df(some_range) knows its
context, i.e. the function calling it. Is it possible in 3.2 -- will it be
possible in 3.4 ?

Regards

Pascal 

-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/dataframe-dereferencing-tp2494732p2529864.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]