repositories
/
minfp.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
problematic testcase
[minfp.git]
/
tests
/
preamble.mfp
1
//Function application
2
$ ifxr 0 x y = x y;
3
//Reverse function application
4
& ifxr 0 x y = y x;
5
6
//Arithmetic operators
7
== ifxl 7 = code eq;
8
* ifxl 7 = code mul;
9
- ifxl 6 = code sub;
10
+ ifxl 6 = code add;
11
12
on f g a b = f (g a) (g b);
13
14
//Conditional operators
15
if = code if;
16
17
//fac i = if (i == 0) 1 $ i * fac (i - 1);
18
id x = x;
19
20
even i = if (i == 0) True (odd (i - 1));
21
odd i = if (i == 0) False (even (i - 1));
22
23
start = on;