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
48f31143
Commit
48f31143
authored
Nov 13, 2014
by
Yiannis Tsiouris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all stat numbers/lists strings
parent
540e897d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
Table.hs
Table.hs
+15
-15
No files found.
Table.hs
View file @
48f31143
...
@@ -14,8 +14,8 @@ module Table( new
...
@@ -14,8 +14,8 @@ module Table( new
,
max_freq
,
max_freq
,
avg_freq
,
avg_freq
,
avg_nonempty_freq
,
avg_nonempty_freq
--
, freq_to_stat
,
freq_to_stat
--
, freq_from_stat
,
freq_from_stat
,
fill_deg
)
where
,
fill_deg
)
where
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
...
@@ -95,28 +95,28 @@ sum_freqs2 (n : f) (m : sumF) = n + m : sum_freqs2 f sumF
...
@@ -95,28 +95,28 @@ sum_freqs2 (n : f) (m : sumF) = n + m : sum_freqs2 f sumF
sum_freqs
::
[
Freq
]
->
Freq
sum_freqs
::
[
Freq
]
->
Freq
sum_freqs
fs
=
foldl
(
flip
sum_freqs2
)
[]
fs
sum_freqs
fs
=
foldl
(
flip
sum_freqs2
)
[]
fs
{- XXX: Fix below functions to type-check!
-- freq_to_stat produces a readable statistics from a table fill frequency;
-- freq_to_stat produces a readable statistics from a table fill frequency;
-- the input frequency F is itself part of the statistics
-- the input frequency F is itself part of the statistics
freq_to_stat :: Freq -> [(String, a)]
freq_to_stat
::
Freq
->
[(
String
,
String
)]
freq_to_stat frequency = [ --("freq", frequency)
freq_to_stat
frequency
=
[
(
"freq"
,
show
frequency
)
("size", freq_to_vertices frequency)
,
(
"size"
,
show
$
freq_to_vertices
frequency
)
, ("slots", freq_to_slots frequency)
,
(
"slots"
,
show
$
freq_to_slots
frequency
)
, ("nonempty_slots", freq_to_nonempty_slots frequency)
,
(
"nonempty_slots"
,
, ("fill_deg", fill_deg frequency)
show
$
freq_to_nonempty_slots
frequency
)
, ("max_freq", max_freq frequency)
,
(
"fill_deg"
,
show
$
fill_deg
frequency
)
, ("avg_freq", avg_freq frequency)
,
(
"max_freq"
,
show
$
max_freq
frequency
)
, ("nonempty_avg_freq", avg_nonempty_freq frequency)
,
(
"avg_freq"
,
show
$
avg_freq
frequency
)
,
(
"nonempty_avg_freq"
,
show
$
avg_nonempty_freq
frequency
)
]
]
-- freq_from_stat extracts a table fill frequency from a statistics Stat
-- freq_from_stat extracts a table fill frequency from a statistics Stat
-- (assuming Stat was produced by freq_to_stat/1, otherwise returns []);
-- (assuming Stat was produced by freq_to_stat/1, otherwise returns []);
freq_from_stat :: [(String,
a
)] -> Freq
freq_from_stat
::
[(
String
,
String
)]
->
Freq
freq_from_stat
stat
=
freq_from_stat
stat
=
case
"freq"
`
lookup
`
stat
of
case
"freq"
`
lookup
`
stat
of
Just val ->
val
Just
val
->
read
val
::
[
Int
]
Nothing
->
[]
Nothing
->
[]
-}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- auxiliary functions
-- auxiliary functions
...
...
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