Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
9b9d4fc0
Commit
9b9d4fc0
authored
Jun 08, 2000
by
clean
Browse files
JVG: changed mapSt function into macro
parent
cb5aca9f
Changes
2
Show whitespace changes
Inline
Side-by-side
frontend/utilities.dcl
View file @
9b9d4fc0
...
...
@@ -26,7 +26,22 @@ isSpecialChar :: ! Char -> Bool
isNotEmpty
::
![
a
]
->
Bool
mapSt
::
!(.
a
->
(.
st
->
(.
c
,.
st
)))
![.
a
]
!.
st
->
(![.
c
],!.
st
)
//mapSt :: !(.a -> (.st -> (.c,.st))) ![.a] !.st -> (![.c],!.st)
mapSt
f
l
s
:==
mapSt
l
s
where
mapSt
[
x
:
xs
]
s
#
(
x
,
s
)
=
f
x
s
mapSt_result
=
mapSt
xs
s
(
xs
,
_)
=
mapSt_result
#!
s
=
second_of_2_tuple
mapSt_result
=
([
x
:
xs
],
s
)
mapSt
[]
s
=
([],
s
)
second_of_2_tuple
t
:==
e2
where
(_,
e2
)
=
t
app2St
::
!(!.(.
a
->
.(.
st
->
(.
c
,.
st
))),!.(.
e
->
.(.
st
->
(.
f
,.
st
))))
!(.
a
,.
e
)
!.
st
->
(!(.
c
,.
f
),!.
st
)
...
...
frontend/utilities.icl
View file @
9b9d4fc0
...
...
@@ -113,6 +113,7 @@ mapAppendSt f [x : xs] tail s
mapAppendSt
f
[]
tail
s
=
(
tail
,
s
)
/*
mapSt :: !(.a -> (.st -> (.c,.st))) ![.a] !.st -> (![.c],!.st)
mapSt f [x : xs] s
# (x, s) = f x s
...
...
@@ -120,6 +121,22 @@ mapSt f [x : xs] s
= ([x : xs], s)
mapSt f [] s
= ([], s)
*/
//mapSt :: !(.a -> (.st -> (.c,.st))) ![.a] !.st -> (![.c],!.st)
mapSt
f
l
s
:==
mapSt
l
s
where
mapSt
[
x
:
xs
]
s
#
(
x
,
s
)
=
f
x
s
mapSt_result
=
mapSt
xs
s
(
xs
,
_)
=
mapSt_result
#!
s
=
second_of_2_tuple
mapSt_result
=
([
x
:
xs
],
s
)
mapSt
[]
s
=
([],
s
)
second_of_2_tuple
t
:==
e2
where
(_,
e2
)
=
t
app2St
::
!(!.(.
a
->
.(.
st
->
(.
c
,.
st
))),!.(.
e
->
.(.
st
->
(.
f
,.
st
))))
!(.
a
,.
e
)
!.
st
->
(!(.
c
,.
f
),!.
st
)
app2St
(
f
,
g
)
(
x
,
y
)
s
...
...
Write
Preview
Supports
Markdown
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