Thursday, July 27, 2006

Getting Lispy

More Lisp
We have the basic arithmetic available in Lisp.
cos, expt, log etc we have.
We always need random numbers in AI, so
(random limit [random-state])

You of course need logic

/= is not equals

(and ...) (or ...)

cond is for conditionals.
(cond (test_1 exp_11 ... exp_1k)
(test_2 exp_21 ... exp_2k)
...
)
There is no 'else' statement. Just use t for true as a final test.

There really is way too much in common lisp...

Function values
Non-destructive

Scope
Recursion
Procedural languages will allow recursion, so who cares?
Procedural languages have it as an add-on, whereas functional languages have it as a fundamental.

(mapcar #'* a b)
A convenience function to apply the multiplication to each item in the list.

Procedural Programming is the Von Nuemann architecture. Fetch, execute, store.
Side effect programming
Not compositional, but repetitive.
Requires lots of housekeeping (i, count, etc)

Functional programming is the opposite of all this.
But then when you actually get into it, "Pure lisp is often buried in large extensions buried in Von Nuemann style stuff". Or something like that, in 1978.

The first example of recursion still relied on side effects.

0 Comments:

Post a Comment

<< Home