Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
ec692865
Commit
ec692865
authored
Nov 14, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
funclang series2: Added error messages to exceptions.
parent
01680d11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
funclang-taddeus/series2/ass5.ml
funclang-taddeus/series2/ass5.ml
+2
-2
No files found.
funclang-taddeus/series2/ass5.ml
View file @
ec692865
...
@@ -17,7 +17,7 @@ test_isLeapYear 1904 true;;
...
@@ -17,7 +17,7 @@ test_isLeapYear 1904 true;;
(* Give a proper English character string representation of a date *)
(* Give a proper English character string representation of a date *)
let
date2str
day
month
year
=
let
date2str
day
month
year
=
if
day
<
1
||
day
>
31
||
month
<
1
||
month
>
12
||
year
<
0
then
if
day
<
1
||
day
>
31
||
month
<
1
||
month
>
12
||
year
<
0
then
raise
Exit
raise
(
Failure
"invalid date"
)
else
else
(* Get the textual postfix of a day number *)
(* Get the textual postfix of a day number *)
let
getDayPostfix
day
=
let
getDayPostfix
day
=
...
@@ -45,7 +45,7 @@ test_date2str 9 2 2010 "February 9th, 2010";;
...
@@ -45,7 +45,7 @@ test_date2str 9 2 2010 "February 9th, 2010";;
(* Sum all digits of a natural number *)
(* Sum all digits of a natural number *)
let
rec
sum_digits
n
=
let
rec
sum_digits
n
=
if
n
<
0
then
raise
Exit
else
if
n
<
0
then
raise
(
Failure
"cannot sum digits in integers below 0"
)
else
let
str
=
string_of_int
n
in
let
str
=
string_of_int
n
in
let
l
=
String
.
length
str
in
let
l
=
String
.
length
str
in
if
l
=
1
then
if
l
=
1
then
...
...
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