5.5. LISTS AND QUASI QUOTED LISTS
71
'(+ 1 2 3)
evaluates to the list (+ 1 2 3).
Exercise 17 Create the following servlet
; thisisalist.servlet
'(string append "this" "is" "a" "list")
and see what happens when you visit this servlet with and without the initial
single quote ('). Try other S expressions with and without quotes. In fact, you
can put a quote in front of any of the previous servlets you've created and see
what happens. Try to write a simple explanation for what is going on.
Scheme lists can contain sublists and this is a convenient way of representing
a table of data, e.g.
'(
(name age sex)
(john 22
male)
(jiri 20
male)
(anzy 18
female)
(miri 17
female)
)
To make this into a table we use the  trs  procedure defined in the  tables.scm 
library. This procedure takes a list of lists (one for each row) and creates a  tr 
element for each of these lists.
5.5
Lists and Quasi quoted lists
You can also create lists using the list procedure, e.g.
(list
(list {Hello there} (+ 1 2 3 4 5))
(list {Goodbye} (* 1 2 3 4 5)))
Note that this expression evaluates to
'(("Hello there" 15) ("Goodbye" 120))
You can also have the same effect using a back quote  `  instead of a single
quote ('), and then putting a comma (,) in front of those expression you want
to be evaluated. This is called quasi quote notation. In our case, we could write
the previous example as:
`(("Hello there"
,(+ 1 2 3 4 5))
("Goodbye"
,(* 1 2 3 4 5)))




  

Home

About Services Network Support FAQ Order Contact
 

Tomcat Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved