Skip to content
Snippets Groups Projects
Commit 81a33828 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Begin functions (mathematical applications) implementation

The idea is to define functions this way
``
let f : X -> Y, x -> y;
``
where y is an expression of x and previously defined variables.
- x is local to the function!
- y cannot change *any* of its parameters (neither x or previously defined data)

These will not be C/C++-like functions (which will be referred as routines)

In this commit X and Y are basic types such as N, Z, R, B and string are
allowed. The aim is to allow constructions like this, for instance:
``
// definition
let norm : R*R -> R, (x,y) -> sqrt(x*x + y*y);

// usage
R n = norm(2,3.2);
``

Standard functions such as sin, cos, sqrt, abs, ... should be predefined
functions of that kind.

This commit only defines the simplest grammar. Definition is checked but use is
still invalid (since function definition is not stored correctly according with
regard to the function variable)
parent 6d8b0e28
No related branches found
No related tags found
1 merge request!37Feature/language
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment