ABSOLUTEASTRONOMY
Create a free discussion account!
Signup
Login
x
Home
Search
Topics
Almanac
Science
Nature
People
History
Society
Signup
Login
ABSOLUTEASTRONOMY
HOME
TOPICS
ALMANAC
SCIENCE
NATURE
PEOPLE
HISTORY
SOCIETY
PHILOSOPHY
Nemerle
Topic Home
Discussion
1
Overview
using System.Console; // classes and modules (static classes) can be put in namespaces
def next(x) { x + 1 }; // the type of x argument and other function arguments can be deduced from usage
def mult(x, y) { x * y };
def fibbonacci(i)
{
| 0 => 0
| 1 => 1
| other => fibbonacci(i - 1) + fibbonacci(i - 2)
};
WriteLine(next(9)); // 10 similar to "Console.WriteLine(next(9));"
WriteLine(mult(2, 2)); // 4
WriteLine(fibbonacci(10)); // 55
Variants (called data types or sum types in SML and OCaml) are forms of expressing data of several different kinds:
variant RgbColor{
| Red
| Yellow
| Green
| Different {
red : float;
green : float;
blue : float;
}
}
Nemerle allows to create, analyze and modify code of a program during a compilation process using a powerful macro system.
Discussions
Nemerle
More
x
OK