AI::Prolog::Introduction 0.739
Sponsored Links
AI::Prolog::Introduction 0.739 Ranking & Summary
File size:
0.068 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
845
Date added:
2007-07-04
Publisher:
Curtis Poe
AI::Prolog::Introduction 0.739 description
AI::Prolog::Introduction Perl module contains the what and the why of logic programming.
You can skip this if you already know logic programming.
Note that most of this was pulled from my write-up about logic programming in Perl at http://www.perlmonks.org/?node_id=424075.
In Perl, generally you can append one list to another with this:
my @Z = (@X, @Y);
However, thats telling the language what to do. As sentient beings, we can look at that and infer more information. Given @Z and @X, we could infer @Y. Given just @Z, we could infer all combinations of @X and @Y that can be combined to form @Z.
Perl cannot do that. In logic programming, however, by defining what append() looks like, we get all of that other information.
In Prolog, it looks like this:
append([], X, X).
append([W|X],Y,[W|Z]) :- append(X,Y,Z).
(Theres actually often something called a "cut" after the first definition, but well keep this simple.)
What the above code says is "appending an empty list to a non-empty list yields the non-empty list." This is a boundary condition. Logic programs frequently require a careful analysis of boundary conditions to avoid infinite loops (similar to how recursive functions in Perl generally should have a terminating condition defined in them.)
The second line is where the bulk of the work gets done. In Prolog, to identify the head (first element) of a list and its tail (all elements except the first), we use the syntax [head|tail]. Since ":-" is read as "if" in Prolog, what this says if we want to concatenate (a,b,c) and (d,e,f):
Given a list with a head of W and a tail of X:
@list1 = qw/a b c/; (qw/a/ is W, the head, and qw/b c/ is X, the tail)
If its appended to list Y:
@Y = qw/d e f/;
We get a list with a head of W and a tail of Z:
@list2 = qw/a b c d e f/;
Only if X appended to Y forms Z:
X is qw/b c/. Y is qw/d e f/. Z is qw/b c d e f/.
You can skip this if you already know logic programming.
Note that most of this was pulled from my write-up about logic programming in Perl at http://www.perlmonks.org/?node_id=424075.
In Perl, generally you can append one list to another with this:
my @Z = (@X, @Y);
However, thats telling the language what to do. As sentient beings, we can look at that and infer more information. Given @Z and @X, we could infer @Y. Given just @Z, we could infer all combinations of @X and @Y that can be combined to form @Z.
Perl cannot do that. In logic programming, however, by defining what append() looks like, we get all of that other information.
In Prolog, it looks like this:
append([], X, X).
append([W|X],Y,[W|Z]) :- append(X,Y,Z).
(Theres actually often something called a "cut" after the first definition, but well keep this simple.)
What the above code says is "appending an empty list to a non-empty list yields the non-empty list." This is a boundary condition. Logic programs frequently require a careful analysis of boundary conditions to avoid infinite loops (similar to how recursive functions in Perl generally should have a terminating condition defined in them.)
The second line is where the bulk of the work gets done. In Prolog, to identify the head (first element) of a list and its tail (all elements except the first), we use the syntax [head|tail]. Since ":-" is read as "if" in Prolog, what this says if we want to concatenate (a,b,c) and (d,e,f):
Given a list with a head of W and a tail of X:
@list1 = qw/a b c/; (qw/a/ is W, the head, and qw/b c/ is X, the tail)
If its appended to list Y:
@Y = qw/d e f/;
We get a list with a head of W and a tail of Z:
@list2 = qw/a b c d e f/;
Only if X appended to Y forms Z:
X is qw/b c/. Y is qw/d e f/. Z is qw/b c d e f/.
AI::Prolog::Introduction 0.739 Screenshot
Advertisements
AI::Prolog::Introduction 0.739 Keywords
AI
Introduction Perl
Introduction 0.739
logic programming
Perl module
X
logic
Perl
list
programming
y
AI::Prolog::Introduction
AIPrologIntroduction
AI::Prolog::Introduction 0.739
Libraries
Programming
Bookmark AI::Prolog::Introduction 0.739
AI::Prolog::Introduction 0.739 Copyright
WareSeeker periodically updates pricing and software information of AI::Prolog::Introduction 0.739 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of AI::Prolog::Introduction 0.739 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
ladder logic programming
logic programming language
logic programming languages
inductive logic programming
logic programming prolog
constraint logic programming
logic model
logic programming tutorial
fuzzy logic programming
logic programming haskell
logician turing
logic programming paradigm
pure logic programming
logic programming with prolog
logical net
application of logic programming
logic puzzles
perlane
Related Software
AI::Prolog::Builtins is a Perl module with builtin predicates that AI::Prolog supports. Free Download
AI::Prolog is a Perl extension for logic programming. Free Download
AI::Prolog::Cookbook Perl module contains recipes for common Prolog problems. Free Download
Parallel::Workers::Transaction is a simple Perl module. Free Download
Language::Functional is a Perl module which makes Perl slightly more functional. Free Download
Perl6::Builtins is a Perl module that provides erl 5 versions of the new Perl 6 builtins. Free Download
CVS Perl library is a Perl module which is is a wrapper around the CVS command with an object-oriented interface. Free Download
AI::FuzzyLogic is a Perl module for Fuzzy Set Operations and Tools. Free Download
Latest Software
Popular Software
Favourite Software