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
47
48
49
50
51
52
53
54
55
56
|
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input patmatch.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1991.
@
<<*>>=
<<license>>
)cl all
p := 3 * n ** 2 + 1
q := 3 * n% ** 2 + 1
a := roman 49
b := roman IV
c := a - 1
Is(a, p)
Is(a, q)
Is(b, p)
Is(b, q)
Is(c, p)
Is(c, q)
ab := a / b
pq := p / q
Is(ab, pq)
ab := rational ab
a := rational a
--Is([ab, a], [pq, _:l, p])
--Is([ab, a], [pq, _:l%, p])
--Is([ab, 1, 2, a], [pq, _:l, p])
-- foo?(x:LIST FRAC INT):BOOLEAN == odd? _# x
-- qq := suchThat(_:l%, foo?)
-- Is([ab, 1, 2, a], [pq, qq, p])
-- Is([ab, 1, 2, 3, a], [pq, qq, p])
-- creating streams using pattern matching
-- want the streams of all primes of the form m**2+1
bar?(n:INT):BOOLEAN == prime? n and is?(n, m**2 + 1)
myprimes := [i for i in 1.. | bar? i]
p := x**2 + 3*x + 1
Is(p, n * y**2 + (2*n+1)*y + 1)
Is(p, n% * y**2 + (2*n%+1)*y + 1)
Is(3*x**2 + 9*x + 1, n * y**2 + n**2 * y + 1)
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}
|