From 28d5e4d213f464c49af40860ad237c593f925e33 Mon Sep 17 00:00:00 2001 From: clean Date: Thu, 8 Jun 2000 11:27:41 +0000 Subject: JVG: changed mapSt function into macro git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@153 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d --- frontend/utilities.dcl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'frontend/utilities.dcl') 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) -- cgit v1.2.3