SciProgCentre / kmath

Kotlin mathematics extensions library
650 stars 55 forks source link

Text representation #13

Open Zelenyy opened 6 years ago

Zelenyy commented 6 years ago

Override toString method for NDArray

altavir commented 6 years ago

I am not sure it is a good idea. Basically, toString() is used only to identify tho object in debug mode, not to represent the result. In order to use it like python people use repr, one need to create a new presentation class and use it to render NDArray. Is there ant specific way you want it to be done?

Zelenyy commented 6 years ago

I don't have preferences, but this presenter must be smart.

altavir commented 6 years ago

Please elaborate on what do you mean by smart. I do not like the way python tries to do things under the carpet. I see two ways of doing this:

  1. Just use simple rendering functions like NDArray.()->Unit
  2. Implement generic renderers which will take Any and render it according to its own features like it is done in current DataForge Output.

The second way is more smart but I would not like it ti be in the KMath core, we will need separate module for that.

altavir commented 5 years ago

Basic functionality could be a part of #61