0218_note - 2/18 2010 S-expressions All lisp expressions...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
2/18 2010 S-expressions All lisp expressions are S-expressions are of two kinds 1 atoms (e.g numbers, symbols) 2. non-empty lists(e.g, (CAT DOG(27 CAT))is a list of 3 elements) S-expressions are used (a) as Lisp code – as expressions to be evaluated by Lisp. Ex: (Sqrt(+ (* 3 2 ) (- 4 1))) S-expressions that are meant to be evaluated by Lisp are called forms . Every form is an S-expression But most S-expressions cannot be forms. Ex: (cat dog (27 cat)) is a list that cannot be a form However, (cat dog (cat 27)) is a possible form. It could be the Lisp version of a Java expression cat(dog, cat(27)) (b) as Lisp data The value of any Lisp variable or, more generally, any Lisp form, is always an S- expression. Atoms: (i) numeric atoms(or numbers) There are 4 kinds of numbers: 1 integers (e.g. 34567) 2 ratios (e.g. 31/5) In fact, integers are just ratios that have 1 as their denominator) 3 floating-point numbers (e.g. -2.17) computation subject to rounding error…. 4 complex numbers (e.g. #C(3.1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/05/2010 for the course COMPUTER S 700 taught by Professor Joewhite during the Spring '10 term at Universidad San Martín de Porres.

Page1 / 3

0218_note - 2/18 2010 S-expressions All lisp expressions...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online