Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
nofib
Commits
96447051
Commit
96447051
authored
May 18, 1997
by
sof
Browse files
[project @ 19970518 01:38:54 by sof]
Type signatures added
parent
133dbf62
Changes
1
Hide whitespace changes
Inline
Sidebyside
imaginary/paraffins/Main.hs
View file @
96447051
...
...
@@ 12,18 +12,21 @@ import Array
data
Radical
=
H

C
Radical
Radical
Radical
three_partitions
::
Int
>
[(
Int
,
Int
,
Int
)]
three_partitions
m
=
[
(
i
,
j
,
k
)

i
<
[
0
..
(
div
m
3
)],
j
<
[
i
..
(
div
(
m

i
)
2
)],
k
<
[
m

(
i
+
j
)]]
remainders
[]
=
[]
remainders
(
r
:
rs
)
=
(
r
:
rs
)
:
(
remainders
rs
)
radical_generator
::
Int
>
Array
Int
[
Radical
]
radical_generator
n
=
radicals
where
radicals
=
array
(
0
,
n
)
((
0
,[
H
])
:
[(
j
,
rads_of_size_n
radicals
j
)

j
<
[
1
..
n
]])
rads_of_size_n
::
Array
Int
[
Radical
]
>
Int
>
[
Radical
]
rads_of_size_n
radicals
n
=
[
(
C
ri
rj
rk
)

(
i
,
j
,
k
)
<
(
three_partitions
(
n

1
)),
...
...
@@ 35,19 +38,22 @@ rads_of_size_n radicals n =
data
Paraffin
=
BCP
Radical
Radical

CCP
Radical
Radical
Radical
Radical
bcp_generator
::
Array
Int
[
Radical
]
>
Int
>
[
Paraffin
]
bcp_generator
radicals
n
=
if
(
odd
n
)
then
[]
else
[
(
BCP
r1
r2
)

(
r1
:
r1s
)
<
(
remainders
(
radicals
!
(
div
n
2
))),
r2
<
(
r1
:
r1s
)
]
four_partitions
::
Int
>
[(
Int
,
Int
,
Int
,
Int
)]
four_partitions
m
=
[
(
i
,
j
,
k
,
l
)

i
<
[
0
..
(
div
m
4
)],
j
<
[
i
..
(
div
(
m

i
)
3
)],
k
<
[(
max
j
(
ceiling
((
fromInteg
e
r
m
)
/
(
fromInt
eger
2
))

i

j
))
..
(
div
(
m

i

j
)
2
)],
k
<
[(
max
j
(
ceiling
((
fromIntegr
al
m
)
/
(
fromInt
2
))

i

j
))
..
(
div
(
m

i

j
)
2
)],
l
<
[(
m

(
i
+
j
+
k
))]]
ccp_generator
::
Array
Int
[
Radical
]
>
Int
>
[
Paraffin
]
ccp_generator
radicals
n
=
[
(
CCP
ri
rj
rk
rl
)

(
i
,
j
,
k
,
l
)
<
(
four_partitions
(
n

1
)),
...
...
@@ 56,16 +62,19 @@ ccp_generator radicals n =
(
rk
:
rks
)
<
(
remainders
(
if
(
j
==
k
)
then
(
rj
:
rjs
)
else
radicals
!
k
)),
rl
<
(
if
(
k
==
l
)
then
(
rk
:
rks
)
else
radicals
!
l
)]
bcp_until
::
Int
>
[
Int
]
bcp_until
n
=
[
length
(
bcp_generator
radicals
j
)

j
<
[
1
..
n
]]
where
radicals
=
radical_generator
(
div
n
2
)
ccp_until
::
Int
>
[
Int
]
ccp_until
n
=
[
length
(
ccp_generator
radicals
j
)

j
<
[
1
..
n
]]
where
radicals
=
radical_generator
(
div
n
2
)
paraffins_until
::
Int
>
[
Int
]
paraffins_until
n
=
[
length
(
bcp_generator
radicals
j
)
+
length
(
ccp_generator
radicals
j
)

j
<
[
1
..
n
]]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment