Path: utzoo!attcan!uunet!husc6!bbn!rochester!udel!burdvax!macbeth!dowding From: dowding@macbeth.PRC.Unisys.COM (John Dowding) Newsgroups: comp.lang.prolog Subject: Re: Why no macro facility? Message-ID: <6899@burdvax.PRC.Unisys.COM> Date: 12 Jul 88 18:35:31 GMT References: <9671@lll-winken.llnl.gov> Sender: news@PRC.Unisys.COM Organization: Unisys Corporation, Paoli Research Center; Paoli, PA Lines: 37 In article <9671@lll-winken.llnl.gov> daven@lll-crg.llnl.gov (Dave Nelson) writes: >Could someone tell me why prolog has no built-in macro facility? >Even the industrial strength, full-featured prolog I am currently >evaluating doesn't have such a thing. > >daven (Dave Nelson) > I did some experiements with this kind of thing with a parser and found that it slowed the program down. I think that this is because current Prolog compilers dont handle very large clauses well. Consider this example: p(X):- q(X), r(X), s(Y). q(tree(_,_,_,_)). If we turn q into a macro, then the resulting clause for p is: p(tree(A,B,C,D)):- r(tree(A,B,C,D)), s(tree(A,B,C,D)). Note also that where there use to be a single variable X that pointed to the structure tree/4, now there isnt. In my application, the use of macros made the size of the resulting clauses enormous. The resulting program ran as much as 2 times slower than the version with procedure calls. John Dowding dowding@prc.unisys.com