Templates problem

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 7 14:25:30 PDT 2016


On Wednesday, 7 September 2016 at 20:49:42 UTC, data pulverizer 
wrote:
>
> You're quite right that D doesn't need to change at all to 
> implement something like pandas or dataframes in R, but I am 
> thinking of how to got further. Very often in data science 
> applications types will turn up that are required but are not 
> currently configured for your table. The choice you have is to 
> have to modify the code or as scala does give programmers the 
> ability to write their own interface to the type so that the it 
> can be stored in their DataFrame.

I think part of the difficulty is that you're thinking in terms 
of everything being dynamic. If all your data is statically typed 
in the first place, then I don't see what the issue is.

Consider a potential use case. You have an existing data frame 
and you want to add a column of data to it that has a different 
type than the existing frame. I imagine the function call would 
look something like:
auto newFrame = oldFrame.addCol(newData);
So you just need to ensure that the data frame struct or class 
has an addCol method that returns a new frame with the correct 
type when you add a column.

I'm not familiar with Scala's data frames.

> The best solution is that the data table is able to cope with 
> arbitrary number of types which can be done in Sparrow.

D has support for an arbitrary number of types (tuple, variant, 
algebraic). It's just a matter of putting it together.

Anyway, given that Sparrow is still in its early stages, if you 
actually want to get some work done, D might be a better fit.

On Wednesday, 7 September 2016 at 20:52:26 UTC, data pulverizer 
wrote:
>
> p.s. it goes beyond just tables, ... having dynamic capability 
> in a static compiled language really does take computing to a 
> different place indeed.

There are some dynamic capabilities in D, such as 
variant/algebraic and Adam Ruppe's jsvar. I only wonder if you 
would lose performance if wanted something fully dynamic. A 
static approach is a good starting place.


More information about the Digitalmars-d-learn mailing list