-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdegree-gpe.sls
46 lines (32 loc) · 925 Bytes
/
degree-gpe.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!r6rs
(library (mpl degree-gpe)
(export degree-gpe)
(import (rnrs)
(only (surfage s1 lists) every)
(mpl misc)
(mpl contains)
)
(define (degree-monomial-gpe u v)
(cond ( (every (is-free? u) v) 0 )
( (member u v) 1 )
( (and (power? u)
(let ((n (list-ref u 2)))
(integer? n)
(> n 1)))
(list-ref u 2) )
( (product? u)
(apply +
(map
(lambda (elt)
(degree-monomial-gpe elt v))
(cdr u))) )
( else 0 )))
(define (degree-gpe u v)
(cond ( (sum? u)
(apply max
(map
(lambda (elt)
(degree-monomial-gpe elt v))
(cdr u))) )
( else (degree-monomial-gpe u v) )))
)