Tuesday, July 22, 2008

Decide the Accessibility of Class Members in C Sharp

Another article in wikiHow ...


How to Decide the Accessibility of Class Members in C Sharp


from wikiHow - The How to Manual That You Can Edit

One of the choices you always make as a C# programmer is to decide the accessibility of each member (field, event, property and method) you declare in your classes. For advanced C# programmers, this is not actually really hard, but it can be pretty destructive for new to intermediate C# programmers, and seldom, even to advanced one. This article outlines the process of deciding the accessibility of your members in a systematic, easy to remember and straightforward approach.

Steps

  1. Design and implement your members as if you have already decided their accessibility level (usually this is done by implementing all members as public)
  2. Start deciding the accessibility of each member by itself repeating the following steps on all members:
    1. Start by giving the member the lowest accessibility possible: (private)
    2. Answer the following questions:
      • Will any existing code in your application or solution be affected by declaring the member on this accessibility level? For example, some other class might have code that accesses this member or uses it and because of the current level of accessibility chosen, it won't be able to access it anymore.
      • Is your member designed to be used by other developers, and if so, will they be able to access it in its current accessibility level?
      • In your future code, will changing the accessibility of this member be near impossible?
      • Is your class intended to be inherited, and if so, will the inheriting class face troubles accessing this member (if it is allowed to)?

    3. Check if the answers to all the previous questions were "no" or not.
    4. If the answers were all "no", leave the accessibility level as it is and start deciding the accessibility of another member
    5. If one or more of the answers was "yes", increase the level of accessibility one degree and repeat the steps for the same member, from step 2

Tips

  • Stick to this approach until you find that more than 90% of your decisions without using this approach match the results obtained by applying this approach, then you can start counting more on your own initial judgment.
  • When you become more and more familiar with programming in C#, many standard choices become obvious and they do not need a method to be decided. Hence, you start applying this approach only to those member you doubt or not included in any standard.
  • Even for advanced programmers, this approach can be helpful when used while skimming through your code in the final stages. It might catch some member declared using a higher accessibility than actually required even if that happened by chance or as a result of a typing error.
  • Some of the standard accessibility levels that became well established amongst C# programmers are:
    • Fields are usually declared private in structs and sealed classes and as protected in most other classes (unless you do not intend to inherit the class neither allow anyone who does to access the field, then private it is)
    • Class fields that are static readonly or const are usually public as they usually hold constant data available to other users of the class
    • Methods can be declared of any accessibility but usually are either:
      • private for internal implementation methods.
      • protected for virtual methods such as event firing methods.
      • public for user methods (methods that will be used by users of the class)

    • Events are usually public. In rare cases we need private events and even less protected events.
    • Properties are usually public or private. In rare situations we need protected or internal properties.

Warnings

  • It is considered a very bad programming practice to declare members with higher accessibility levels than they really require. This puts holes in your code.
  • Do not take the last tip in the "Tips" section as a starting point unless you are really familiar with the steps before it and have applied them many times. They are not always correct and they depend mainly on the situation.

Related wikiHows

Article provided by wikiHow, a collaborative writing project to build the world's largest, highest quality how-to manual. Please edit this article and find author credits at the original wikiHow article on How to Decide the Accessibility of Class Members in C Sharp. All content on wikiHow can be shared under a Creative Commons license.

Sunday, July 20, 2008

How to Use Regular Expression Classes in the .Net Framework

Programming Language: Any .NET Language
Type: Tutorial
Level: Everyone
Topic Category: General Programming
Main Series: Regular Expressions in the .NET Framework
Topic Title:
How to Use Regular Expression Classes in the .Net Framework
My last article on wikiHow:
How to Use Regular Expression Classes in the .Net Framework - wikiHow

Many beginning programmers spend much time coding search and replace logic while the .NET framework offers a powerful class framework to use regular expressions that you can use to perform various tasks on text and binary data. This article introduces you to the regular expression classes in the .NET framework and how to use them to perform tasks easier in a systematic way.

