Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
uva
Commits
252c4068
Commit
252c4068
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
funclang series4: Source code cleanup.
parent
18b75311
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
funclang-taddeus/series4/ass10.ml
+1
-0
1 addition, 0 deletions
funclang-taddeus/series4/ass10.ml
funclang-taddeus/series4/ass8.ml
+5
-7
5 additions, 7 deletions
funclang-taddeus/series4/ass8.ml
with
6 additions
and
7 deletions
funclang-taddeus/series4/ass10.ml
+
1
−
0
View file @
252c4068
...
...
@@ -11,6 +11,7 @@ type expr =
|
Id
of
string
|
Const
of
const
(* Test function that returns converts a typed expression to a string *)
let
rec
eval_expr
=
let
eval_bin_op
=
let
eval_arith_op
=
function
...
...
This diff is collapsed.
Click to expand it.
funclang-taddeus/series4/ass8.ml
+
5
−
7
View file @
252c4068
...
...
@@ -3,24 +3,23 @@ open List
(* Sort a list l using the quicksort algorithm *)
let
rec
quickSort
(
l
:
int
list
)
=
match
l
with
|
([]
|
[
_
])
->
l
([]
|
[
_
])
->
l
|
pivot
::
rest
->
let
cmp
x
=
x
<
pivot
in
let
low
,
high
=
partition
cmp
rest
in
quickSort
low
@
pivot
::
quickSort
high
;;
(* Sort a list l using the merge sort algorithm *)
let
rec
mergeSort
(
l
:
int
list
)
=
match
l
with
(* If the list is of length 0 or 1, then it is already sorted *)
|
([]
|
[
_
])
->
l
([]
|
[
_
])
->
l
|
_
->
let
rec
merge
a
b
=
match
a
with
|
[]
->
b
[]
->
b
|
ha
::
ta
->
match
b
with
|
[]
->
a
[]
->
a
|
hb
::
tb
->
if
ha
<
hb
then
ha
::
(
merge
ta
b
)
else
hb
::
(
merge
a
tb
)
in
...
...
@@ -30,10 +29,9 @@ let rec mergeSort (l : int list) =
(
left
,
right
)
else
match
left
with
|
[]
->
(
left
,
right
)
[]
->
(
left
,
right
)
(* Put one element of left into right list *)
|
h
::
t
->
split
t
(
h
::
right
)
in
let
left
,
right
=
split
l
[]
in
merge
(
mergeSort
left
)
(
mergeSort
right
)
;;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment