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
e73a625e
Commit
e73a625e
authored
Nov 21, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
funclang taddeus series 3: prettified nth function.
parent
e3902d0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
funclang-taddeus/series3/ass7.ml
funclang-taddeus/series3/ass7.ml
+3
-4
No files found.
funclang-taddeus/series3/ass7.ml
View file @
e73a625e
...
...
@@ -2,10 +2,9 @@ open List
(* 1 *)
let
rec
nth
l
n
=
match
n
with
|
0
->
hd
l
|
i
when
i
>
0
&&
i
<
(
length
l
)
->
nth
(
tl
l
)
(
i
-
1
)
|
_
->
raise
(
Failure
"list index out of bounds"
)
match
l
with
|
[]
->
raise
(
Failure
"list index out of bounds"
)
|
h
::
t
->
if
n
=
0
then
h
else
nth
t
(
n
-
1
)
;;
(* 2 *)
...
...
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