lispwa1 - and (PLUS -2 (MINUS 2) (TIMES X (POWER Y 3.3)))...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2011 LISP Written Assignment #1 CMSC 420 Hanan Samet In order to do the following exercises assume: The expression x + y is represented as (PLUS x y) . The expression xy + x + 3 is represented as (PLUS (TIMES x y) x 3) The list ((A B) (B A C D) (C B D E) (D B C E) (E C D F) (F E)) is used to rep- resent the following graph according to a scheme whereby there is a sublist for each vertex consisting of the vertex itself followed by the vertices to which it is connected. A C F E B D 1. If we represent sums and products as indicated above and use (MINUS X) , (QUOTIENT X Y) , and (POWER X Y) as representations of - x , x / y , and x y respectively, then (a) What do the lists (QUOTIENT 2 (POWER (PLUS X (MINUS Y)) 3))
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and (PLUS -2 (MINUS 2) (TIMES X (POWER Y 3.3))) represent? (b) How are the expressions xyz + 3 ( u + v )-3 and ( xy-yx ) / ( xy + yx ) to be represented? 2. In the above mentioned graph notation, what graph is represented by the list ((A D E F) (B D E F) (C D E F) (D A B C) (E A B C) (F A B C)) ? 3. Write the list (PLUS (TIMES X Y) X 3) as an s-expression. This is sometimes referred to as dot-notation. 4. Write the following s-expressions in list notation to whatever extent is possible: (a) (A . NIL) (b) (A . B) (c) ((A . NIL) . B) (d) ((A . B) . ((C . D) . NIL)) 1...
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 420 taught by Professor Staff during the Fall '08 term at Maryland.

Ask a homework question - tutors are online