All examplesLanguage Install Aner
Concise generic classes
Use private fields, implicit receivers, and inferred result types without repetitive method syntax.
Download .aner source// Input types are explicit; receiver and result types can be inferred.
class Cell<T> {
let initial: T
var value: T
fn get() { return value }
fn set(value: T) { self.value = value }
fn reset() { set(initial) }
fn preview() {
let value = initial
return value
}
}
let counter = Cell<Int64>(initial: 0, value: 10)
print(counter.get())
counter.set(25)
print(counter.get())
print(counter.preview())
print(counter.get())
counter.reset()
print(counter.get())
Make it your experiment.
With Aner installed, save this program as examples/oop_concise.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/oop_concise.aner
aner run examples/oop_concise.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution