On 12/4/17 3:43 PM, Dirk wrote:
Hi!
I defined an interface:
interface Medoid {
float distance( Medoid other );
uint id() const @property;
}
and a class implementing that interface:
class Item : Medoid {
float distance( Item i ) {...}
uint id() const @property {...}
}
The
On Monday, 4 December 2017 at 20:43:27 UTC, Dirk wrote:
Hi!
I defined an interface:
interface Medoid {
float distance( Medoid other );
uint id() const @property;
}
and a class implementing that interface:
class Item : Medoid {
float distance( Item i ) {...}
uint id() const @pr
On Tuesday, 5 December 2017 at 07:47:32 UTC, Dirk wrote:
The distance function is implementation dependend and can only
be computed between two objects of the same class (in this
example the class is Item).
Just don't put it in the interface. Leave it in the individual
classes with the strict
On Tuesday, 5 December 2017 at 08:08:55 UTC, Daniel Kozak wrote:
You can do something like this:
interface Medoid(T) {
float distance( T other );
uint id() const @property;
}
class Item : Medoid!(Item) {
float distance( Item m ) { return 0.;}
uint id() const @property { return 1
You can do something like this:
interface Medoid(T) {
float distance( T other );
uint id() const @property;
}
class Item : Medoid!(Item) {
float distance( Item m ) { return 0.;}
uint id() const @property { return 1; }
}
class MedoidClassification {
this(T:Medoid!T)(T[] list)
On Tuesday, 5 December 2017 at 07:47:32 UTC, Dirk wrote:
What would be a good way to implement this?
Did you tried to use introspection?
The distance function is implementation dependend and can only be
computed between two objects of the same class (in this example
the class is Item).
My goal is to write a module for a k-medoids clustering
algorithm. The class MedoidClassification shall be able to
partition a list of objects
On Monday, 4 December 2017 at 20:43:27 UTC, Dirk wrote:
Hi!
float distance( Medoid other );
float distance( Item i ) {...}
The two signatures need to be the same. I think this is true of
most OOP languages. Have them both be:
float distance( Medoid other );
On 2017-12-04 21:43, Dirk wrote:
Hi!
I defined an interface:
interface Medoid {
float distance( Medoid other );
uint id() const @property;
}
and a class implementing that interface:
class Item : Medoid {
float distance( Item i ) {...}
uint id() const @property {...}
}
The
On Monday, 4 December 2017 at 20:43:27 UTC, Dirk wrote:
Hi!
I defined an interface:
interface Medoid {
float distance( Medoid other );
uint id() const @property;
}
and a class implementing that interface:
class Item : Medoid {
float distance( Item i ) {...}
uint id() const @pr
On Monday, 4 December 2017 at 20:43:27 UTC, Dirk wrote:
interface Medoid {
float distance( Medoid other );
uint id() const @property;
}
and a class implementing that interface:
class Item : Medoid {
float distance( Item i ) {...}
uint id() const @property {...}
}
The compiler s
Hi!
I defined an interface:
interface Medoid {
float distance( Medoid other );
uint id() const @property;
}
and a class implementing that interface:
class Item : Medoid {
float distance( Item i ) {...}
uint id() const @property {...}
}
The compiler says:
Error: class Item inte
12 matches
Mail list logo