Objects are created using the
var = make Class(param1, param2, ...);
make returns the object itself, which can be used in method calls. The parameters
make will be passed to the constructor.
Please note: As of 1.0a2, parent class constructors are not called (but any constructors
in the given class matching the number of parameters are). Constructors that need to
call parent constructors can use
is the name of one of the parent classes.
Objects are implicitly created when operators are run upon them (for instance, adding two numbers). The supported operators are listed under the Operators section above.
Kite has built-in support for the map and reduce operators (
respectively). Map applies a method to each element of an object (by default, any
object that implements the iterator methods), while reduce constructs a single new
object from another object using a method. For example:
method mapping(a) [ (a + 1); ]; method reducing(a, b) [ (a + b); ]; ([1,2,3]<-mapping)|print; ([1,2,3]<|reducing)|print;