--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com Fri Jun 10 19:27:38 1994 --* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311) --* id AA28850; Fri, 10 Jun 1994 19:27:38 -0400 --* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3) --* with BSMTP id 0745; Fri, 10 Jun 94 19:27:39 EDT --* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0" --* id --* for asbugs@watson; Fri, 10 Jun 94 19:27:39 -0400 --* Received: from ibm4.scri.fsu.edu by watson.ibm.com (IBM VM SMTP V2R3) with TCP; --* Fri, 10 Jun 94 19:27:38 EDT --* Received: by ibm4.scri.fsu.edu id AA109692 --* (5.67b/IDA-1.4.4 for asbugs@watson.ibm.com); Fri, 10 Jun 1994 19:27:35 -0400 --* Date: Fri, 10 Jun 1994 19:27:35 -0400 --* From: Tony Kennedy --* Message-Id: <199406102327.AA109692@ibm4.scri.fsu.edu> --* To: asbugs@watson.ibm.com --* Subject: [3] foamTag: Values is unhandled [etuple.as][A# version 34.6 for AIX RS/6000 (debug version)] --@ Fixed by: PAB Tue Jun 21 18:47:11 EDT 1994 --@ Tested by: object0.as --@ Summary: convinced genfoam to accept embeddings in defines --+ A# version 34.6 for AIX RS/6000 (debug version) --+ foamTag: Values is unhandled. --+ in sc sy li pa ma ab ck sb ti gf of pb pl pc po --+ Time 3.4 s 1 .5 1 .5 1 .5 0 0 1 74 4 2 .2 .2 10 0 % --+ Alloc 3167 K .2 .4 .0 .7 .5 .3 .1 .0 1 81 3 .3 0 0 9 .0 % --+ Free 764 K .1 .0 .0 3 .1 .9 .4 .0 1 47 3 2 0 0 32 0 % --+ --+ Source 126 lines, 2217 lines per minute --+ Store 2796 K pool, 3167K alloc - 764K free - 0K gc = 2403K final -- -- etuple.as -- #include "aslib" macro SI == SingleInteger; +++ `Tuple(T)' provides more functions for values of type `Tuple T'. +++ +++ Author: ADK +++ Date Created: 10-JUN-1994 +++ Keywords: tuple, homogeneous product, immutable extend Tuple(T: Type): with { first: % -> T; ++ first(t) extracts the first element of the tuple t. rest: % -> %; ++ rest(t) returns a tuple of all the elements of the tuple t ++ except for the first. export from T; } == add { macro Rep == Record(size: BSInt, values: BArr); import from Rep, Machine, SI, T; print("Instantiating domain Tuple(T)...")(); first(t: %): T == get(T)(rep(t).values, 0); rest(t: %): % == { news: BSInt == prev(rep(t).size); newt: BArr == array(T)(0@BSInt pretend T, news); for i:SI in 0..(news::SI) repeat set!(T)(newt, i::BSInt, get(T)(rep(t).values, next(i::BSInt))); per [news, newt] } } -- Test import from SI, Tuple SI, List SI; tt: Tuple SI == (1,2,3,4); tl: List SI == [tt]; print("tt = ")(tl)(); print("first(tt) = ")(first(tt))(); print("rest(tt) = ")([rest(tt)]@List SI)();