allegro cl certification program
play

Allegro CL Certification Program Lisp Programming Series Level I - PowerPoint PPT Presentation

Allegro CL Certification Program Lisp Programming Series Level I Session 1.3.5 Homework 7/11/2003 1 Question What is the difference between the following expressions (and what will the interpreter do)? A 'A " A"


  1. Allegro CL Certification Program Lisp Programming Series Level I Session 1.3.5 Homework 7/11/2003 1

  2. Question • What is the difference between the following expressions (and what will the interpreter do)? – A – 'A – " A" – #\A 7/11/2003 2

  3. List Anatomy • Draw the following lists as "box and pointer" diagrams of cons cells – (rose marigold petunia) – ((rose 1) (marigold 7) (petunia 12)) – ((nitrogen . 10) (potassium . 5) (phosphorus . 5)) Note: last bullet has dotted lists (not decimals) 7/11/2003 3

  4. Strings • Write a function that finds an HTML tag: – (find-tag "<b>Test.</b>") => "b" • Write a version that finds multiple tags: – (find-tag "<b>Test.</b><i>Test.</i>") =>("b" "i") • Write a function that finds the contents of an HTML tag. Pass the tag of interest as an argument. – (get-tag-contents "b" "<b>Test.</b>") => "Test." 7/11/2003 4

  5. Arrays • Write a function that takes a vector of numbers and doubles them “in place” – (setq a (vector 123)) – (double a) – a => #(2 4 6) 7/11/2003 5

  6. Symbols • Write a function that takes a string as input and returns all the words in the string as symbols • Use your function to read a file and return a count of the occurrence of each word in the form of an association list • Sort the association list in descending order of most common to least common words 7/11/2003 6

  7. Files • Write a function that takes this list as input: (html (body (h1 "Lisp") "Hello from lisp")) • And produce a text file containing: <html> <body> <h1>Lisp<h1> Hello from lisp </body> </html> 7/11/2003 7

Recommend


More recommend