Lisp programming language | Project 1 | CS 1621, Study notes of Programming Languages

Project for CS 1621 - STRUCTURE PROGRAMMING LANGS at Pittsburgh (Pitt)

Typology: Study notes

2019/2020

Uploaded on 06/18/2020

eknathia
eknathia 🇺🇸

4.4

(26)

264 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 1 621 Structu re s of P ro gramming La ngua ge s
Pr oj ect 1
Ryan Dunseath and J im G re en
Se ptember 15, 2 00 3
Lisp programmin g la ng ua ge i s ve ry versatile, yet q ui te
si mplistic. It i s ba se d on a list-based s ty le d at a an d an interprete r
wh ic h understands s om e of said lists as prog ra ms . T he se programs
are the basis of AI a nd a v ar iety of other p ro je ct s, s uc h as,pattern
re co gnition, unde rs ta nd in g te xt ual natural l an gu ag e, s po ken
la ngua ge, compu te r vi si on , me di ca l diagnosis, au to ma ti c
programming, prog ra m ve ri fi ca ti on proof system s, a nd r ob ot control
syst ems(Brook s vi i) . N ow a v ery powerfu l pr og ra mm in g la nguage,
it b egan as a cha ot ic c om pi la ti on of dialects, but u ni fi ed i n 1981by
th e Common Lisp C om mi tt ee . T hey were form ed d ue t o two ke y
elements in the L is p co mm un it y: Inconsistenc ie s an d il lo gi cal
co nventions f ro m ea rl y ve rs io ns” andthe ex is te nc e of a complete
sp ecification of th e la ng ua ge a nd a published ma nu al e ns ures that
programs will b e tr an sp or ta bl e. Programs wr it te n in C om mon Lisp
and debugged on o ne m an uf acture’s mach in e sh ou ld r un on another
manufacture’s m ac hi ne w it ho ut change.” Th is r ou gh ly b ri ng s us to
present day Lisp.
pf3
pf4
pf5

Partial preview of the text

Download Lisp programming language | Project 1 | CS 1621 and more Study notes Programming Languages in PDF only on Docsity!

CS 1621 – Structures of Programming Languages Project 1 Ryan Dunseath and Jim GreenSeptember 15, 2003

Lisp programming language is very versatile, yet quite simplistic. It is based on a list-based style data and an interpreter which understands some of said lists as programs. These programs are the basis of AI and a variety of other projects, such as, “pattern recognition, understanding textual natural language, spoken language, computer vision, medical diagnosis, automatic programming, program verification proof systems, and robot control systems” (Brooks vii). Now a very powerful programming language, it began as a chaotic compilation of dialects, but unified in 1981by the Common Lisp Committee. They were formed due to two key elements in the Lisp community: “Inconsistencies and illogical conventions from early versions” and “the existence of a complete specification of the language and a published manual ensures that programs will be transportable. Programs written in Common Lisp and debugged on one manufacture’s machine should run on another manufacture’s machine without change.” This roughly brings us to present day Lisp.

Back in 1959, Lisp began as Lisp 1.5. It was used mostly for solving symbolic algebra problems, such as finding the derivative of a function. Soon dialects of Lisp began springing up all over the place. First, there was BBN-Lisp, which was followed by Interlisp. MIT made up its own version of Lisp, which became known as Maclisp; Stanford then took Maclisp and made Lisp 1.6. Another separation occurred from 1.6 at the University of California at Irvine and at the University of Utah: UCI-Lisp and Standard Lisp respectively. However, MIT continued its development of Maclisp and came up with Lisp Machine Lisp from which, Nil, yet another dialect, is based. Franz Lisp was developed at Berkley around the same time. The Common Lisp committee is formed and the Common Lisp language is born. The Lisp programming language consists of two types of elements: atoms and lists. Atoms are form identifiers or numerical literals. Atoms are indivisible units, like the numbers 2 and 3 or the letter x. Symbols are also atoms. A symbol generally is any string of characters that exclude white space and parentheses, and includes characters that make it invalid as a number. These symbols take the place of variables and reserved words (like cout in C++). Lists are a series of symbols and/or atoms enclosed in brackets, i.e. (3 4 6 9 10). Nested lists are similar to a nested for loop in C++, i.e. (3 4 (6 9) 10) where (6 9) is a list inside the original

manipulated. Sebesta used an example where he wanted to get the sum of a list, which cannot be done using the ‘+’ symbol for the ‘+’ accepts only atoms and not lists made of atomic elements. He then shows how to read the list and calculate the sum using the atomic list. It is an interesting concept and which may have many applications. Though powerful and unique, Lisp is not good for everything. For instance, Lisp has no variables. Though Lisp is capable of doing many complicated symbolic calculations, it cannot perform any sort of iteration; all forms of loops must be done recursively. Programmers familiar with the idea of recursion know that it is not always the easiest way for a job to be done. Recursion is often slow, confusing, and often leads to a lot of trouble maintaining code. Some might say it is not hard to update a few unfamiliar recursive functions. However, imagine doing hundreds or even thousands of recursive functions that are the basis of a company’s AI project. Ideally, many of the functions would be much simpler with iteration but since Lisp does not support this, programmers are just out of luck if forced to use Lisp. Lisp is a functional programming language used primarily for programming AI and solving many varieties of symbol-based problems. It uses lists and atoms to create programs and a program written in list is in the same format as the data it manipulates, this

format is known as an S-expression. Lisp has many interesting properties such as dynamic scope and on the fly interpretation, but also has its own downfalls, such as the problem with iteration, despite this Lisp is still the one of the oldest programming languages in use today