Xref: utzoo sci.math:4472 comp.lang.misc:1816 Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!mcvax!enea!kth!draken!liuida!JWC From: JWC@IDA.LiU.SE (Jonas Wallgren) Newsgroups: sci.math,comp.lang.misc Subject: "Semiabstract" datatypes Message-ID: <896@tragicomix.liu.se> Date: 6 Sep 88 16:24:48 GMT Article-I.D.: tragicom.896 Sender: jonwa@tragicomix.liu.se Lines: 45 Organisation: CIS Dept, Univ of Linkoping, Sweden Assume the following declaration (in ML) of an abstract tree type: abstype tree=leaf of int|branch of tree*tree with val tend=leaf fun fork l1 l2=branch(l1,l2) end; Everytime a tree is created one is forced to write e.g. tfork(tend 1,tend 2); I.e. every integer must be prefixed with 'tend'. This implementation not only hides the representation of the tree structure (tree*tree) but also hides the representation of the leaves. My idea is that the declaration could look like semiabstype tree=int|branch of tree*tree with fun tfork l1 l2=branch(l1,l2) end; Then the example above becomes tfork 1 2; in the original abstract type the top is visible and the rest below is hidden. In the second example there is something visible at the top and something visible in the bottom, and the middle part is hidden - that's why I call the type 'semiabstract'. My questions are: Are there any programming languages supporting such a construction? Is there any algebraic concept or other mathematical structure suitable for describing such a fenomenon? ------------------------------------------------------------------------------- Jonas Wallgren | JWC@IDA.LiU.SE Department of Computer and Information Science | Linkoping University |----------------------------- SE-581 83 Linkoping | Sweden | The Argument Eater: YKx=YK -------------------------------------------------------------------------------