keropdoctors.blogg.se

List and recursion using visual prolog 5.2
List and recursion using visual prolog 5.2













list and recursion using visual prolog 5.2

LIST AND RECURSION USING VISUAL PROLOG 5.2 CODE

If you understand Assembly Language and intend to use this code for other (meta-programming) tasks, all you have to do is modify just a couple of lines in the code that follows. The only difference between the way it works for Visual Prolog and the way it might work for another Prolog (or -indeed- ANY programming language, using a ‘C’-calling convention) is the Visual-Prolog-specific structure of a LIST, which in Visual Prolog has a different form than in all other languages. However, this does not exist in Visual Prolog, which sacrifices such “luxuries” for speed (which is the reason I also often use ISO-Prolog compilers, such as LPA-WinProlog and SWI-Prolog).Īnyway… The code you are about to see can be useful more generally, as an example of Prolog meta-programming, implemented in Assembly Language. Now, in ISO-Prolog there is a standard predicate known as “univ”, written as “ =.“, which turns a list like into a predicate call such as PRED(ARG1,ARG2,…). here is an Assembly language predicate, that takes as inputs another (external) predicate’s memory-address and a ( Visual Prolog-) argument-list, and calls this (external) predicate, using the (arbitrary-length-) list of N arguments, as arguments of “arity N”:Īpply_func(PRED, ) PRED(Arg1,Arg2,…) They also have an intrinsic fascination in themselves, as general tools for Prolog meta-programming.Į.g.

list and recursion using visual prolog 5.2

Prolog even further, potentially valuable for a multitude of other purposes. Recently, I discovered some Assembly language techniques to enhance G.I.S. Code modifications could therefore be done very quickly and most mistakes were (semi-)automatically corrected by the interpreter’s own enhanced error-checking capabilities. Prolog produced immediate results, without any need for (often tedious) EXE-file compilation. Prolog for easy immediate experimentation: Coding in G.I.S. A multitude of extra predicates, implemented in pure Assembly language, became available through G.I.S. So, the only way to implement ISO-Prolog functionality in Visual Prologis to extend the “ PIE Interpreter” (and G.I.S. Of course, such attempts are inherently limited by the internal design of Visual Prolog compilers. Ever since I started using the Visual Prolog compilers (and the PDC Prolog compilers preceding them) I was fascinated by the possibilities of implementing additional ISO-Prolog functionality in Visual Prologthrough Assembly Language and ‘C’.















List and recursion using visual prolog 5.2