Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scala2020
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
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
joel.vonderwe
scala2020
Commits
29933c50
Commit
29933c50
authored
5 years ago
by
joel.vonderwe
Browse files
Options
Downloads
Patches
Plain Diff
Changed Predicate type
parent
bd334772
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
base_tp/src/lambda/lambda.scala
+5
-5
5 additions, 5 deletions
base_tp/src/lambda/lambda.scala
with
5 additions
and
5 deletions
base_tp/src/lambda/lambda.scala
+
5
−
5
View file @
29933c50
...
...
@@ -12,7 +12,7 @@ object Predicates {
* La méthode 'not' retourne un nouveau prédicat dont le résultat
* est toujours la négation du résultat de l'argument.
*/
def
not
[
A
](
p
:
(
A
)=>
Boolean
)
:
(
A
)=>
Boolean
=
{
(
a
:
A
)
=>
def
not
[
A
](
p
:
P
[
A
]
)
:
P
[
A
]
=
{
(
a
:
A
)
=>
!
p
(
a
)
}
...
...
@@ -20,7 +20,7 @@ object Predicates {
* La méthode 'and' retourne un nouveau prédicat dont le résultat
* est toujours la conjonction des résultats des deux arguments.
*/
def
and
[
A
](
p1
:
(
A
)=>
Boolean
,
p2
:
(
A
)=>
Boolean
)
:
(
A
)=>
Boolean
=
{
(
a
:
A
)
=>
def
and
[
A
](
p1
:
P
[
A
],
p2
:
P
[
A
]
)
:
P
[
A
]
=
{
(
a
:
A
)
=>
p1
(
a
)
&&
p2
(
a
)
}
...
...
@@ -28,7 +28,7 @@ object Predicates {
* La fonction 'or' retourne un nouveau prédicat dont le résultat
* est toujours la disjonction des résultats des deux arguments.
*/
def
or
[
A
](
p1
:
(
A
)=>
Boolean
,
p2
:
(
A
)=>
Boolean
)
:
(
A
)=>
Boolean
=
{
(
a
:
A
)
=>
def
or
[
A
](
p1
:
P
[
A
],
p2
:
P
[
A
]
)
:
P
[
A
]
=
{
(
a
:
A
)
=>
p1
(
a
)
||
p2
(
a
)
}
...
...
@@ -37,7 +37,7 @@ object Predicates {
* résultat est vrai si au moins un des prédicat de l'argument est
* vrai.
*/
def
exists
[
A
](
ps
:
List
[
(
A
)
=>
Boolean
]
)
:
(
A
)=>
Boolean
=
{
(
a
:
A
)
=>
def
exists
[
A
](
ps
:
List
[
P
[
A
]]
)
:
P
[
A
]
=
{
(
a
:
A
)
=>
ps
match
{
case
p
::
Nil
=>
p
(
a
)
case
p
::
_
if
p
(
a
)
=>
true
...
...
@@ -50,7 +50,7 @@ object Predicates {
* résultat est vrai si et seulement si tous les prédicats de
* l'argument sont vrais.
*/
def
forall
[
A
](
ps
:
List
[
(
A
)
=>
Boolean
]
)
:
(
A
)=>
Boolean
=
{
(
a
:
A
)
=>
def
forall
[
A
](
ps
:
List
[
P
[
A
]]
)
:
P
[
A
]
=
{
(
a
:
A
)
=>
ps
match
{
case
p
::
Nil
=>
p
(
a
)
case
p
::
_
if
!
p
(
a
)
=>
false
...
...
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