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
1229ac92
Commit
1229ac92
authored
Nov 16, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
funclang series3: implemented challenge.
parent
55f38f26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
funclang-taddeus/series3/ass7.ml
funclang-taddeus/series3/ass7.ml
+13
-6
No files found.
funclang-taddeus/series3/ass7.ml
View file @
1229ac92
...
...
@@ -13,13 +13,10 @@ let heads l = map hd l;;
(* 3 *)
let
zip
l
m
=
let
rec
cut
l
e
=
let
len
=
(
length
l
)
in
if
e
=
len
then
l
else
cut
(
rev
(
tl
(
rev
l
)))
e
in
let
rec
cut
l
e
=
if
e
=
(
length
l
)
then
l
else
cut
(
rev
(
tl
(
rev
l
)))
e
in
let
min
a
b
=
if
a
>
b
then
b
else
a
in
let
len
=
min
(
length
l
)
(
length
m
)
in
List
.
combine
(
cut
l
len
)
(
cut
m
len
)
combine
(
cut
l
len
)
(
cut
m
len
)
;;
(* 4 *)
...
...
@@ -51,4 +48,14 @@ let rec lookup l key =
;;
(* Challenge *)
let
rec
coin_permutation
l
n
=
let
perms
coin
l
=
match
coin
with
|
i
when
i
<
n
->
1
+
(
coin_permutation
l
(
n
-
coin
))
|
i
when
i
=
n
->
1
|
_
->
0
in
match
l
with
|
[]
->
0
|
h
::
t
->
(
perms
h
t
)
+
(
coin_permutation
t
n
)
;;
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