Setting up Programming Environment

Introduction

If you have trouble with getting Lisp or Prolog running, please contact me (via email) ASAP! Getting into programming in these languages should have as few barriers as possible. Setting up your programming environment should not be a struggle.

Contact info

Name: Chris Millward
Email: cmillward at ucf dot edu
Office: ENG3 303
Office hours: Tues. and Thurs. 10am-11am

If you cannot come during office hours, email me and we can set up a meeting.

Lisp

I recommend that you use a Common Lisp environment for programming for this class. There are many choices, and it is a standard that is used in many areas. Also, I am most familiar with it, so I will be able to help you with this if you are having trouble. You have a few choices:

Special Note

If you are attempting to run simple examples in the Lisp interpreter, such as (setq d '(1 2 3)) you might recieve a warning such-as

 ; in: LAMBDA NIL
 ;     (SETQ D '(1 2 3))
 ;
 ; caught WARNING:
 ;   undefined variable: D

 ;
 ; caught WARNING:
 ;   This variable is undefined:
 ;     D
 ;
 ; compilation unit finished
 ;   caught 2 WARNING conditions

In order to not get these warnings, you should just declare the variables before you use them. So, to define D to be a variable, enter (defvar d). D is now a global variable that you can assign at will.

Local Common Lisp setup

I recommend using Lispworks. They offer a free personal version for all operating systems. It is very easy to install, and gives you a powerful environment. Both it and Allegro CL offer free trial versions that include a whole delevoping environment.

Distributions

Commercial (with free trial)
Open Source

Using SBCL on Olympus

  1. Connect to Olympus
  2. At the prompt, the lisp environment can be accessed by entering sbcl
  3. This will put you into the command line interpreter. You can now load outside files, or define/call functions within the interpreter.

Notes on SBCL in Olympus

If [BACKSPACE] is causing \^H to be inserted into the string, then hitting CTRL-H should act as backspace within the interpreter.

Loading outside files

To load a file named test.l that you have written at command line type (load 'test.l)

Prolog

As with Lisp you have the option of either using the software provided on the olympus server, or installing a local version on your own machine.

Local Prolog setup

There are many different Prolog implementations, but the one we will recommend for this course is SWI-Prolog.
It is cross-platform and includes a complete environment (including an integrated editor).

  1. Download SWI-Prolog for your appropriate machine.
  2. Follow installation instructions.

Using GNU Prolog on Olympus

Using the Prolog environment provided on Olympus is another good option.

  1. Connect to Olympus using your SSH program.
  2. To start a fresh Prolog session type gprolog. This will bring you into the Prolog shell.

Defining functions in the interpreter

The prompt for calling predicates in Prolog looks like | ?-
To define a new predicate, say mother(X,Y)

  1. at prompt enter: [user].
  2. you are now able to define predicates, so enter:

    mother(martha,george).
    mother(linda,paul).
    mother(gracie,lacy).

  3. When you are done defining predicates, and want to be able to query them, simply press CTL-D to return you to the prompt.

Loading files into the interpreter

If you want to develop your Prolog programs in a text editor, and then load them into the interpreter, so that you have a copy of them (recommended) - then follow below.

Connecting to Olympus

To connect to Olympus you will need a ssh client.

The address is olympus.acs.ucf.edu, and you must use the username and password provided to you by the department. If you have troubles with this please contact the Computer Help Desk by email or phone (407) 823-5117.