define class <vehicle> (<object>) slot owner :: <string>, init-keyword: owner:, init-value: "Northern Motors"; end class <vehicle>; define class <car> (<vehicle>) end class <car>; define class <truck> (<vehicle>) slot capacity, required-init-keyword: tons:; end class <truck>;
define generic tax (v :: <vehicle>) => (tax-in-dollars :: <float>); define method tax (v :: <vehicle>) => (tax-in-dollars :: <float>) 100.00 end; define method tax (c :: <car>) => (tax-in-dollars :: <float>) 50.0; end method; define method tax (t :: <truck>) => (tax-in-dollars :: <float>) // standard vehicle tax plus $10/ton next-method() + t.capacity * 10.0; end method;
define function make-fibonacci() let n = 0; let m = 1; method () let result = n + m; n := m; m := result // return value end end; define constant fib = make-fibonacci(); for (i from 1 to 15) format-out("%d ", fib()) end;
Dylan is a multi-paradigm functional and object-oriented programming language. It is dynamic while providing a programming model designed to support efficient machine code generation, including fine-grained control over dynamic and static behaviors.
Dylan has a large amount of documentation available:
A tutorial written for those with solid programming experience in C++ or another object-oriented, static language. It provides a gentler introduction to Dylan than does the Dylan Reference Manual (DRM).
A book length Dylan tutorial.
The official definition of the Dylan language and standard library.
All of the Open Dylan documentation.