Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-orbit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Katerina Roukounaki
cloud-orbit
Commits
bf5f7959
Commit
bf5f7959
authored
10 years ago
by
Yiannis Tsiouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor polishing
parent
99da29a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Table.hs
Table.hs
+5
-5
No files found.
Table.hs
View file @
bf5f7959
...
...
@@ -76,22 +76,22 @@ avg_freq f = (fi $ freq_to_vertices f) / (fi $ freq_to_slots f)
-- avg_nonempty_freq returns the average fill frequency of non empty slots.
avg_nonempty_freq
::
Freq
->
Float
avg_nonempty_freq
f
=
case
freq_to_vertices
f
of
verts
|
verts
>
0
->
(
fi
verts
)
/
(
fi
$
freq_to_nonempty_slots
f
)
otherwise
->
0.0
if
verts
>
0
then
(
fi
verts
)
/
(
fi
$
freq_to_nonempty_slots
f
)
else
0.0
where
verts
=
freq_to_vertices
f
-- fill_deg determines the filling degree of the table.
fill_deg
::
Freq
->
Float
fill_deg
f
=
(
fi
$
freq_to_nonempty_slots
f
)
/
(
fi
$
freq_to_slots
f
)
-- sum_freqs/2 sums two fill frequencies.
sum_freqs2
::
Freq
->
Freq
->
[
Int
]
sum_freqs2
::
Freq
->
Freq
->
Freq
sum_freqs2
[]
sumF
=
sumF
sum_freqs2
f
[]
=
f
sum_freqs2
(
n
:
f
)
(
m
:
sumF
)
=
n
+
m
:
sum_freqs2
f
sumF
-- sum_freqs/1 sums a list of fill frequencies.
sum_freqs
::
[
Freq
]
->
[
Int
]
sum_freqs
::
[
Freq
]
->
Freq
sum_freqs
fs
=
foldl
(
flip
sum_freqs2
)
[]
fs
{- XXX: Fix below functions to type-check!
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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