background preloader

Perl and Prolog

Facebook Twitter


RAD. Perlbrew. Logic Programming with Perl and Prolog. Computing languages can be addictive; developers sometimes blame themselves for perceived inadequacies, making apologies for them.

Logic Programming with Perl and Prolog

That is the case, at least, when one defends his or her language of choice against the criticism of another language's devotee. Regardless, many programmers prefer one language, and typically ground that preference in a respect for that language's strengths. Perl has many strengths, but two most often cited are its adaptability and propensity to work as a "glue" between applications and/or data. However, Perl isn't the only advantageous language: programmers have used C or even assembly to gain speed for years, and intelligent use of SQL allows the keen coder to offload difficult data manipulations onto a database, for example.

Prolog is an often overlooked gem that, when combined with the flexibility of Perl, affords the coder powerful ways to address logical relationships and rules. A Bit About Prolog Prolog and Perl aren't exactly strangers, however. DIY Strong AI in any natural human language with step-by-step examples in Perl. Code the MainLoop shown above in your chosen programming language.

DIY Strong AI in any natural human language with step-by-step examples in Perl

Use either an actual loop with subroutine calls, or make a ringlet of perhaps object-oriented module stubs, each calling the next stub. Provide the ESCAPE key or other mechanisms for the user to stop the AI. Below is an example of starting to code as the Main AI Loop in Perl, along with page-number references to the fifth edition (2015) of the book PERL by Example, by Ellie Quigley. Start a subroutine or module that is able to sense something coming in from the outside world, i.e., a key-press on the keyboard. In Perl we will count on pressing Ctrl+C to halt the AI Mind program if we need to rescue it from an infinite loop.

Below is the expanded Perl code for AI Step #Two. DIY Strong AI in any natural human language with step-by-step examples in Perl. REST API tutorial - Backing up your knowledge base with Perl. You can use the Zendesk REST API with Perl to make backup copies of all the articles in your knowledge base.

REST API tutorial - Backing up your knowledge base with Perl

The backups can be useful in case you need to check or revert to a previous version of an article. This tutorial covers the following tasks: You can do all this with less than 50 lines of code. If you prefer using Python instead of Perl, see the Python version of this tutorial. Disclaimer: Zendesk provides this article for instructional purposes only. What you need You need a text editor and a command-line interface like the command prompt in Windows or the Terminal on the Mac. You'll also need to install Perl on your computer if you don't already have it. If you don't have Perl or have a version older than 5.10 on Mac or Windows, see to download and install the latest stable version.

After installing Perl, download and install the following modules if you don't already have them: See these instructions to install the modules. The plan. Zendesk REST API tutorial - Backing up your knowledge base with Perl. Simple - A simple expert system shell. AI::ExpertSystem::Simple - A simple expert system shell This document refers to verion 1.2 of AI::ExpertSystem::Simple, released June 10, 2003 This class implements a simple expert system shell that reads the rules from an XML knowledge base and questions the user as it attempts to arrive at a conclusion.

Simple - A simple expert system shell

Overview This class is where all the work is being done and the other three classes are only there for support. At present there is little you can do with it other than run it. To see how to use this class there is a simple shell in the bin directory which allows you to consult the example knowledge bases and more extensive documemtation in the docs directory. There is a Ruby version that reads the same XML knowledge bases, if you are interested. Constructors and initialisation new( ) The constructor takes no arguments and just initialises a few basic variables. Public methods reset( ) AI-ExpertSystem-Advanced-0.03 - Expert System with backward, forward and mixed algorithms. YAML - YAML Knowledge DB driver. AI::ExpertSystem::Advanced::KnowledgeDB::YAML - YAML Knowledge DB driver A YAML knowledge database driver.

YAML - YAML Knowledge DB driver

It reads a given YAML file and looks for the rules hash key. All of the elements of rules (causes and goals) are copied to the rules hash key of AI::ExpertSystem::Advanced::KnowledgeDB::Base. If no rules are found then it ends unsuccessfully. It also looks for any available questions under the questions hash key, however if no questions are found then they are not copied :-) filename. Practical Artificial Intelligence with Perl. Bidirectional Associative Memory Bidirectional Associative Memory (BAM) is a type of recurrent neural network.

Practical Artificial Intelligence with Perl

This type of neural net has 2 layers: input and output and they send information to each other. In the learning step for BAM we need to find correlation matrix between input and output. It can be easy found by formula. Let's take a look how it can be detected. Finding the Weight Matrix BAM can be desribed by formula: Y=sign(XW) Real-time CDN. CPAN Testers Reports: Index.