Richard O'Keefe - Academia.edu (original) (raw)
Papers by Richard O'Keefe
arXiv (Cornell University), Nov 15, 2009
Coding standards and good practices are fundamental to a disciplined approach to software project... more Coding standards and good practices are fundamental to a disciplined approach to software projects, whatever programming languages they employ. Prolog programming can benefit from such an approach, perhaps more than programming in other languages. Despite this, no widely accepted standards and practices seem to have emerged up to now. The present paper is a first step towards filling this void: it provides immediate guidelines for code layout, naming conventions, documentation, proper use of Prolog features, program development, debugging and testing. Presented with each guideline is its rationale and, where sensible options exist, illustrations of the relative pros and cons for each alternative. A coding standard should always be selected on a per-project basis, based on a host of issues pertinent to any given programming project; for this reason the paper goes beyond the mere provision of normative guidelines by discussing key factors and important criteria that should be taken into account when deciding on a fully-fledged coding standard for the project.
MIT Press eBooks, Jan 3, 1990
Artificial Intelligence and Symbolic Computation, 2010
European Conference on Artificial Intelligence, Sep 5, 1984
Sigplan Notices, May 1, 1983
In the recent ACM Symposium on LiSP and FunctionaJ Programming, there was a paper with the title ... more In the recent ACM Symposium on LiSP and FunctionaJ Programming, there was a paper with the title "Prolog Compared With LISP" [2]. In it, Gutierrez presents a program in LISP, and a related program in Prolog, and uses the inferior performance of the latter to suggest in strong terms that advocates of Prolog may have overstated its performance. However, his program makes very poor use of Prolog. in this article, I point out which features of Prolog have been misused and give guidelines for their proper use. I also compare a new Prolog and LiSP program performing a similar task, and find that the execution times are comparable. This is in accord with earlier results [4]. 1. Data Structures, In [2], Gutierrez says "On the other hand, the above quoted comments make specific reference to differential performance in relation to different data structures: Prolog is believed to be more efficient than LISP when the structures are something different from lists, although it is recognised to be less efficient in the manipulation of lists. Now, it is difficult to under-estimate[sic] the importance of lists in programming, at least in AI, even if Prolog offers some beautiful ways of doing things that do not involve lists. We consider that the main burden of our algorithms should be borne by lists." The results do not bear this prejudice out. Let us examine the consequences of the choice of data structure. A formula with N operators requires 2"N+1 cons cells in Gutierrez' Polish lists. Now in LISP a cons cell costs one word. A rough estimate would be 3 words in Prolog; one word to indicate that this record has functor '.'(_,_), and one word for each of the arguments. The natural data structure in Prolog is a tree, so that we could write the procedure transforming a formula into its opposite as opposite(F & G, F1 £ G1) :-opposite(F, F1), opposite(G, G1). opposite(F £ G, F1 & G1) :-opposite(F, F1), opposite(G, G1). opposite (+Atom,-Atom). opposite (-Atom, +Atom). This is not just "beautiful", it is also considerably more efficient. Gutierrez' chosen representation using lists costs 3"(2"N+1) words for cons cells, plus 3"(N+1) words for a-Atom and n-Atom leaves. This is of order 9N. The representation suggested above, which is the natural and idiomatic representation in Prolog, as well as being much easier to read, costs 2"(N+1) words for the leaves and 3*N words for the operators, a total of order 5N. Gutierrez quotes Prolog/LISP ratios of 42.81% for interpreted code and 27.28% for compiled code. Since his program does a great deal of copying (much of it implicitly in 'assert' calls) it is reasonable to assume that the time taken is proportional to the size of the structures. If we multiply his figures by 9/5, the ratios become 77% and 49% respectively, which makes Prolog look rather better. Adopting this representation would yield another benefit too, which is that selecting the left or right argument of a formula known to be binary could now be done by direct pattern matching. E.g. his routine decompose could be written as decompose (F & G
Junctures the Journal For Thematic Dialogue, Mar 13, 2011
Lecture Notes in Computer Science, 2005
The INEX query languages allow the extraction of fragments from selected documents. This power is... more The INEX query languages allow the extraction of fragments from selected documents. This power is not much used in INEX queries. The paper suggests reasons why, and considers which kind of document collection this feature might be useful for.
Junctures-the Journal for Thematic Dialogue, 2007
This paper presents a technique for assembling Smalltalk programs out of pieces using proposition... more This paper presents a technique for assembling Smalltalk programs out of pieces using propositional Horn clauses. The technique allows the dependencies and restrictions of a piece to be stated inside the piece or outside, allowing components from other dialects to be used. The technique is applicable to any OO language allowing class extensions.
SIGLEAvailable from British Library Document Supply Centre- DSC:D75687/87 / BLDSC - British Libra... more SIGLEAvailable from British Library Document Supply Centre- DSC:D75687/87 / BLDSC - British Library Document Supply CentreGBUnited Kingdo
ACM SIGPLAN Notices, 1985
Several programming languages, notably ADA"' and MESA, suppor t "keyword" para... more Several programming languages, notably ADA"' and MESA, suppor t "keyword" parameters in procedure calls and record constructors. Here' s an example, in no particular programming language : type style = (solid, dotted, dashed); point = record x, y : real end ; procedure DrawEl l ipse (where this call has the same effect as the fully specifie d Now the use of keyword parameters in this way buys you three things : (1) you can write the parameters in any order; (2) you can leave out parameters if the default value will do; (3) the names of the parameters appear at the calling site so that you ca n tell what each parameter is for without looking back at the definition. It is commonly said that these are all benefits worth having, and tha t keyword parameters are accordingly a Good Thing. I do not agree tha t being able to write the parameters in any order is useful ; in my opinion i t only confuses the human reader. Similarly, the advantage of omitting default parameters is confined to the writer ; the reader has to remembe r what the default is and mentally replace it. Indeed, the writer had bette r beware of changes to the defaults himself; if we change the defaul t eccentricity in this example from 0 to 0 .5, the first procedure call in th e example will remain syntactically correct, but the effect will no longer b e r" ADA is a trademark of the DOD A,JPO, as if you didn't already know .
Journal for the Study of the Old Testament, 2005
This article argues that a statistical analysis of Genesis sources performed by Cornelius B. Houk... more This article argues that a statistical analysis of Genesis sources performed by Cornelius B. Houk (published in JSOT 27.1 [2002]) turns out to have statistical and methodological flaws. The purpose of this response to Houk’s study is to describe the flaws and to offer some suggestions for avoiding them. Houk’s conclusions about Genesis sources are not supported by his data or method, but the method may deserve further study.
Expert Systems, 1992
Hacking your program is no substitute for understanding your problem. Prolog is different, but no... more Hacking your program is no substitute for understanding your problem. Prolog is different, but not that different. Elegance is not optional. These are the themes that unify Richard O'Keefe's very personal statement on how Prolog programs should be written. The emphasis in "The Craft of Prolog" is on using Prolog effectively. It presents a loose collection of topics that build on and elaborate concepts learning in a first course. These may be read in any order following the first chapter, "Basic Topics in Prolog, " which provides a basis for the rest of the material in the book.
Volume data representations are widely used in many different domains including medical imaging. ... more Volume data representations are widely used in many different domains including medical imaging. Here, they are primarily accessed using WIMP interfaces on desktop PCs, while the use of handheld mobile devices to browse volume data is widely ignored. In this work, we present Volume Lens, an approach for displaying volume datasets on mobile hardware by implementing a novel interface that turns the mobile device into an exploration tool. The user can physically interact with the mobile device to interactively slice through the displayed virtual volume. The displayed slice is based on the position of the mobile device within the environment. We present our approach together with a explorative study gaining feedback from experts in the medical domain.
In this chapter, the authors discuss the characteristics of data collected by the New Zealand Cen... more In this chapter, the authors discuss the characteristics of data collected by the New Zealand Centre for Adverse Drug Reaction Monitoring (CARM) over a five-year period. The authors begin by noting the ways in which adverse reaction data are similar to market basket data, and the ...
arXiv (Cornell University), Nov 15, 2009
Coding standards and good practices are fundamental to a disciplined approach to software project... more Coding standards and good practices are fundamental to a disciplined approach to software projects, whatever programming languages they employ. Prolog programming can benefit from such an approach, perhaps more than programming in other languages. Despite this, no widely accepted standards and practices seem to have emerged up to now. The present paper is a first step towards filling this void: it provides immediate guidelines for code layout, naming conventions, documentation, proper use of Prolog features, program development, debugging and testing. Presented with each guideline is its rationale and, where sensible options exist, illustrations of the relative pros and cons for each alternative. A coding standard should always be selected on a per-project basis, based on a host of issues pertinent to any given programming project; for this reason the paper goes beyond the mere provision of normative guidelines by discussing key factors and important criteria that should be taken into account when deciding on a fully-fledged coding standard for the project.
MIT Press eBooks, Jan 3, 1990
Artificial Intelligence and Symbolic Computation, 2010
European Conference on Artificial Intelligence, Sep 5, 1984
Sigplan Notices, May 1, 1983
In the recent ACM Symposium on LiSP and FunctionaJ Programming, there was a paper with the title ... more In the recent ACM Symposium on LiSP and FunctionaJ Programming, there was a paper with the title "Prolog Compared With LISP" [2]. In it, Gutierrez presents a program in LISP, and a related program in Prolog, and uses the inferior performance of the latter to suggest in strong terms that advocates of Prolog may have overstated its performance. However, his program makes very poor use of Prolog. in this article, I point out which features of Prolog have been misused and give guidelines for their proper use. I also compare a new Prolog and LiSP program performing a similar task, and find that the execution times are comparable. This is in accord with earlier results [4]. 1. Data Structures, In [2], Gutierrez says "On the other hand, the above quoted comments make specific reference to differential performance in relation to different data structures: Prolog is believed to be more efficient than LISP when the structures are something different from lists, although it is recognised to be less efficient in the manipulation of lists. Now, it is difficult to under-estimate[sic] the importance of lists in programming, at least in AI, even if Prolog offers some beautiful ways of doing things that do not involve lists. We consider that the main burden of our algorithms should be borne by lists." The results do not bear this prejudice out. Let us examine the consequences of the choice of data structure. A formula with N operators requires 2"N+1 cons cells in Gutierrez' Polish lists. Now in LISP a cons cell costs one word. A rough estimate would be 3 words in Prolog; one word to indicate that this record has functor '.'(_,_), and one word for each of the arguments. The natural data structure in Prolog is a tree, so that we could write the procedure transforming a formula into its opposite as opposite(F & G, F1 £ G1) :-opposite(F, F1), opposite(G, G1). opposite(F £ G, F1 & G1) :-opposite(F, F1), opposite(G, G1). opposite (+Atom,-Atom). opposite (-Atom, +Atom). This is not just "beautiful", it is also considerably more efficient. Gutierrez' chosen representation using lists costs 3"(2"N+1) words for cons cells, plus 3"(N+1) words for a-Atom and n-Atom leaves. This is of order 9N. The representation suggested above, which is the natural and idiomatic representation in Prolog, as well as being much easier to read, costs 2"(N+1) words for the leaves and 3*N words for the operators, a total of order 5N. Gutierrez quotes Prolog/LISP ratios of 42.81% for interpreted code and 27.28% for compiled code. Since his program does a great deal of copying (much of it implicitly in 'assert' calls) it is reasonable to assume that the time taken is proportional to the size of the structures. If we multiply his figures by 9/5, the ratios become 77% and 49% respectively, which makes Prolog look rather better. Adopting this representation would yield another benefit too, which is that selecting the left or right argument of a formula known to be binary could now be done by direct pattern matching. E.g. his routine decompose could be written as decompose (F & G
Junctures the Journal For Thematic Dialogue, Mar 13, 2011
Lecture Notes in Computer Science, 2005
The INEX query languages allow the extraction of fragments from selected documents. This power is... more The INEX query languages allow the extraction of fragments from selected documents. This power is not much used in INEX queries. The paper suggests reasons why, and considers which kind of document collection this feature might be useful for.
Junctures-the Journal for Thematic Dialogue, 2007
This paper presents a technique for assembling Smalltalk programs out of pieces using proposition... more This paper presents a technique for assembling Smalltalk programs out of pieces using propositional Horn clauses. The technique allows the dependencies and restrictions of a piece to be stated inside the piece or outside, allowing components from other dialects to be used. The technique is applicable to any OO language allowing class extensions.
SIGLEAvailable from British Library Document Supply Centre- DSC:D75687/87 / BLDSC - British Libra... more SIGLEAvailable from British Library Document Supply Centre- DSC:D75687/87 / BLDSC - British Library Document Supply CentreGBUnited Kingdo
ACM SIGPLAN Notices, 1985
Several programming languages, notably ADA"' and MESA, suppor t "keyword" para... more Several programming languages, notably ADA"' and MESA, suppor t "keyword" parameters in procedure calls and record constructors. Here' s an example, in no particular programming language : type style = (solid, dotted, dashed); point = record x, y : real end ; procedure DrawEl l ipse (where this call has the same effect as the fully specifie d Now the use of keyword parameters in this way buys you three things : (1) you can write the parameters in any order; (2) you can leave out parameters if the default value will do; (3) the names of the parameters appear at the calling site so that you ca n tell what each parameter is for without looking back at the definition. It is commonly said that these are all benefits worth having, and tha t keyword parameters are accordingly a Good Thing. I do not agree tha t being able to write the parameters in any order is useful ; in my opinion i t only confuses the human reader. Similarly, the advantage of omitting default parameters is confined to the writer ; the reader has to remembe r what the default is and mentally replace it. Indeed, the writer had bette r beware of changes to the defaults himself; if we change the defaul t eccentricity in this example from 0 to 0 .5, the first procedure call in th e example will remain syntactically correct, but the effect will no longer b e r" ADA is a trademark of the DOD A,JPO, as if you didn't already know .
Journal for the Study of the Old Testament, 2005
This article argues that a statistical analysis of Genesis sources performed by Cornelius B. Houk... more This article argues that a statistical analysis of Genesis sources performed by Cornelius B. Houk (published in JSOT 27.1 [2002]) turns out to have statistical and methodological flaws. The purpose of this response to Houk’s study is to describe the flaws and to offer some suggestions for avoiding them. Houk’s conclusions about Genesis sources are not supported by his data or method, but the method may deserve further study.
Expert Systems, 1992
Hacking your program is no substitute for understanding your problem. Prolog is different, but no... more Hacking your program is no substitute for understanding your problem. Prolog is different, but not that different. Elegance is not optional. These are the themes that unify Richard O'Keefe's very personal statement on how Prolog programs should be written. The emphasis in "The Craft of Prolog" is on using Prolog effectively. It presents a loose collection of topics that build on and elaborate concepts learning in a first course. These may be read in any order following the first chapter, "Basic Topics in Prolog, " which provides a basis for the rest of the material in the book.
Volume data representations are widely used in many different domains including medical imaging. ... more Volume data representations are widely used in many different domains including medical imaging. Here, they are primarily accessed using WIMP interfaces on desktop PCs, while the use of handheld mobile devices to browse volume data is widely ignored. In this work, we present Volume Lens, an approach for displaying volume datasets on mobile hardware by implementing a novel interface that turns the mobile device into an exploration tool. The user can physically interact with the mobile device to interactively slice through the displayed virtual volume. The displayed slice is based on the position of the mobile device within the environment. We present our approach together with a explorative study gaining feedback from experts in the medical domain.
In this chapter, the authors discuss the characteristics of data collected by the New Zealand Cen... more In this chapter, the authors discuss the characteristics of data collected by the New Zealand Centre for Adverse Drug Reaction Monitoring (CARM) over a five-year period. The authors begin by noting the ways in which adverse reaction data are similar to market basket data, and the ...