Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LIFPF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
LANDAIS QUENTIN p2103541
LIFPF
Commits
d369c096
Commit
d369c096
authored
1 year ago
by
COQUERY EMMANUEL
Browse files
Options
Downloads
Patches
Plain Diff
Ajout corrigé ccf-2023p-s1
parent
47f77aeb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+4
-0
4 additions, 0 deletions
README.md
annales/ccf-2023p-s1-corrige.ml
+94
-0
94 additions, 0 deletions
annales/ccf-2023p-s1-corrige.ml
annales/ccf-2023p-s1.pdf
+0
-0
0 additions, 0 deletions
annales/ccf-2023p-s1.pdf
with
98 additions
and
0 deletions
README.md
+
4
−
0
View file @
d369c096
...
...
@@ -30,6 +30,10 @@
| 24/04 | 9h45 ou 11h15 | TP |
[
Sujet
](
tp/tp8.md
)
, corrigé calculette programmable:
[
sans
](
tp/tp8.ml
)
ou
[
avec
](
tp/tp8b.ml
)
fonctions natives |
| 23/05 | 14h | ECA | Attention, c'est un mardi après-midi |
### Annales
-
[
Printemps 2023, session 1
](
annales/ccf-2023p-s1.pdf
)
,
[
corrigé
](
annales/ccf-2023p-s1-corrige.ml
)
### Évaluation
-
4 QCMs + 1 contrôle en TD: 60 %
...
...
This diff is collapsed.
Click to expand it.
annales/ccf-2023p-s1-corrige.ml
0 → 100644
+
94
−
0
View file @
d369c096
(* Listes et paires *)
(* Questions 1 & 2 *)
let
rec
map2
(
f
:
'
a
->
'
b
->
'
c
)
(
l1
:
'
a
list
)
(
l2
:
'
b
list
)
:
'
c
list
=
match
(
l1
,
l2
)
with
|
[]
,
_
->
[]
|
_
,
[]
->
[]
|
x1
::
l1'
,
x2
::
l2'
->
f
x1
x2
::
map2
f
l1'
l2'
(* Questions 3 & 4 *)
let
rec
zip
(
l1
:
'
a
list
)
(
l2
:
'
b
list
)
:
(
'
a
*
'
b
)
list
=
match
(
l1
,
l2
)
with
|
[]
,
_
->
[]
|
_
,
[]
->
[]
|
x1
::
l1'
,
x2
::
l2'
->
(
x1
,
x2
)
::
zip
l1'
l2'
(* Questions 5 & 6 *)
let
unzip
(
l
:
(
'
a
*
'
b
)
list
)
:
'
a
list
*
'
b
list
=
List
.
fold_right
(
fun
p
pl
->
(
fst
p
::
fst
pl
,
snd
p
::
snd
pl
))
l
([]
,
[]
)
(* Question 7 *)
let
map2
(
f
:
'
a
->
'
b
->
'
c
)
(
l1
:
'
a
list
)
(
l2
:
'
b
list
)
:
'
c
list
=
List
.
map
(
fun
p
->
f
(
fst
p
)
(
snd
p
))
(
zip
l1
l2
)
(* Expressions booléennes *)
(* Question 8 *)
type
boolexpr
=
|
Var
of
string
|
Vrai
|
Non
of
boolexpr
|
Et
of
boolexpr
*
boolexpr
(* Questions 9 & 10 *)
let
rec
eval
(
env
:
(
string
*
bool
)
list
)
(
expr
:
boolexpr
)
:
bool
option
=
match
expr
with
|
Var
v
->
List
.
assoc_opt
v
env
|
Vrai
->
Some
true
|
Non
expr'
->
(
match
eval
env
expr'
with
|
None
->
None
|
Some
b
->
Some
(
not
b
))
|
Et
(
expr1
,
expr2
)
->
(
match
(
eval
env
expr1
,
eval
env
expr2
)
with
|
Some
b1
,
Some
b2
->
Some
(
b1
&&
b2
)
|
_
,
_
->
None
)
(* Modules et arbres de recherche *)
(* Donné dans l'énoncé *)
module
type
Cmp
=
sig
type
t
type
cmp_t
=
Lt
|
Gt
|
Eq
val
cmp
:
t
->
t
->
cmp_t
end
(* Question 11 *)
module
type
ENS_T
=
sig
type
ens
type
elt
val
appartient
:
elt
->
ens
->
bool
val
insere
:
elt
->
ens
->
ens
end
module
ABR_T
(
M
:
Cmp
)
:
ENS_T
with
type
elt
=
M
.
t
=
struct
(* Question 12 *)
type
ens
=
Vide
|
Noeud
of
(
M
.
t
*
ens
*
ens
)
type
elt
=
M
.
t
(* Question 13 *)
let
rec
appartient
v
a
=
match
a
with
|
Vide
->
false
|
Noeud
(
v2
,
fg
,
fd
)
->
(
match
M
.
cmp
v
v2
with
|
Lt
->
appartient
v
fg
|
Gt
->
appartient
v
fd
|
Eq
->
true
)
(* Question 14 *)
let
rec
insere
v
a
=
match
a
with
|
Vide
->
Noeud
(
v
,
Vide
,
Vide
)
|
Noeud
(
v2
,
fg
,
fd
)
->
(
match
M
.
cmp
v
v2
with
|
Lt
->
Noeud
(
v2
,
insere
v
fg
,
fd
)
|
Gt
->
Noeud
(
v2
,
fg
,
insere
v
fd
)
|
Eq
->
a
)
end
This diff is collapsed.
Click to expand it.
annales/ccf-2023p-s1.pdf
0 → 100644
+
0
−
0
View file @
d369c096
File added
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