Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-libraries
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-libraries
Commits
60da2abd
Commit
60da2abd
authored
Aug 14, 2018
by
John van Groningen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add module StdFunctions, contains the part of module StdFunc that will be part of the future StdEnv
parent
39562ea5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
Libraries/StdEnv/StdFunctions.dcl
Libraries/StdEnv/StdFunctions.dcl
+20
-0
Libraries/StdEnv/StdFunctions.icl
Libraries/StdEnv/StdFunctions.icl
+39
-0
No files found.
Libraries/StdEnv/StdFunctions.dcl
0 → 100644
View file @
60da2abd
definition
module
StdFunctions
// ****************************************************************************************
// Concurrent Clean Standard Library Module Version 3.0
// Copyright 2018 Radboud University
// ****************************************************************************************
id
::
!.
a
->
.
a
// identity function
const
::
!.
a
.
b
->
.
a
// constant function
//flip :: !.(.a -> .(.b -> .c)) .b .a -> .c // Flip arguments
flip
f
a
b
:==
f
b
a
(
o
)
infixr
9
// :: u:(.a -> .b) u:(.c -> .a) -> u:(.c -> .b) // Function composition
(
o
)
f
g
:==
\
x
->
f
(
g
x
)
twice
::
!(.
a
->
.
a
)
.
a
->
.
a
// f (f x)
while
::
!(
a
->
.
Bool
)
(
a
->
a
)
a
->
a
// while (p x) f (f x)
until
::
!(
a
->
.
Bool
)
(
a
->
a
)
a
->
a
// f (f x) until (p x)
iter
::
!
Int
(.
a
->
.
a
)
.
a
->
.
a
// f (f..(f x)..)
Libraries/StdEnv/StdFunctions.icl
0 → 100644
View file @
60da2abd
implementation
module
StdFunctions
// ****************************************************************************************
// Concurrent Clean Standard Library Module Version 3.0
// Copyright 2018 Radbound University
// ****************************************************************************************
import
StdClass
,
StdMisc
,
StdInt
id
::
!.
a
->
.
a
id
x
=
x
const
::
!.
a
.
b
->
.
a
const
x
y
=
x
//flip::!.(.a -> .(.b -> .c)) .b .a -> .c
flip
f
a
b
:==
f
b
a
(
o
)
infixr
9
;
// :: u:(.a -> .b) u:(.c -> .a) -> u:(.c -> .b)
(
o
)
f
g
:==
\
x
->
f
(
g
x
)
twice
::
!(.
a
->
.
a
)
.
a
->
.
a
twice
f
x
=
f
(
f
x
)
while
::
!(
a
->
.
Bool
)
(
a
->
a
)
a
->
a
while
p
f
x
|
p
x
=
while
p
f
(
f
x
)
=
x
until
::!(
a
->
.
Bool
)
(
a
->
a
)
a
->
a
until
p
f
x
|
p
x
=
x
=
until
p
f
(
f
x
)
iter
::
!
Int
(.
a
->
.
a
)
.
a
->
.
a
iter
0
f
x
=
x
iter
n
f
x
|
n
>
0
=
iter
(
n
-1
)
f
(
f
x
)
=
abort
"Error: Negative index given to iter."
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