CLIPS Basic Programming Guide Version 6.30 March 17Th 2015

Total Page:16

File Type:pdf, Size:1020Kb

CLIPS Basic Programming Guide Version 6.30 March 17Th 2015 Reference Manual Volume I Basic Programming Guide Version 6.30 March 17th 2015 CLIPS Reference Manual CLIPS Basic Programming Guide Version 6.30 March 17th 2015 CONTENTS License Information ....................................................................................................................... i Preface ........................................................................................................................................... iii Acknowledgements ...................................................................................................................... vii Section 1: Introduction .................................................................................................................. 1 Section 2: CLIPS Overview .......................................................................................................... 3 2.1 Interacting with CLIPS ........................................................................................................ 3 2.1.1 Top Level Commands ................................................................................................ 3 2.1.2 Automated Command Entry and Loading .................................................................. 4 2.1.3 Integration with Other Programming Languages ....................................................... 5 2.2 Reference Manual Syntax .................................................................................................... 5 2.3 Basic Programming Elements ............................................................................................. 6 2.3.1 Data Types .................................................................................................................. 6 2.3.2 Functions .................................................................................................................... 9 2.3.3 Constructs ................................................................................................................. 10 2.4 Data Abstraction ................................................................................................................ 11 2.4.1 Facts .......................................................................................................................... 11 2.4.2 Objects ...................................................................................................................... 13 2.4.3 Global Variables ....................................................................................................... 15 2.5 Knowledge Representation ................................................................................................ 15 2.5.1 Heuristic Knowledge – Rules ................................................................................... 15 2.5.2 Procedural Knowledge ............................................................................................. 16 2.6 CLIPS Object-Oriented Language .................................................................................... 18 2.6.1 COOL Deviations from a Pure OOP Paradigm ........................................................ 18 2.6.2 Primary OOP Features .............................................................................................. 18 2.6.3 Instance-set Queries and Distributed Actions .......................................................... 19 Section 3: Deftemplate Construct ............................................................................................. 21 3.1 Slot Default Values ............................................................................................................ 22 3.2 Slot Default Constraints for Pattern-Matching .................................................................. 23 3.3 Slot Value Constraint Attributes ....................................................................................... 23 3.4 Implied Deftemplates ........................................................................................................ 23 Section 4: Deffacts Construct .................................................................................................... 25 Section 5: Defrule Construct ..................................................................................................... 27 CLIPS Basic Programming Guide i CLIPS Reference Manual 5.1 Defining Rules ................................................................................................................... 27 5.2 Basic Cycle Of Rule Execution ......................................................................................... 28 5.3 Conflict Resolution Strategies ........................................................................................... 29 5.3.1 Depth Strategy .......................................................................................................... 29 5.3.2 Breadth Strategy ....................................................................................................... 29 5.3.3 Simplicity Strategy ................................................................................................... 29 5.3.4 Complexity Strategy ................................................................................................. 30 5.3.5 LEX Strategy ............................................................................................................ 30 5.3.6 MEA Strategy ........................................................................................................... 31 5.3.7 Random Strategy ...................................................................................................... 32 5.4 LHS Syntax ....................................................................................................................... 33 5.4.1 Pattern Conditional Element ..................................................................................... 34 5.4.2 Test Conditional Element ......................................................................................... 51 5.4.3 Or Conditional Element ............................................................................................ 52 5.4.4 And Conditional Element ......................................................................................... 53 5.4.5 Not Conditional Element .......................................................................................... 54 5.4.6 Exists Conditional Element ...................................................................................... 55 5.4.7 Forall Conditional Element ...................................................................................... 56 5.4.8 Logical Conditional Element .................................................................................... 58 5.4.9 Automatic Replacement of LHS CEs ....................................................................... 61 5.4.10 Declaring Rule Properties ....................................................................................... 62 Section 6: Defglobal Construct .................................................................................................. 65 Section 7: Deffunction Construct .............................................................................................. 71 Section 8: Generic Functions ..................................................................................................... 75 8.1 Note on the Use of the Term Method ................................................................................ 75 8.2 Performance Penalty of Generic Functions ....................................................................... 76 8.3 Order Dependence of Generic Function Definitions ......................................................... 76 8.4 Defining a New Generic Function ..................................................................................... 76 8.4.1 Generic Function Headers ........................................................................................ 77 8.4.2 Method Indices ......................................................................................................... 77 8.4.3 Method Parameter Restrictions ................................................................................ 78 8.4.4 Method Wildcard Parameter ..................................................................................... 79 8.5 Generic Dispatch ............................................................................................................... 81 8.5.1 Applicability of Methods Summary ......................................................................... 82 8.5.2 Method Precedence .................................................................................................. 84 8.5.3 Shadowed Methods .................................................................................................. 86 8.5.4 Method Execution Errors ......................................................................................... 86 8.5.5 Generic Function Return Value ................................................................................ 87 Section 9: CLIPS Object Oriented Language .......................................................................... 89 9.1 Background ........................................................................................................................ 89 ii Table of Contents CLIPS Reference Manual 9.2 Predefined System Classes ................................................................................................ 89 9.3 Defclass
Recommended publications
  • UNIX Workshop Series: Quick-Start Objectives
    Part I UNIX Workshop Series: Quick-Start Objectives Overview – Connecting with ssh Command Window Anatomy Command Structure Command Examples Getting Help Files and Directories Wildcards, Redirection and Pipe Create and edit files Overview Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y [email protected] Linux: In local shell ssh –Y [email protected] Windows: Start Xming and PuTTY Create a saved session for the remote host name centos.css.udel.edu using username Connecting with ssh First time you connect Unix Basics Multi-user Case-sensitive Bash shell, command-line Commands Command Window Anatomy Title bar Click in the title bar to bring the window to the front and make it active. Command Window Anatomy Login banner Appears as the first line of a login shell. Command Window Anatomy Prompts Appears at the beginning of a line and usually ends in $. Command Window Anatomy Command input Place to type commands, which may have options and/or arguments. Command Window Anatomy Command output Place for command response, which may be many lines long. Command Window Anatomy Input cursor Typed text will appear at the cursor location. Command Window Anatomy Scroll Bar Will appear as needed when there are more lines than fit in the window. Command Window Anatomy Resize Handle Use the mouse to change the window size from the default 80x24. Command Structure command [arguments] Commands are made up of the actual command and its arguments. command -options [arguments] The arguments are further broken down into the command options which are single letters prefixed by a “-” and other arguments that identify data for the command.
    [Show full text]
  • CIS 90 - Lesson 2
    CIS 90 - Lesson 2 Lesson Module Status • Slides - draft • Properties - done • Flash cards - NA • First minute quiz - done • Web calendar summary - done • Web book pages - gillay done • Commands - done • Lab tested – done • Print latest class roster - na • Opus accounts created for students submitting Lab 1 - • CCC Confer room whiteboard – done • Check that headset is charged - done • Backup headset charged - done • Backup slides, CCC info, handouts on flash drive - done 1 CIS 90 - Lesson 2 [ ] Has the phone bridge been added? [ ] Is recording on? [ ] Does the phone bridge have the mike? [ ] Share slides, putty, VB, eko and Chrome [ ] Disable spelling on PowerPoint 2 CIS 90 - Lesson 2 Instructor: Rich Simms Dial-in: 888-450-4821 Passcode: 761867 Emanuel Tanner Merrick Quinton Christopher Zachary Bobby Craig Jeff Yu-Chen Greg L Tommy Eric Dan M Geoffrey Marisol Jason P David Josh ? ? ? ? Leobardo Gabriel Jesse Tajvia Daniel W Jason W Terry? James? Glenn? Aroshani? ? ? ? ? ? ? = need to add (with add code) to enroll in Ken? Luis? Arturo? Greg M? Ian? this course Email me ([email protected]) a relatively current photo of your face for 3 points extra credit CIS 90 - Lesson 2 First Minute Quiz Please close your books, notes, lesson materials, forum and answer these questions in the order shown: 1. What command shows the other users logged in to the computer? 2. What is the lowest level, inner-most component of a UNIX/Linux Operating System called? 3. What part of UNIX/Linux is both a user interface and a programming language? email answers to: [email protected] 4 CIS 90 - Lesson 2 Commands Objectives Agenda • Understand how the UNIX login • Quiz operation works.
    [Show full text]
  • The Oldest Rivalry in Computing Forget Apple Vs
    Follow us on Twitter for more great Slate stories! Follow @slate BITWISE DECODING THE TECH WORLD. MAY 9 2014 9:57 AM The Oldest Rivalry in Computing Forget Apple vs. Google. Emacs and Vi have been battling for text-editor supremacy among programmers for 40 years. By David Auerbach An early Emacs manual cover from 1981. Courtesy of GNU Emacs n a world where both software and hardware frequently become obsolete right I on release, two rival programs can stake a claim to being among the longest-lived applications of all time. Both programs are about to enter their fifth decades. Both programs are text editors, for inputting and editing code, data files, raw HTML Web pages, and anything else. And they are mortal enemies. Their names are Emacs and Vi (styled by programmers as “vi”). These editors are legendary and ancient, no exaggeration. Both date back to at least 1976, making them older than the vast majority of people currently using them. Both programs are text editors, which means they are not WYSIWYG (what you see is what you get)—unlike, say, word processors like Microsoft Word, they do not format your words onscreen. Programming is very different from word processing, and the basic goal of Emacs and Vi—fast editing of source code (and any other text files)—has yet to become obsolete. Both have been in ongoing development for almost 40 years. These two wizened programs are as close to equally matched enemies as any two programs have ever been. If you know a programmer who uses one of them, there’s a good chance that she hates the other.
    [Show full text]
  • Mandoc: Becoming the Main BSD Manual Toolbox
    mandoc: becoming the main BSD manual toolbox BSDCan 2015, June 13, Ottawa Ingo Schwarze <[email protected]> Cynthia Livingston’sOTTB “Bedifferent” (c) 2013 C. Livingston (with permission) > Ingo Schwarze: mandoc page 2: INTROI BSDCan 2015, June 13, Ottawa Brief history of UNIX documentation • The key point: All documentation in one place and one format. Easy to find, uniform and easy to read and write. Be correct, complete, concise. • 1964: RUNOFF/roffmarkup syntax by Jerome H. Saltzer,MIT. Unobtrusive,diff(1)-friendly,easy to hand-edit, simple tools, high quality output. • 1971: Basic manual structure by Ken Thompson and Dennis Ritchie for the AT&T Version 1 UNIX manuals, Bell Labs. • 1979: man(7) physical markup language for AT&T Version 7 UNIX. • 1989: mdoc(7) semantic markup by Cynthia Livingston for 4.3BSD-Reno. Powerful, self-contained, portable. • 1989: GNU troffbyJames Clarke. • 2001: mdoc(7) rewrite by Werner Lemberg and Ruslan Ermilovfor groff-1.17. • 2008: mandoc(1) started by Kristaps Dzonsons. • 2010: mandoc(1) is the only documentation formatter in the OpenBSD base system. • 2014: mandoc(1) used by default in OpenBSD, FreeBSD, NetBSD, illumos. 16:19:30 What is the mandoc toolbox? → < > Ingo Schwarze: mandoc page 3: INTROIIBSDCan 2015, June 13, Ottawa What is the mandoc toolbox? User perspective:man(1), the manual viewer One comprehensive tool! Normal operation always proceeds in three steps: 1. Find one or more manuals in the file system or using a database by manual name — man(1) — or by search query — apropos(1) =man -k The result of this step can be printed out with man -w.
    [Show full text]
  • Learning the Vi Editor
    Learning the vi Editor en.wikibooks.org December 29, 2013 On the 28th of April 2012 the contents of the English as well as German Wikibooks and Wikipedia projects were licensed under Creative Commons Attribution-ShareAlike 3.0 Unported license. A URI to this license is given in the list of figures on page 103. If this document is a derived work from the contents of one of these projects and the content was still licensed by the project under this license at the time of derivation this document has to be licensed under the same, a similar or a compatible license, as stated in section 4b of the license. The list of contributors is included in chapter Contributors on page 101. The licenses GPL, LGPL and GFDL are included in chapter Licenses on page 107, since this book and/or parts of it may or may not be licensed under one or more of these licenses, and thus require inclusion of these licenses. The licenses of the figures are given in the list of figures on page 103. This PDF was generated by the LATEX typesetting software. The LATEX source code is included as an attachment (source.7z.txt) in this PDF file. To extract the source from the PDF file, you can use the pdfdetach tool including in the poppler suite, or the http://www. pdflabs.com/tools/pdftk-the-pdf-toolkit/ utility. Some PDF viewers may also let you save the attachment to a file. After extracting it from the PDF file you have to rename it to source.7z.
    [Show full text]
  • R for Beginners
    R for Beginners Emmanuel Paradis Institut des Sciences de l'Evolution´ Universit´e Montpellier II F-34095 Montpellier c´edex 05 France E-mail: [email protected] I thank Julien Claude, Christophe Declercq, Elo´ die Gazave, Friedrich Leisch, Louis Luangkesron, Fran¸cois Pinard, and Mathieu Ros for their comments and suggestions on earlier versions of this document. I am also grateful to all the members of the R Development Core Team for their considerable efforts in developing R and animating the discussion list `rhelp'. Thanks also to the R users whose questions or comments helped me to write \R for Beginners". Special thanks to Jorge Ahumada for the Spanish translation. c 2002, 2005, Emmanuel Paradis (12th September 2005) Permission is granted to make and distribute copies, either in part or in full and in any language, of this document on any support provided the above copyright notice is included in all copies. Permission is granted to translate this document, either in part or in full, in any language provided the above copyright notice is included. Contents 1 Preamble 1 2 A few concepts before starting 3 2.1 How R works . 3 2.2 Creating, listing and deleting the objects in memory . 5 2.3 The on-line help . 7 3 Data with R 9 3.1 Objects . 9 3.2 Reading data in a file . 11 3.3 Saving data . 14 3.4 Generating data . 15 3.4.1 Regular sequences . 15 3.4.2 Random sequences . 17 3.5 Manipulating objects . 18 3.5.1 Creating objects .
    [Show full text]
  • Linux Command Guide Echo Man Apropos
    Linux Command Guide - Logan - For this guide, I will try to start simple and work my way up to the more complicated topics using layman terms. From echo, to scripting. echo The echo command is very simple, yet very powerful as you'll eventually come to learn. Simply type echo, followed by whatever you want to be echoed, and the command will echo it back at you. Example: Man If you don't know any other command, you should at least know man. Man is short for manual and it's a command used to retrieve some help and documentation (manual pages) on various BASH commands for learning. To use it, simply type man followed by the name of the command about which you are interested in learning. For example: man echo will retrieve the manual page for the grep command for your endless reading pleasure. Apropos The man pages have short descriptions that you can search using the command apropos. If you have a very basic idea of what the command you're looking for does, but aren't sure what it's called, you can type apropos, followed by a word associated with the function of the command to find it. For example: This shows a list of short man page descriptions that contain the keyword “who”. Info / pinfo The info command is a lot like the man command, except it will often retrieve more detailed help than that found in the man pages. It is used in the same way as the man command. Info is also more relevant to GNU based utilities, and sometimes, if you can't find a man page for a command, you can find the info for it.
    [Show full text]
  • Linux File System and Linux Commands
    Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers Review of the Linux File System and Linux Commands 1. Introduction Becoming adept at using the Linux OS requires gaining familiarity with the Linux file system, file permissions, and a base set of Linux commands. In this activity, you will study how the Linux file system is organized and practice utilizing common Linux commands. Objectives • Describe the purpose of the /bin, /sbin, /etc, /var/log, /home, /proc, /root, /dev, /tmp, and /lib directories. • Describe the purpose of the /etc/shadow and /etc/passwd files. • Utilize a common set of Linux commands including ls, cat, and find. • Understand and manipulate file permissions, including rwx, binary and octal formats. • Change the group and owner of a file. Materials • Windows computer with access to an account with administrative rights The Air Force Cyber College thanks the Advanced Cyber Engineering program at the Air Force Research Laboratory in Rome, NY, for providing the information to assist in educating the general Air Force on the technical aspects of cyberspace. • VirtualBox • Ubuntu OS .iso File Assumptions • The provided instructions were tested on an Ubuntu 15.10 image running on a Windows 8 physical machine. Instructions may vary for other OS. • The student has administrative access to their system and possesses the right to install programs. • The student’s computer has Internet access. 2. Directories / The / directory or root directory is the mother of all Linux directories, containing all of the other directories and files. From a terminal users can type cd/ to move to the root directory.
    [Show full text]
  • The Linux Command Line
    The Linux Command Line Second Internet Edition William E. Shotts, Jr. A LinuxCommand.org Book Copyright ©2008-2013, William E. Shotts, Jr. This work is licensed under the Creative Commons Attribution-Noncommercial-No De- rivative Works 3.0 United States License. To view a copy of this license, visit the link above or send a letter to Creative Commons, 171 Second Street, Suite 300, San Fran- cisco, California, 94105, USA. Linux® is the registered trademark of Linus Torvalds. All other trademarks belong to their respective owners. This book is part of the LinuxCommand.org project, a site for Linux education and advo- cacy devoted to helping users of legacy operating systems migrate into the future. You may contact the LinuxCommand.org project at http://linuxcommand.org. This book is also available in printed form, published by No Starch Press and may be purchased wherever fine books are sold. No Starch Press also offers this book in elec- tronic formats for most popular e-readers: http://nostarch.com/tlcl.htm Release History Version Date Description 13.07 July 6, 2013 Second Internet Edition. 09.12 December 14, 2009 First Internet Edition. 09.11 November 19, 2009 Fourth draft with almost all reviewer feedback incorporated and edited through chapter 37. 09.10 October 3, 2009 Third draft with revised table formatting, partial application of reviewers feedback and edited through chapter 18. 09.08 August 12, 2009 Second draft incorporating the first editing pass. 09.07 July 18, 2009 Completed first draft. Table of Contents Introduction....................................................................................................xvi
    [Show full text]
  • Matrix Graph Grammars
    MATRIX GRAPH GRAMMARS by Pedro Pablo P´erez Velasco Version 1.2 arXiv:0801.1245v2 [cs.DM] 17 Nov 2009 c Copyright by Pedro Pablo P´erez Velasco 2007, 2008, 2009 To my family VII ACKNOWLEDGEMENTS These lines are particularly pleasant to write. After all those years, I have a quite long list of people that have contributed to this book in one way or another. Unfortunately, I will not be able to include them all. Apologizes for the absences. First of all my family. Gema, with neverending patience and love, always supports me in every single project that I undertake. My unbounded love and gratitude. Hard to return, though I’ll try. My two daughters, Sof´ıaand Diana, make every single moment worthy. I’m absolutely grateful for their existence. My brothers Alex´ and Nina, now living in Switzerland, with whom I shared so many moments and that I miss so much. My parents, always supporting also with patience and love, worried if this boy would become a man (am I?). Juan, my thesis supervisor, whose advice and interest is invaluable. He has been actively involved in this project despite his many responsibilities. Also, I would like to thank the people at the series of seminars on complexity theory at U.A.M., headed by Roberto Moriy´on, for their interest on Matrix Graph Grammars. Many friends have stoically stood some chats on this topic affecting interest. Thank you very much for your friendship. KikeSim, GinHz, Alvaro´ Iglesias, Jaime Guerrero, ... All those who have passed by are not forgotten: People at ELCO (David, Fabrizio, Juanjo, Juli´an, Lola, ...), at EADS/SIC (Javier, Sergio, Roberto, ...), at Isban, at Banco Santander.
    [Show full text]
  • Linux Information Sheet Linux Information Sheet
    Linux Information Sheet Linux Information Sheet Table of Contents Linux Information Sheet....................................................................................................................................1 Michael K. Johnson <[email protected]>.......................................................................................1 1.Introduction to Linux............................................................................................................................1 2.Linux Features......................................................................................................................................1 3.Hardware Issues....................................................................................................................................1 4.An Incomplete List of Ported Programs and Other Software...............................................................1 5.Who uses Linux?...................................................................................................................................1 6.Getting Linux........................................................................................................................................1 7.Legal Status of Linux............................................................................................................................2 8.News About Linux................................................................................................................................2 9.The Future.............................................................................................................................................2
    [Show full text]
  • User's Guide PDF.Pages
    CLIPS User’s Guide by Joseph C. Giarratano, Ph.D. Version 6.30 Table of Contents Readme ....................................................................................i Just the Facts ............................................................................1 Following the Rules ...............................................................20 Adding Details .......................................................................29 Variable Interests ...................................................................36 Doing It Up In Style .............................................................49 Being Functional ...................................................................59 How to Be in Control ............................................................70 Matters of Inheritance ..........................................................78 Meaningful Messages ............................................................96 Fascinating Facets ................................................................109 Handling Handlers ..............................................................116 Questions and Answers .......................................................145 Support Information ...........................................................154 Readme The first step on the road to wisdom is the admission of ignorance. The second step is realizing that you don’t have to blab it to the world. This section was formerly called the Preface, but since nobody read it, I renamed it to a more conventional title that computers
    [Show full text]