Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cleanplatform
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
18
Issues
18
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cleananditasks
cleanplatform
Commits
16c32f16
Commit
16c32f16
authored
Jan 03, 2018
by
Steffen Michels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function from iTasks examples to Data.List
parent
c28cd6c8
Pipeline
#8760
passed with stage
in 1 minute and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Sidebyside
Showing
2 changed files
with
29 additions
and
0 deletions
+29
0
src/libraries/OSIndependent/Data/List.dcl
src/libraries/OSIndependent/Data/List.dcl
+12
0
src/libraries/OSIndependent/Data/List.icl
src/libraries/OSIndependent/Data/List.icl
+17
0
No files found.
src/libraries/OSIndependent/Data/List.dcl
View file @
16c32f16
...
...
@@ 135,6 +135,13 @@ intersectBy :: (a > b > .Bool) !.[a] !.[b] > .[a]
union
::
u
:(.[
a
]
>
v
:(.[
a
]
>
.[
a
]))

==
a
,
[
v
<=
u
]
unionBy
::
(
a
>
.(
a
>
.
Bool
))
!.[
a
]
.[
a
]
>
.[
a
]
/** hasDup @as = True:
@as has at least one element that occurs twice.
hasDup @as = False:
@as has no elements that occur twice.
*/
hasDup
::
![
a
]
>
Bool

Eq
a
isMemberGen
::
!
a
!.[
a
]
>
Bool

gEq
{*}
a
strictFoldr
::
!(.
a
>
.(.
b
>
.
b
))
!.
b
![.
a
]
>
.
b
...
...
@@ 160,3 +167,8 @@ strictTRZip2Acc :: ![a] ![b] ![(!a, !b)] > [(!a, !b)]
strictTRZipWith3
::
!(
a
b
c
>
d
)
![
a
]
![
b
]
![
c
]
>
[
d
]
strictTRZipWith3Rev
::
!(
a
b
c
>
d
)
![
a
]
![
b
]
![
c
]
>
[
d
]
strictTRZipWith3Acc
::
!(
a
b
c
>
d
)
![
a
]
![
b
]
![
c
]
![
d
]
>
[
d
]
// variants of the fold functions that use a queue instead of a fixed size list:
qfoldl
::
(
a
>
b
>
[
b
])
(
a
>
b
>
a
)
a
![
b
]
>
a
qfoldr
::
(
a
>
b
>
[
b
])
(
b
>
a
>
a
)
a
![
b
]
>
a
src/libraries/OSIndependent/Data/List.icl
View file @
16c32f16
...
...
@@ 389,6 +389,10 @@ union = unionBy (==)
unionBy
::
(
a
>
.(
a
>
.
Bool
))
!.[
a
]
.[
a
]
>
.[
a
]
unionBy
eq
xs
ys
=
xs
++
foldl
(
flip
(
deleteBy
eq
))
(
nubBy
eq
ys
)
xs
hasDup
::
![
a
]
>
Bool

Eq
a
hasDup
[]
=
False
hasDup
[
x
:
xs
]
=
isMember
x
xs

hasDup
xs
isMemberGen
::
!
a
!.[
a
]
>
Bool

gEq
{*}
a
isMemberGen
x
[
hd
:
tl
]
=
hd
===
x

isMemberGen
x
tl
isMemberGen
x
[]
=
False
...
...
@@ 496,3 +500,16 @@ strictTRZipWith3Acc :: !(a b c > d) ![a] ![b] ![c] ![d] > [d]
strictTRZipWith3Acc
f
[
a
:
as
]
[
b
:
bs
]
[
c
:
cs
]
acc
=
strictTRZipWith3Acc
f
as
bs
cs
[
f
a
b
c
:
acc
]
strictTRZipWith3Acc
_
_
_
_
acc
=
acc
qfoldl
::
(
a
>
b
>
[
b
])
(
a
>
b
>
a
)
a
![
b
]
>
a
qfoldl
_
_
a
[]
=
a
qfoldl
f
g
a
[
b
:
bs
]
=
let
a`
=
g
a
b
in
qfoldl
f
g
a`
(
bs
++
f
a`
b
)
qfoldr
::
(
a
>
b
>
[
b
])
(
b
>
a
>
a
)
a
![
b
]
>
a
qfoldr
_
_
a
[]
=
a
qfoldr
f
g
a
[
b
:
bs
]
=
let
a`
=
g
b
a
in
qfoldr
f
g
a`
(
bs
++
f
a`
b
)
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