File: lambda.gp

package info (click to toggle)
gp2c 0.0.11pl1-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,792 kB
  • sloc: ansic: 8,398; sh: 1,687; lex: 340; yacc: 215; makefile: 140
file content (15 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
global(zero,one,two,three);
global(inc,add,mul,power,dec,sub,mod,disp);
zero=f->x->x;
one =f->f;
two =f->x->f(f(x));
three=f->x->f(f(f(x)));
inc= n->f->x->f(n(f)(x));
add= (n,m)->f->x->n(f)(m(f)(x));
mul= (n,m)->f->n(m(f));
power= (n,m) -> m(n); \\ try with spaces
dec= n->f->x-> n (g->h->h (g(f))) (u->x) (u->u);
sub= (n,m)->m(dec)(n);
mod= (n,b)->n(a->(aa->sub(aa,b)(zero)(aa)) (inc(a))) (zero)
disp=n->n(x->1+x)(0);
num(n)=if(n,inc(num(n-1)),zero)