Lecture Notes in Computer Science 1551 Editedby G.Goos,J. Hartmanisand J.van Leeuwen 3 Berlin Heidelberg NewYork Barcelona HongKong London Milan Paris Singapore Tokyo Gopal Gupta (Ed.) Practical Aspects of Declarative Languages First International Workshop, PADL’99 San Antonio, Texas, USA, January 18-19, 1999 Proceedings 1 3 SeriesEditors GerhardGoos,KarlsruheUniversity,Germany JurisHartmanis,CornellUniversity,NY,USA JanvanLeeuwen,UtrechtUniversity,TheNetherlands VolumeEditor GopalGupta NewMexicoStateUniversity,DepartmentofComputerScience NewScienceHall(Box30001,MSCS) StewartStreet,LasCruces,NM88003,USA E-mail:[email protected] Cataloging-in-Publicationdataappliedfor DieDeutscheBibliothek-CIP-Einheitsaufnahme Practicalaspectsofdeclarativelanguages:firstinternationalworkshop; proceedings/PADL’99,SanAntonio,Texas,USA,January18-19,1999.Gopal Gupta(ed.).-Berlin;Heidelberg;NewYork;Barcelona;HongKong;London ;Milan;Paris;Singapore;Tokyo:Springer,1998 (Lecturenotesincomputerscience;1551) ISBN3-540-65527-1 CRSubjectClassification(1998):D.3,D.1,F.3,D.2,I.2.3 ISSN0302-9743 ISBN3-540-65527-1Springer-VerlagBerlinHeidelbergNewYork Thisworkissubjecttocopyright.Allrightsarereserved,whetherthewholeorpartofthematerialis concerned,specificallytherightsoftranslation,reprinting,re-useofillustrations,recitation,broadcasting, reproductiononmicrofilmsorinanyotherway,andstorageindatabanks.Duplicationofthispublication orpartsthereofispermittedonlyundertheprovisionsoftheGermanCopyrightLawofSeptember9,1965, initscurrentversion,andpermissionforusemustalwaysbeobtainedfromSpringer-Verlag.Violationsare liableforprosecutionundertheGermanCopyrightLaw. (cid:1)c Springer-VerlagBerlinHeidelberg1999 PrintedinGermany Typesetting:Camera-readybyauthor SPIN10693172 06/3142–543210 Printedonacid-freepaper Preface Declarativelanguageshavetraditionallybeenregardedbythe mainstreamcom- puting community as too impractical to be put to practical use. At the same time,traditionalconferencesdevotedtodeclarativelanguagesdonothaveissues related to practice as their centralfocus. Thus, there are few forums devoted to discussion of practical aspects and implications of newly discovered results and techniques related to declarative languages. The goal of the First International Workshop on Practical Aspects of Declarative Languages (PADL) is to bring togetherresearchers,practitionersandimplementorsofdeclarativelanguagesto discuss practical issues and practical implications of their research results. The workshop was held in San Antonio, Texas, during January 18-19, 1999. This volume contains its proceedings. Fifty three papers were submitted in response to the call for papers. These papers were written by authors belonging to twenty one countries from six con- tinents. Each paper was assigned to at least two referees for reviewing. Twenty four papers were (cid:12)nally selected for presentation at the workshop. Many good papers could not be included due to the limited duration of the workshop. The workshopincludedinvitedtalksbyMarkHaydenofDEC/CompaqSystemsRe- searchCenter, speaking on \Experiences Building Distributed Systems in ML," and Mark Wallace of Imperial College Center for Planning And Resource Con- trol (IC-PARC), speaking on \ECLiPSe: Declarative Speci(cid:12)cation and Scalable Implementation." The workshopalso included a panel discussion on\What can declarative paradigms contribute to meet the challenges of Software Engineer- ing?" The workshop is sponsored and organized by COMPULOG AMERICAS (http://www.cs.nmsu.edu/~complog),a networkof researchgroupsdedicated to promoting research in logic programming and related areas, by the Association for Logic Programming (http://www.cwi.nl/projects/alp),and the Department of Computer Science, New Mexico State University (http://www.cs.nmsu.edu). TheworkshopisbeingheldincooperationwiththeACMSpecialInterestGroup onProgrammingLanguages(ACMSIGPLAN).Thesupportofmanyindividual was crucial to the success of this workshop. My thanks to Enrico Pontelli for his tremendous help in managing and organizing every aspect of the workshop. He alsotookuponhimself the time-consumingtaskofdevelopingandmaintain- ing the PADL’99 web-pages. Thanks are also due to Krzysztof Apt, President of ALP, and David S. Warren, past President of ALP, for their support, help, andencouragement,to AndrewAppel,POPLGeneralChair,andDonnaBaglio and Maria Triver of ACM, for answering various organizational questions, and to the referees for their prompt reviewing of papers. My thanks to the program committee members for all their help in reviewing and their advice. Finally, my thanks to all the authors who took interest in PADL’99 and submitted papers. November 1998 Gopal Gupta Program Committee M. Carlsson SICS, Sweden T. Chikayama University of Tokyo, Japan B. Demoen KU Leuven, Belgium H. Gill DARPA, USA G. Gupta New Mexico State University, USA (chair) M. Hermenegildo Technical University of Madrid, Spain B. Jayaraman SUNY Bu(cid:11)alo, USA N. Jones University of Copenhagen, Denmark R. Kieburtz OregonGraduate Institute, USA M. Martelli University of Genoa, Italy S. Peyton Jones Microsoft Research, UK E. Pontelli New Mexico State University, USA I.V. Ramakrishnan SUNY Stonybrook, USA D. Schmidt Kansas State University, USA V. Santos Costa University of Porto, Portugal P. van Hentenryck Brown University, USA D.S. Warren SUNY Stonybrook, USA P. Wadler Lucent Technologies Bell Labs, USA Organizing Committee E. Pontelli New Mexico State University, USA (chair) G. Gupta New Mexico State University, USA List of Referees A. K.Bansal,C. Baoqiu,M. Bruynooghe,F. Bueno,M. Carlsson,M.Carro,M. M. T. Chakravarty, H. Davulcu, B. Demoen, I. Dutra, M. Florido, G. Gupta, M.Huth, J.Hatcli(cid:11),N.Jacobs,B.Jayaraman,N.D.Jones,S.PeytonJones,R. B. Kieburtz, K. Narayan Kumar, J. P. Leal, S. W. Loke, R. Lopes, W. Luk , J. Marino,R. F. P.Marques,M. Martelli,S.Mckeever,T.Mogensen,A. H. Nieva, O. Olsson, E. Pontelli, G. Puebla, C. R. Ramakrishnan, P. Rao, R. Rocha, A. Roychoudhury,V.SantosCosta,D.Schmidt, M.H.B.Sorensen,K.Sagonas,S. Singh, A. Stoughton, P. Szeredi, A. Tiwari, P. van Hentenryck, P. Wadler, and D. S. Warren. Table of Contents Software Engineering Automated Benchmarking of Functional Data Structures.....................1 G.E. Moss and C. Runciman np-spec: An Executable Specification Language for Solving All Problems in NP ........................................................16 M. Cadoli, L. Palopoli, A. Schaerf, and D. Vasile Prototyping a Requirements Specification through an Automatically Generated Concurrent Logic Program......................................31 P. Letelier, P. Sa´nchez, and I. Ramos Multi-agent Systems Development as a Software Engineering Enterprise.....46 M. Bozzano, G. Delzanno, M. Martelli, V. Mascardi, and F. Zini Innovative Applications I From Functional Animation to Sprite-Based Display........................61 C. Elliott Beyond Pretty-Printing:Galley Concepts in Document Formatting Combinators....................................................76 W. Kahl Lambda in Motion: Controlling Robots with Haskell........................91 J. Peterson, P. Hudak, and C. Elliott Implementation CHAT: The Copy-Hybrid Approach to Tabling............................106 B. Demoen and K. Sagonas The Influence of Parallel Computer Architectural Parameters on the Performance of ParallelLogic Programming Systems......................122 M.G. Silva, I.C. Dutra, R. Bianchini, and V. Santos Costa Or-Parallelismwithin Tabling.............................................137 R. Rocha, F. Silva, and V. Santos Costa Declarative Query Processing Mnesia – A Distributed Robust DBMS for Telecommunications Applications...............................................................152 H. Mattsson, H. Nilsson, and C. Wikstr¨om An AQUA-Based Intermediate Language for Evaluating an Active Deductive Object-Oriented Language...............................164 B. Siddabathuni, S.W. Dietrich, and S.D. Urban Implementing a Declarative String Query Language with String Restructuring.................................................179 R. Hakli, M. Nyka¨nen, H. Tamm, and E. Ukkonen VIII Table of Contents Systems Applications Client-Side Web Scripting with HaskellScript..............................196 E. Meijer, D. Leijen, and J. Hook MCORBA: A CORBA Binding for Mercury...............................211 D. Jeffery, T. Dowd, and Z. Somogyi Analysis Dead Code Elimination through Dependent Types.........................228 H. Xi Multiple Specialization of WAM Code.....................................243 M. Ferriera and L. Damas A Flexible Framework for Dynamic and Static Slicing of Logic Programs...........................................................259 W.W. Vasconcelos Innovative Applications II Applying Logic Programming to Derive Novel Functional Information of Genomes...................................................275 A.K. Bansal and P. Bork An Application of Action Theory to the Space Shuttle.....................290 R. Watson Developing a Declarative Rule Language for Applications in Product Configuration.....................................................305 T. Soininen and I. Niemela¨ Constraint Programming University Timetabling Using Constraint Logic Programming..............320 H-J. Goltz and D. Matzke Constraint-BasedResource Allocation and Scheduling in Steel Manufacturing.......................................................335 M. Carlsson, P. Kreuger, and E. ˚Astro¨m Using Constraints in Local Proofs for CLP Debugging.....................350 C. La¨ı Declarative Languages and Software Engineering (Invited) A Return to Elegance: The Reapplication of Declarative Notation to Software Design...................................360 D.A. Schmidt ECLiPSe: Declarative Specification and Scaleable Implementation ........365 M. Wallace and J. Schimpf Author Index...........................................................367 Automated Benchmarking of Functional Data Structures Graeme E. Moss and Colin Runciman Department of Computer Science, University of York,UK fgem,[email protected] Abstract. Despite a lot of recent interest in purely functional data structures, for example [Ada93, Oka95, BO96, Oka96, OB97, Erw97], fewhavebeenbenchmarked.Ofthese,evenfewerhavetheirperformance quali(cid:12)ed by how they are used. But how a data structure is used can signi(cid:12)cantly a(cid:11)ect performance. This paper makes three original con- tributions. (1) We present an algorithm for generating a benchmark according to a given use of data structure. (2) We compare use of an automated tool based on this algorithm, with the traditional technique of hand-picked benchmarks, by benchmarking six implementations of random-access list using both methods. (3) We use the results of this benchmarkingtopresent adecision treefor thechoice of random-access list implementation, according to how thelist will beused. 1 Motivation Recent years have seen renewed interest in purely functional data structures: sets[Ada93],random-accesslists[Oka95],priorityqueues[BO96],arrays[OB97], graphs [Erw97], and so on. But, empirical performance receives little attention, and is usually based on a few hand-picked benchmarks. Furthermore, the per- formance of a data structure usually varies according to how it is used, yet this is mostly overlooked. For example, Okasaki [Oka95] uses (cid:12)ve simple benchmarks to measure the performance of di(cid:11)erent implementations of a list providing random access. He points out that three of the benchmarks use random access, and two do not. However, all the benchmarks are single-threaded. How do the data structures perform under non-single-threadeduse? We simply do not know. Okasakipresentsmanynewdatastructuresinhisthesis[Oka96],butwithout measurements of practical performance. He writes in a section on future work: \The theoryandpractice ofbenchmarking[functional]data structuresis still in its infancy." Howcanwe make benchmarking easier andmore reliable? A major problem is(cid:12)ndingarangeofbenchmarksthatweknowusethedatastructureindi(cid:11)erent ways. If we could generate a benchmark according to a well-de(cid:12)ned use of the data structure,we couldeasily makeatable listing performanceagainstarange of uses. G.Gupta(Ed.):PADL’99,LNCS1551,pp.1{15,1998. (cid:13)c Springer-VerlagBerlinHeidelberg1998 2 Graeme E. Moss and Colin Runciman To make precise \the use of a data structure" we need a model. Section 2 de(cid:12)nes such a model: a datatype usage graph, or dug. Section 2 also de(cid:12)nes a pro(cid:12)le, summarising the important characteristics of a dug. Section 3 gives an algorithm for generating a benchmark from a pro(cid:12)le. Section 4 introduces a benchmarking kit, called Auburn,that automates benchmarking using the algo- rithmofSections3.Section4thencomparesbenchmarkingsiximplementations ofrandom-accesslistsmanuallyagainstusingAuburn.Section5discussesrelated work. Section 6 concludes and discusses future work. Some of the details of this paper are only relevant to the language we use: Haskell,apurefunctionallanguageusinglazyevaluation.Suchdetailsareclearly indicated. 2 Modelling Datatype Usage Howcanwecapturethewayanapplicationusesadatastructure?TaketheSum benchmark of [Oka95] as an example of an application. Sum uses an implemen- tation of random-access lists (see Fig.1) to build a list of n integers using cons, and then sum this list using head and tail. Code for Sum is given in Fig.2(a). Let us use a graph to capture how Sum uses the list operations. Let a node represent the result of applying an operation, and let the incoming arcs indi- cate the arguments taken from the results of other operations. Let any other arguments be included in the label of the node. Figure 2(b) shows this graph. Node 1 represents the result of empty, which is an empty list. Node 2 repre- sents the result of applying cons to 1 and empty, which is a list containing just theinteger1.Andsoon,tillnoden+1representsalistofncopiesoftheinteger 1. This is how Sum builds a list of n integers. Noden+2representstheresultofapplyingheadtothislist,whichisthe(cid:12)rst element in the list. Node n+3 represents the result of applying tail to this list, which is all but the (cid:12)rst element. Node n+4 represents the result of applying head to the list of node n+3, giving the second element. Every other element of the list is removed in the same way, till node 3n represents the last element, and node 3n+1 represents the empty list. This is how Sum sums the list of n integers. The authors introduced such a graph in [MR97], given the name datatype usage graph, or dug. The de(cid:12)nition was informal in [MR97] but we shall now give a brief formal de(cid:12)nition. To abstract over many competing data structures providing similar operations, we insist on a dug describing the use of an adt. The same dug can then describe the use of any implementation of that adt. We restrict an adt to being simple. De(cid:12)nition 1 (Simple adt) A simple adt provides a type constructor T of arity one, and only operations over types shown in Table 1.
Description: