--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Fri Jul 15 10:40:43 1994
--* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311)
--*           id AA30843; Fri, 15 Jul 1994 10:40:43 -0400
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 6305; Fri, 15 Jul 94 10:40:46 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.BERNARDI.NOTE.YKTVMV.0187.Jul.15.10:40:46.-0400>
--*           for asbugs@watson; Fri, 15 Jul 94 10:40:46 -0400
--* Received: from inf.ethz.ch by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Fri, 15 Jul 94 10:40:46 EDT
--* Received: from ru7.inf.ethz.ch (ru7.inf.ethz.ch [129.132.12.16]) by inf.ethz.ch (8.6.9/8.6.9) with ESMTP id QAA05109 for <asbugs@watson.ibm.com>; Fri, 15 Jul 1994 16:40:41 +0200
--* Received: (bernardi@localhost) by ru7.inf.ethz.ch (8.6.8/8.6.6) id QAA08908 for asbugs@watson.ibm.com; Fri, 15 Jul 1994 16:40:40 +0200
--* Date: Fri, 15 Jul 1994 16:40:40 +0200
--* From: Laurent Bernardin <bernardin@inf.ethz.ch>
--* Precedence: first-class
--* Message-Id: <199407151440.QAA08908@ru7.inf.ethz.ch>
--* To: asbugs@watson.ibm.com
--* Subject: [2] executable dumps core [binpow.as][0.36]

--@ Fixed  by:  SSD   Thu Aug 4 12:57:00 EDT 1994 
--@ Tested by:  onne 
--@ Summary:    Lambda expressions were confusing the initialization of imports. 

#if BugHeaders
LastSeenBy: PI
LastUpdate: 02/Aug/94
BugKeywords: optimiz
Priority:
Comments: Works without optimizations.
Comments:
SeenBy:
Updates:
#endif
#assert modified
#if modified

#include "aslib.as"

macro Z == Integer;

+++ compute a^b mod t
powrem(a:Z,b:Z,t:Z):Z == {
	import from BinaryPowering(Z, (a:Z,b:Z):Z +-> a*b rem t, Z);
	power(1,a,b) rem t;
}

main():TextWriter == {
	import from Z;

	r := powrem(11,2,7);
	print << r << newline;
}

main();

#else  -- original begin

#include "aslib.as"

macro Z == Integer;

+++ compute a^b mod t
powrem(a:Z,b:Z,t:Z):Z == {
	import from BinaryPowering(Z, (a:Z,b:Z):Z +-> a*b rem t, Z);
	power(1,a,b) rem t;
}

main():TextWriter == {
	import from Z;

	r := powrem(11,2,7);
	print << r << newline;
}

main();

#endif -- original end

 