Steps
  1. Decide the specific use of regular expressions you need. Regular expressions are normally used for one of the following:
    1. Check if a string has a certain pattern within it
    2. Validate a string against a pattern
    3. Replace a specific pattern with another pattern
    4. Split a string using a pattern delimiter
    5. Find all ocurrences of a certain pattern within a string
    6. Extract pattern pieces/groups from a string (like in syntax checking/highlighting)
  2. Design and decide the regular expression you want to use. See a tutorial on regular expressions or visit an online library of regular expressions
  3. Decide the regular expressions matching options you want to use. The setting you need to decide are:
    1. Case sensitivity of matching
    2. Whether you want to ignore any white spaces within the regular expression while matching or not
    3. Whether the matching is multiline or not (this changes the meaning of ^ and $ to match to the beginning and end of lines and not only the beginning and end of the whole string)
    4. The direction of the matching process (left-to-right or right-to-left)
    5. Whether . will match any character including or not including new line
    6. Whether to compile the regular expression to the assembly (slow start up, fast processing) or not (the contrary)
    7. Whether to ignore culture variance/change or not
    8. Whether to use ECMA Script compliant mode or not
    9. Whether to capture every group (any sub-expression within parenthesis) or only groups that are named
  4. Create a RegexOptions object and add all options (by using bit-wise or "|") - This step is optional
  5. Choose the member method you want to use. This depends on your choice in step 1. You have the following choices:
    • IsMatch() - if you only need to check whether a match was found or not
    • Match() - if you want to get the first match found. Calling this method again will get the next match and so on.
    • Matches() - if you want to retrieve all matches of the pattern in one call
    • Split() - if you want to split the string at the matches of the pattern
    • Replace() - if you want to replace the matches of the pattern with another pattern or string
  6. Decide whether you want to use the static version of the method or the instance version. Static methods do not require the creation of a Regex object but they do not keep the status of matching between calls. According to your choice, follow the following steps:
    • For static versions of the methods:
      1. Declare an appropriate reference to hold the results of the operation if necessary. Here is a list of the methods and the type of results they return:
        • IsMatch() - bool
        • Match() - Match
        • Matches() - MatchCollection
        • Replace() - string
        • Split() - string[]
      2. Call the appropriate method from the Regex class passing it the regular expression, the string, the options, and the replacement pattern in case of Replace() and assign the result to the reference you declared in the previous step.
    • For instance versions of the methods:
      1. Create a Regex object passing the regular expression you created, and the matching options to the constructor.
      2. Declare an appropriate result reference to hold the results obtained (like step 1 in the static version of the method)
      3. Call the method you choose from the regex object passing it the string to be matched and assign the result to the reference created in the previous step.
  7. Use the results obtained at the end of step 6 in the rest of your code. Usual uses of results are listed below in the "Common Uses of Regex Methods Results" section
