diff options
author | clean | 2000-06-08 11:27:41 +0000 |
---|---|---|
committer | clean | 2000-06-08 11:27:41 +0000 |
commit | 28d5e4d213f464c49af40860ad237c593f925e33 (patch) | |
tree | 2910327e5bd0b20300da13dea6160e530129090a /frontend/utilities.dcl | |
parent | coercions added though not complete (diff) |
JVG: changed mapSt function into macro
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@153 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/utilities.dcl')
-rw-r--r-- | frontend/utilities.dcl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/frontend/utilities.dcl b/frontend/utilities.dcl index 66c2866..66bdc2f 100644 --- a/frontend/utilities.dcl +++ b/frontend/utilities.dcl @@ -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) |