lisp 1.5 - running history
Post on 18-Jul-2015
124 Views
Preview:
TRANSCRIPT
(Lisp 1.5)
source: http://homepage.cs.uiowa.edu/~jones/cards/
---[ Norman Richards ]---
Introducing LISP
search[x; p; f ; u] = [null[x] ! u; p[x] ! f [x]; T ! search[cdr[x]; p; f ; u] maplist[x; f] = [null[x] ! NIL; T ! cons[f[x]; maplist[cdr[x]; f]]]
LISP features• Computing with symbolic expressions
• Familiar FORTRAN-like syntax!
• Conditional expressions
• Recursion
• Garbage collection
• An interpreter
But ...
• LISP meta-language input is not yet available
• Need to hand translate MEXPR into SEXPR for code entry
Things I learned about early LISP• S-Expressions were not intended for coding
• CAR/CDR represents parts of a word - there's no "decrement register"
• LISP wasn't about lambda calculus - it just needed a function notation
• Early LISP has dynamic scope (FUNARG problem)
• No macros - just FEXPRS
• Functional / pseudo-functional distinction, higher order functions
• Debugging through TRACE, COUNT, PRINT
• Apply was the "universal function" of the interpreter function eval
The Big 5 to implement eval• ATOM - predicate is the argument an atom?
• EQ - are two atoms the same?
• CONS - construct a list with a given head/tail
• CAR - return the head of a list
• CDR - return the tail of a list
Running LISP 1.5 Today• SIMH - a highly portable, multi-system simulator
• http://simh.trailing-edge.com/
• I'm using macports SIMH for this demo
• LISP 1.5 system- for IBM 7094
• http://www.sonoma.edu/users/l/luvisi/lisp/lisp15.tar.gz
Running SIMH
simh-i7094 lisptape.ini program.txt
LISP system configuration
LISP input in overlord format
sys.log
Output "tape"
LISP input TEST FACTORIAL
DEFINE (( (FACTORIAL (LAMBDA (X) (COND ((EQUAL X 0) 1) (T (TIMES X (FACTORIAL (SUB1 X))))))) ))
FACTORIAL (5)
STOP FIN
Explaining the input• TEST/FIN are overlord controls
• STOP indicates the end of LISP commands
• LISP commands are a function and a list of arguments
• In Clojure, roughly: #(apply %1 %2)
• Translated to BCD and
LISP Output
TEST FACTORIAL
THE TIME ( 0/ 0 000.0) HAS COME, THE WALRUS SAID, TO TALK OF MANY THI NGS ..... -LEWIS CARROLL- EVALQUOTE OPERATOR AS OF 1 MARCH 1961. INPUT LISTS NOW BEING READ.
THE TIME ( 0/ 0 000.0) HAS COME, THE WALRUS SAID, TO TALK OF MANY THI NGS ..... -LEWIS CARROLL- FUNCTION EVALQUOTE HAS BEEN ENTERED, ARGUMENTS.. DEFINE
(((FACTORIAL (LAMBDA (X) (COND ((EQUAL X 0) 1) (T (TIMES X (FACTORIAL ( SUB1 X)))))))))
END OF EVALQUOTE, VALUE IS .. *TRUE*
FUNCTION EVALQUOTE HAS BEEN ENTERED, ARGUMENTS.. FACTORIAL
(5)
END OF EVALQUOTE, VALUE IS .. 120
THE TIME ( 0/ 0 000.0) HAS COME, THE WALRUS SAID, TO TALK OF MANY THI NGS ..... -LEWIS CARROLL- END OF EVALQUOTE OPERATOR FIN
References• Recursive Functions of Symbolic Expressions and Their
Computation by Machine, Part I
• http://www-formal.stanford.edu/jmc/recursive.pdf
• LISP 1.5 Programmer's Manual
• http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
• History of Lisp
• http://www-formal.stanford.edu/jmc/history/lisp/lisp.html
top related