Common Uses of Regex Methods Results
  • IsMatch(): returns a boolean value that is usally used in:
    • A single conditional construct such as the "if .. else" code construct or the "?:" operator construct. This is usually when you want to check if a pattern generally exists in a string to decide whether to do some action or not (for example check if the text of a post contains some offensive word to decide whether to allow the post or ban it altogether)
    • A looping construct such as a while or do ... while loop. This usually is used with instance versions of the method Match to iterate through all matches as long as there are matches to iterate through. Sometimes, it is used with streamed string to check the matches of apattern in a text while it arrives through the stream.
    • Validation of controls. Usually this is done by binding some property of the control to the result (for example, making a textbox disabled as long as the regex can not find a match in the string within the text box
  • Replace(): returns a string with the pattern replaced with the replacement pattern or string. The resulting string is usually used in place of the original string. Some examples of the use of Replace() are:
    • Replacing all offensive words in a post with special characters such as ! or #
    • Replacing all html markup with html code that will display the markup instead of executing it (for example, replacing <>
    • Encrypting strings (premutation encryption)
    • Replacing special characters with other escaped values (for example replacing \ with \\)
  • Split(): returns a string array with all tokens after spliting the original string at the patterns found. This is usualy used in code parsing.
  • Match(): returns a Match object that has information on the match found by the last call of Match(). Match objects contain information on capture groups and captures within the single match. Example uses of the Match object result and the Match() method:
    • Syntax highlighting.
    • Storing the matches found in some data storage facility such as a database.
    • Performing more complex replacing on the string by calculating the replacement of each capture.
    • Detailed finding of matches within a long text.
  • Matches(): returns a MatchCollection object which is actually a collection of Match objects (you may think of it as a typed ArrayList of Match objects). This method is a call-once alternative to Match() so it has the same uses.
Tips
  • All matching options are turned off by default (that is, if you don't specify any of the options or use RegexOptions.None)
  • If you don't uinderstand any of the regular expressions matching options, leave turned off.
  • You can use Regex.Escape() and Regex.Unescape() methods to escape/un-escape special regex characters within a regular expression
  • To get the regular expression that was passed to the constructor of a Regex object, use the ToString() method. The method is overriden in Regex so that it returns the regular expression.
  • Thoroughly examine your regular expression before using it in a production-environment application. Regular expressions can be very tricky. Look at the "Related websites and online tutorials" section for further reading on regular expressions.
  • Use lookahead and lookbehind expressions wisely. They are hard to write and cost a lot of processing.
  • If your regular expression is large, uses a lot of backtracking, very complex or is intended to process large amounts of data, consider using a compiled assembly version of the regular expression. You can create regular expressions compiled assembly by using the Regex.CompileToAssembly() method.
Warnings
  • Passing an invalid regular expression to the constructor of Regex or to one of the static methods in the Regex class will through an exception so use try ... catch blocks.
  • Extra large regular expressions might cause the executing PC to run out of memory, so avoid using them.
Things You will Need
  • A .NET or mono compliant compiler and programming language.
  • A prior knowledge of regular expressions. See the "Related Websites and Online Tutorials" section for further information on regulare expressions.
  • A regular expressions toolbox application like RegexBuddy will help you test your regular expressions. This is optional.
  • A .NET integrated development environment will help you write code easier. This is optional.
Related Websites and Online Tutorials
Related wikiHows

Thursday, July 10, 2008

Create an Event for a C Sharp Class

Programming Language: C#
Type: Guide, Tutorial
Level: Moderate
Topic Category: General Programming
Topic Title:
Create an Event for a C Sharp Class - Article I wrote for wikiHow


I found this new Wiki which is also powered by WikiMedia, the same organization that powers Wikipedia. It features a wiki of how-to articles wrote by volunteers, and I can't resist this. So I wrote the following article in wikiHow. It was my first contribution to the site and I hope it will not be the last. I also include it here for those not familiar with wikiHow and for my students. I kept the same article structure used in wikiHow which is designed for good how-to documents and might be not really appropriate for a blog. however, because the site is based on a Creative Commons license, I had to keep the disclaimer at the end. My Screen Name on wikiHow is C#Freak which I'm trying to use in every community from now on.

from wikiHow - The How to Manual That You Can EditMany C# programmers use events in other classes by attaching event handlers to them but have you ever wanted to implement your own event(s) in classes that you develop? This is a systematic straightforward guide to creating your own events without worrying about forgetting anything.

Steps

1. Create the Event Arguments Class:

  1. Decide what you want to communicate with your event subscribers (other programmers who will attach event handlers to your event). For example, if your event is to notify developers when a value changes, you might want to tell them the old value and the new one. If you have nothing to communicate to subscribers, use the System.EventArgs class and skip this step.
  2. Create a class named EventNameEventArgs where EventName is the name of your event
  3. Inherit the EventNameEventArgs class from System.EventArgs
  4. Create a protected field for each piece of data you want to communicate with your subscribers. For example, in an event that will notify developers of a change in a string value, you might want to tell them the old and the new strings so the fields will look like:
    protected string oldVal, newVal;
  5. Create a public property for each field you created in 1.4 that has only a get{ return fieldName;} method (where fieldName is the name of the field you created in 1.4
  6. Create a private empty constructor for the class with no implementation. The constructor should look like: private EventNameEventArgs(){}
  7. Create a public constructor for the class that takes as many arguments as there is fields/data. For example, in a string value change event, the constructor will look like:public EventNameEventArgs(string oldValue, string newValue){oldVal = oldValue; newVal = newValue;}

2. Declare the event delegate. If you did not create an event arguments class because there is no data to communicate with subscribers, use the System.EventHandler delegate and skip this step. The delegate declaration should look like: public delegate void EventNameHandler(object sender, EventNameEventArgs e);

3. Declare the event itself in the containing class: use the event handler delegate you declared/decided in 2 as the event type. The declaration should look like:public event EventNameHandler EventName;

4. Declare the event-firing method - a protected virtual method that has exactly the following declaration:protected virtual void OnEventName(EventNameEventArgs e){ if(EventName != null) { EventName(this, e); } }Use the event arguments class you decided to use in 1

5. Call the event-firing method you declared in 4 whenever the event occurs. This is the hardest part. You should know when the event you are creating will fire (what areas in your code causes the event to occur) and call the method with the appropriate event arguments class instance. For example, in the string value change event, you must see what code can cause this value to change, save its old value before the change, allow the code to change the value, create an event arguments object with the old and new values passed to the constructor and pass the object to the event-firing method.

Tips

  • Be committed to the naming convention stated in this guide, it is a de-facto standard and most .NET/Mono developers use it.
  • Do not over communicate to your subscribers. In other words, do not transfer data that is not related to the event.
  • Choose the name of your event carefully and clearly. Event names like "ValPsd" instead of "ValuePassed" is not encouraged.
  • Usually, the accessibilities used in this article is the case. However, you can change the accessibility of any declaration as long as it does not render the element changed unusable by other elements of the event creation process.
  • Examine all places in your code where the event might occur. Sometimes, more than one piece of code causes the event to fire.
  • Watch for any changes you make to your class after you declare the event. See if the change affects the triggering/firing of the event.

Warnings

If you are adding the event to a struct instead of a class, take notice of the following changes:

  1. Use "private" instead of "protected virtual" when declaring the event-firing method in 4.
  2. In the constructor of the struct that declares the event, you must initialize the event itself or you will get a compile error. Initialize events by creating new event handler delegate objects and assigning them to the event. The initialization code should look like:EventName = new EventNameHandler(); or EventNameHandler = null;

Things You'll Need

  • A .NET framework installed (either MS .NET framework on Windows or Mono on other operating systems).
  • A C# compiler (the csc tool in the MS .NET SDK, cmcs in the Mono framework, or the compiler included in .NET IDEs such as Visual Studio 2005/2008 for Windows or MonoDev for Linux).
  • The code of the class you wish to add the event to.
  • Some code editing tool (Notepad is enough, but Visual Studio, MonoDev, Notepad++ or any other editor might make development and code writing easier.
Article provided by wikiHow, a collaborative writing project to build the world's largest, highest quality how-to manual. Please edit this article and find author credits at the original wikiHow article on How to Create an Event for a C Sharp Class. All content on wikiHow can be shared under a Creative Commons license.

Monday, July 7, 2008

1) An Introduction to Designing Classes in C# - Pt.3

Programming Language: C#
Type: Tutorial
Level: Beginners
Topic Category: General Programming
Main Series:
Designing and Implementing Classes in C#
Topic Title: 1) An Introduction to Designing Classes in C# - Pt.3

Quick Review:
In part 1 of this article, we discussed classes and how to design them. We established what classes are and what they are used for and what they consist of. In part 2, we introduced the general syntax for defining classes in C# and discussed the first part of the declaration: access modifiers. In this article, we will continue discussing the declaration of classes and will introduce the different types of members of classes.

Remind me again how to declare a class in C#!
Here's a small reminder:
access-modifier [static|abstract|sealed] class class-name [: [parentClass][, implementedInterface]*]

Oh yes, I remember now. So we stopped at access modifiers. What are these three other words (static, sealed and abstract)?
I'll introduce each of these modifiers briefly. However, the concepts behind them depend on other concepts we have not discussed yet such as inheritance, polymorphism and scope.
We start with the scope modifier, static.
Static Classes
Classes are usually defined so that we can declare objects of them later. In some cases however, we only need to declare one object of the class, no more no less. For example, if we want to define a class from which we will declare an object that describes the monitor of the system, the memory of the system, the cpu of the system or perhaps, the company for which we are developing the software. Classes like that are called singleton classes. Simply, one use of static classes is to represent these classes. Static, in C#, is usually used to describe members. It means in some way: "belonging to the class itself and not to any specific object of the class". For example, if we are defining a Point class, representing geometrical point objects, we might want to run the code in one of two modes: Cartesian and polar coordinates. The fact that "points" are expressed in either format, is irrelevant to any specific "point". In fact, it affects "all" points. That's a member that belongs to the class of points as a whole not to objects of the class. Now, static classes, are by definition in C# classes with all members being static. Meaning all members of a static class has to be declared static, which in turn means they belong to the class itself. By this, we can think of the class itself as being the only object declared. Static classes are also used to group a set of methods and properties that are related by task but not belonging to any specific object. For example, a set of methods that compare/convert objects of different types in some application are all related by task, but they do not belong to a specific object as they will always behave the same no matter what object they are in (or are not in for that matter). These members are all grouped as static members of a static class. Now we discuss the second modifier: abstract
Abstract classes:
Abstract classes are used when building hierarchies of classes that are related. To fully understand this modifier, you must be familiar with inheritance and polymorphism, so I will only say, they are classes with at least one abstract member. We will discuss abstract members immediatly after inheritance. That leaves us with only one modifier: sealed
Sealed classes:
Sealed classes are simply classes that do not allow any other class to inherit from them. Again, you must be familiar with the concept of inheritance to fully understand sealed classes, and they will be revisited in inheritance
Fair enough. So, can I learn to declare my first class now, or do I have to learn inheritance first?
Actually, it will be nearly impossible and in vain to learn inhertance when you don't know how to declare members. Also, except for an empty class, classes will usually need you declare one or more members. So let's start by a brief introduction about the syntax of these members and then writing the first class?
Types of Class Members:
Classes at most, consist of Fields, Methods, Properties, Events and Nested Types. Following is a brief description of each one:
Nested Types: These are simply types nested within other types. In other words, they are types that are defined within another type. They are used when a major type needs to gather a set of information to be used only by that type. For example, a software that interacts with a hardware device might need a structure to hold the settings of the device not as seen by a high level user, but after converting them to the complex and more detailed binary values that will actually be sent to the device. Nesting types within each other is usually seen in large software libraries development to emphasize a type is only declared for the use of another type only. You nest types simply by declaring the nested type/class within the scope boundaries of the nesting class as you would normally declare any class:
class PrinterDriver {
    class hardwarePageSettings{
    }
}
Fields: fields can be thought of as being the data storage slots of the class. Fields are data (informational) members that do actually store the object's data (unlike properties). In other words, if a class having a field called "length", is used to declare objects, all objects of this class will have its own "length". That's of course if the field is not static. As we mentioned earlier, static members belong to the class, meaning only one copy of the member will be available at anytime regardless of the objects declared from that class. Well, fields are no exception! Also, we mentioned earlier that members have access modifiers. Being a data storage, you must also provide the type of data that will be stored. According to this, the simplest good field declaration will look something like:
public class MailPackage{
    public int width;
    public int height;
    public int depth;
}
Methods: are used to represent the operational attributes of a class. They can be thought of as being blocks of code that takes inputs, makes some processing and return an output. The fields of the class (and the values of these fields in object of the class) are always available to the methods in the class to read and modify. The last feature eleminates the need for long parameters list in methods. Inputs are given to the method in the form of parameters (some methods take no inputs and so have no parameters). Each parameter is defined by a data type and an alias to be used by the moethod to distinguish it from other parameters. Parameters can be passed by value (default behavior), by reference (ref parameters) and as output parameters (out parameters). C# also supports variable length parameters lists (params arguments). Here's a sample method that will take an integer and calculates its square:
public class IntegerCalculations{
    public int Squared( int x){
        return x*x;
    }
}
Properties: are fake fields, or at least, that what they look like to C++ programmers! You use a property just like you would use a field in code. However, when declared, a property is actually two methods! One is used to get the value of the fake field and an optional one that will set that value. You usually use properties for the following purposes:
  1. To act like proxies for you fields. That is, you declare private fiields and create a public property for each field that will return and set its value. This is a common practice amongst programmers because it gives you the opportunity to modify the way a field is retrieved if it was needed or may be call some method everytime the field is written to.
  2. To declare calculated fields. These are fields that do not actually need to be stored because they can be inferred/calculated from other fields in the object. An example would be the area of a circle object which can be calculated from its radius.
  3. To make a field read-only for users of the class and still be able to write to it within the class. This is done by only defining the get method of the property
An example of properties is shown below where CenterX, CenterY and Radius are accessor (proxy) properties and Area is a calculated read only property:
public class Circle{
    private double x,y,r;
    public double CenterX{get{return x;}set{x = value;}}
    public double CenterY{get{return y;}set{y = value;}}
    public double Radius{get{return r;}set{r = value;}}
    public double Area{get{return Math.PI*r*r;}}
}
Events: wil actually be fully discussed in depth along with delegates in a coming article. In brief, they provide a means for other developers who will use your class to be notified when some event of interest occurs. This is done in a Publisher-Event-Subscriber model that works as follows:
  1. You publish an event by creating an event member in your class that will be accessible by subscribers
  2. Subscribers who are interested in the event will provide a method (or more) that should be executed when the event occurs. This is called "Attaching" "Handlers" to event, where handlers are the methods subscribers provide.
  3. Whenever the event occurs within your class, you find all methods attached to the event and execute them.
An example will be in the case where you want to notify develoeprs of a change in the radius of a circle, you will declare an event within the Circle class like this:
public event
EventHandler RadiusChanged;

Events are declared as if they were fields and their type must be a delegate.
Finally, Your First Class
Here we go, the first full class (well, not exactly full, but it will do). We will develop a Name class that is capable of holding the structured information of a person's name (First Name, MiddleName, LastName)
public class Name{
  //Private fields
  private string first, middle, last;
  private string prefix, suffix;
  //Public Accessor Properties
  public string First{get{return first;}set{first = value;}}
  public string Middle{get{return middle;}set{middle = value;}}
  public string Last{get{return last;}set{last = value;}}
  public string Prefix{get{return prefix;}set{prefix = value;}}
  public string Suffix{get{return suffix;}set{suffix = value;}}
  //Public Read-Only Calculated Properties
  public string Full{get{return last + ", " + first + " " + middle;}}
}

Now that you've written your first class, the following articles, will first tackle common basic types in C# and the .NET framework. The understanding of these fundamental types and some of there commonly used members is essential to writing any code. That concludes it for today's article.

Sunday, July 6, 2008

Get Started With Prolog

Prolog - Wikipedia, the free encyclopedia:
As usual, a good place will always be to go visit wikipedia and search for whatever it is you're looking for. This page includes all starting information you need to know about Prolog before you go search for any other resource.

prolog :- tutorial
A very neat and full of examples tutorial by J.R. Fisher on the Prolog programming language. Excellent place to begin learning prolog hands-on approach

ISO 13211-1:1995 - The ISO Standard for Prolog
For those interested in the ISO standard for Prolog, this is the official place to go. However, the ISO standards are only sold on this site!
Instead, you can go here to find some description on the standard, this time for free!
This site contains the December 1991 draft, the March 1993 draft, Richard O'Keefe's 1984 Prolog standard draft, and Michael Covington's summary of the standard. Note that no one at that site can answer any questions about the standard; it is just an FTP site for the standard in the USA.

FAQ - comp.lang.prolog
An extensive FAQ on Prolog, available in different formats (PDF, HTML, Text, SGML, Sources)
Look at this question on the HTML version of the FAQ, it will contain a list of where you can get a free Prolog compiler.

Online guide to Prolog Programming
This is a Prolog book/guide with a very distinguished idea that I personally liked very much, which is the "Test Zone" which is a java applet where you can test your samples and code. The site and guide is designed and written by an Associate Professor at Charles University, Prague, Roman Barták. I like this very much. It's also very useful of course!

Building Expert Systems in Prolog
A good old fashioned book in Prolog of 12 chapters ending with the Rubik's Cube solving expert system. The book is well organized, have many examples, and very useful.

You'll also find a lot of useful links in the Wikipedia page for Prolog, so really start there in any case. I included an extract from the comp.lang.prolog FAQ which is a list of places you can get a free Prolog:

ALF (Albgebraic Logic Functional language)
Platforms: UNIX
Available: Unknown
E-mail: Rudolf Opalla
Info: WAM-based language with narrowing/rewriting
Amzi! Prolog + Logic Server
Platforms: Window, Linux and Solaris
Available: http://www.amzi.com/download/
E-mail:
Info: Registration is compulsory, except for the Free Academic/Personal/Evaluation License.
Aquarius Prolog 1.0
Platforms: UNIX
Available: http://www.info.ucl.ac.be/people/PVR/aquarius.html
Info: High performance, commercial functionality except debugging and modules.
Argo Prolog v.1.1
Platforms: Solaris 1.x and HP-UX 9.x
Available: Unknown
Contact: Takao Doi
Arity/Prolog32
Platforms: Win32
Available: http://www.arity.com/www.pl/products/ap.htm
Info: Arity/Prolog32 provides a complete Prolog programming environment in which you can write, debug, and run Prolog programs in 32-bit Windows environments (95/98/NT/2000). Arity/Prolog32 is a powerful, highly optimized, and extended version of the logic programming language Prolog. Arity/Prolog32 is a complete compiler and interpreter written in Prolog, C, and Assembly language and is a superset of Clocksin and Mellish Prolog.
B-Prolog 4.0
Platforms: Win32, Solaris, SunOS, UNIX, FreeBSD and Linux
Available: http://www.probp.com/
E-mail: Neng-Fa Zhou
Info: Freely available for non-commercial use. For other use a license is needed.
BinProlog 7.0
Platforms: Windows 95/98/NT, Linux and all major Unix platforms.
Available: http://www.binnetcorp.com/BinProlog/
E-mail: Paul Tarau
Info: Download free evaluation copies and see online demos. Inexpensive Educational licensing available.Has built-in networking, multi-threading, mobile code and distributed blackboards. Supports BinNet Internet Programming Tool kit (see http://www.binnetcorp.com/Internet).
Brain Aid Prolog (BAP) v1.4
Platforms: Transputer systems
Available: http://www.comnets.rwth-aachen.de/~ost/private.html
Info: BAP is a parallel prolog system for Transputer systems. Available under a Berkely style of copyright.
C#Prolog
Platforms: Win32, UNIX
Available: http://sourceforge.net/projects/cs-prolog/
E-mail: John Pool
Info: A Prolog interpreter written in C#. Can easily be integrated in C# programs. Characteristics: reliable and quite fast beta version, command line interface, builtin DCG, XML-predicates, persistent predicates (using Firebird RDBMS), extendible.
Ciao 1.4
Platforms: Linux, Win32 (95/98/NT), Solaris, SunOS, UNIX in general.
Available: http://www.clip.dia.fi.upm.es/Software/Ciao
E-mail: Developers , Users
Info: Next generation LP/CLP system. Commercial functionality, but freely available w/source. ISO-Prolog + modules, networking, multi-threading, clp(r), clp(q), interfaces (Java, C, tcltk, WWW, databases/ODBC, ...), functions, higher-order, records, persistence, objects, assertions (types, modes, ...), source debugger, auto-documenter, static debugger, and more.
clp(FD)
Platforms: UNIX
Available: anonymous FTP from ftp://ftp.inria.fr/INRIA/Projects/ChLoE/LOGIC_PROGRAMMING/clp_fd
Contact: Daniel Diaz
Info: Constraint logic programming over finite domains. Requires GNU C v.2.4.5 or higher.
clp(FD,S)
Platforms: UNIX
Available: http://contraintes.inria.fr/~georget/software/clp_fds/clp_fds.html
Contact: Yan Georget
Info: Requires GNU C (gcc) version 2.4.5. or higher.
CLP(R)
Platforms: UNIX
Available: E-mail request from Joxan Jaffar .
Info: Constraint logic programming language, for academic and research purposes only.
ECLiPSe Constraint Logic Programming System, subsuming Prolog.
Platforms: Solaris, Linux, Linux/Alpha, Mac OS X, Windows
Available: http://www.eclipse-clp.org/ or http://www.sourceforge.net/projects/eclipse-clp
Info: ECLiPSe is a Prolog and Constraint Programming platform with a long history and has been open-sourced in Sept 2006.
License: MPL
IF Prolog V5.3
Platforms: Windows 95/98/NT/2000/XP, Linux, Solaris, AIX, HP-UX and other UNIX platforms
Available: http://www.ifcomputer.de/Products/Prolog/
E-mail:
Info: IF Prolog is a commercial Prolog system with interfaces to C/C++, Java, sockets, Windows events and a COM servers. A graphical debugger allows step-forward, step backward debugging of Prolog code. A static module concept allows many additional errors to be detected at compile time. Constraint Programming (for finite domains, intervals and booleans using global constraints and linear optimisation).
License: Free evaluation copies and inexpensive educational licensing available.
GNU Prolog
Platforms: Many Unixes, Windows, MacOS X
Available: http://gnu-prolog.inria.fr/
E-mail: Daniel Diaz
Jinni 2.27
Platforms: Java-based
Available: http://www.binnetcorp.com/Jinni
Info: Multi-threaded, Java based Prolog interpreter with built-in networking, distributed blackboards and mobile code (inexpensive shareware licensing available).
JIProlog
Platforms: Java-based
Available: http://www.ugosweb.com/jiprolog
Info: Java Internet Prolog is a cross-platform pure Java 100% prolog interpreter that supplies Java world with the power of prolog language and provides prolog language with a technology to implement new predicates in Java.
KLIC
Platforms: UNIX
Available: Anonymous FTP from ftp://ftp.icot.or.jp/ifs/symbolic-proc/unix/klic/klic.tgz.
Info: ICOT Free Software. Concurrent logic programming. Tested on Sparcs, DEC 7000, Gateway P5-60.
Contact:
LPA Win-Prolog, demo version
Platforms: Windows
Available: Available from http://www.lpa.co.uk/ind_dow.htm
MINERVA
Platforms: Java
Available: Available from http://www.ifcomputer.co.jp/MINERVA
Info: Proprietory commercial ISO-Prolog Compiler in 100% Java support for web programming, XML, servlets, applets, standalones. Free evaluation license.
Modular SB-Prolog (= SB-Prolog version 3.1 plus modules)
Platforms: SPARC, DECstation, MIPS, HP 9000 series, Sun 3.
Available: Anonymous FTP from ftp://ftp.dcs.ed.ac.uk/
Info: Copy-lefted.
Newt Prolog
Platforms: Apple MessagePad Newton
Available: Currently only beta version available; download and more information on http://www.cfht.hawaii.edu/~jlv
E-mail:
Open Prolog
Platforms: Apple Macintosh
Available: http://www.cs.tcd.ie/open-prolog/
E-mail: . (Michael Brady).
Poplog Prolog
Platforms: Various Unixes, including Sun, Dec Alpha, HP and many others. Also a Win32 version is available. Sources available for other combinations.
Available: At the Free Poplog Web/FTP site, including full sources http://www.cs.bham.ac.uk/research/poplog/freepoplog.html Mirror sites at http://www.poplog.org/resources/dist/new/
E-mail: queries may be posted to news://comp.lang.pop/, or to or (Last resort!)
Info: Robust incremental compiler, part of the multi-language Poplog system (including Common Lisp, Pop-11 and Standard ML). Unix, Linux & VMS versions include full support for X window facilities/Motif. More information at http://www.cs.bham.ac.uk/research/poplog/poplog.info.html Licence modelled on XFree86. Can be freely distributed, though copyright is owned by Sussex University and ISL.
PIE2
Platforms: Unknown
Available: On CompuServe in the AIEXPERT forum, interpreter and examples in PIE2.ZIP, documentation in PIEDOC.ZIP.
E-mail: Brent Ruggles
QuProlog
Platforms: UNIX, Linux, beta for MAC
Available: http://www.itee.uq.edu.au/~pjr/HomePages/QuPrologHome.html
E-mail:
Info: Extended WAM with support for quantifiers and substitutions, multi-threaded, high-level communication.
Strawberry Prolog
Platforms: Windows 95/NT, plans for UNIX and Macintosh
Available: http://www.dobrev.com/
E-mail:
SWI Prolog
Platforms: Binaries for Linux, Windows (NT/2000/XP/Vista) and Mac OS X (darwin). Sources: ANSI-C, both 32 and 64-bit machines, compiles on almost all Unix systems and more.
Available: http://www.swi-prolog.org, ftp://ftp.tu-darmstadt.de/pub/programming/languages/prolog/swi-prolog/
Info: Complete, ISO and Edinburgh standard, common optimizations, GC including atoms. Portable graphics, multiple threads, constraints, comprehensive libraries for (semantic) web programming, Unicode, source-level debugger, advanced syntax colouring
License: LGPL
Trinc-Prolog
Platforms: Windows 95/98/NT 4.0, plans for Windows 2000, Linux and Sun Solaris
Available: http://www.trinc-prolog.com/
E-mail:
UPMAIL Tricia Prolog
Platforms: Apple Macintosh
Available: Anonymous FTP from ftp://ftp.csd.uu.se/pub/Tricia; get README first.
Info: UPMAIL is still available, but unsupported.
Visual Prolog
Platforms: Win32
Available: http://www.visual-prolog.com
Info: Includes all the facilities necessary to write mission critical commercial-grade applications. Fully visual development environment. Open architecture. Object-oriented. Built-in database system and ODBC support. Visual Prolog Personal Edition is available on a freeware license.
wamcc
Platforms: UNIX
Available: Anonymous FTP from ftp://ftp.inria.fr/INRIA/Projects/ChLoE/LOGIC_PROGRAMMING/wamcc
Info: Compiler which translates Prolog to C via WAM. Debuggers. Requires GNU C v.2.4.5 or higher.
Contact: Daniel Diaz
XGP
Platforms: Apple Macintosh OS X, 10.2.3+
Available: http://xgp.sourceforge.net/
Info: XGP is an open source (GPL) integrated development environment with user interface and graphics support based on gprolog and Cocoa under Macintosh OS X.
XSB
Platforms: Many, including SunOS, Linux and Windows
Available: http://xsb.sourceforge.net/
E-mail:
Info: system with SLG-resolution, HiLog syntax, and unification factoring.
Yap 4.2.0
Platforms: UNIX-based platforms and Windows
Available: http://www.ncc.up.pt/~vsc/Yap/
E-mail: Vitor Santos Costa
Info: Yap is entirely written in C and Prolog and should be portable to most 32-bit and 64-bit Unix based platforms. A Windows port is also available. Yap4.2 is distributed under Perl's artistic license and can be freely distributed.

Wednesday, July 2, 2008

Get Started with LISP

Lisp (programming language) - Wikipedia, the free encyclopedia
This is a great place to start especially if you're new to lisp. It gives the necessary introduction about the language and a simple quick discussion of its features then it provides you with resources about the language where you can go if you need more information.

Practical Common Lisp
The most appreciated book on LISP. The book is published in HTML format and the site offers a download of the source code (not the book itself).

LISP 1.5 Programmers Manual [PDF]
The first version of LISP

InterLisp Reference Manual [PDF]
A manual for the Interlisp dialect

ANSI LISP Standard
The ANSI standard for the language (Common LISP)

Tutorials: