S-expression

An S-expression is a convention for representing data or an expression in a computer program in a text form. S-expressions are used in the Lisp programming language and Lisp-derived languages such as Scheme. The details of the syntax and supported data types vary in the different languages, but the most common feature is the extensive use of prefix notation with explicit use of brackets.

S-expressions are used for both code and data in Lisp. S-expressions were originally intended only as machine representations of human-readable M-expressions, but Lisp programmers soon started using S-expressions as the default notation.

S-expressions can either be single objects such as numbers, Lisp atoms including the special atoms nil and t, or cons pairs, written as (x . y). Longer lists are made up of nested cons pairs, for example (1 . (2 . (3 . nil))) which can also be written as the easier to read and write (1 2 3).

Program code can be written in S-expressions, using prefix notation. An extra piece of syntactic sugar for writing Lisp programs is that the common expression (quote x) can be written with the abbreviation 'x.

Example:

(defun factorial (x)
   (cond 
      ((eq x 1)  1)
      (t (* x (factorial (- x 1))))))

See also: car, cdr, cons


In the News

Video: Hands-On With the Slick-Sliding PSPgo
There are some major differences between the PSPgo and the previous PSP 3000. Let Wired's video show you what those differences are and if Sony's latest portable is worth your ducats.


Beowulfand Angelina Jolie Give 3-D a Second Chance in Hollywo
Once a nausea-inducing fad, 3-D is staging a comeback -- more than 50 years after its first run. When Beowulfcomes out in November, it will premiere on nearly 1,000 3-D screens -- the most ever.

Dark side of a Saturnian moon: Iapetus is coated with foreign dust
Iapetus is often called Saturn's most bizarre moon, due to its starkly contrasting hemispheres -- one black as coal, the other white as snow. Images taken by the Cassini-Huygens spacecraft, orbiting Saturn since 2004, offer the most compelling evidence to date of why and how the moon got its yin-yang appearance, as well as clues to how other such satellites might have formed in the early universe.

Curious Female Rats Survive Tumors Longer
Curious female rats, more willing to step out and explore their environment, survive breast and pituitary tumors longer than their more cautious sisters, says a Penn State researcher.

Public Libraries Affected by Hurricanes Katrina and Rita
"This map presents information on the libraries that were substantially damaged by hurricanes Katrina and Rita. Libraries with minor damage are not included."Click on markers to learn library system, library name, and amount of damage. From the Normative Data Project.

Apple Bought iSlate.com — Perhaps for a Tablet?
Clever sleuths wonder if iSlate.com, the domain Apple purchased two years ago, might indicate a name for an Apple tablet.


'Clean' Vehicle Research Initiative On Track, But Many Challenges Ahea
A public-private effort to develop more fuel-efficient automobiles and eventually introduce hydrogen as a transportation fuel is well-planned and identifies all major hurdles the program will face, says a new report from the National Academies' National Research Council.

Obese Mice Are More Susceptible To Liver Abnormalities
Mice that were fed diets high in fat and sugar developed immune system abnormalities in their livers, including reduced numbers of natural killer T (NKT) cells. These diet-related changes may contribute to obesity-related liver disease, according to a new study.

As Ash Borer Claims More Trees, Researcher Works For Species Survival
Estimates say more than 70 million ash trees have been destroyed nationally by the emerald ash borer insect. An Iowa researcher is racing the clock to collect seeds from different ash species including green, white, blue and black ash, and many variations within each species before they are killed by the pest. He thinks he may be about 10 percent there.

Better Freshwater Forecasts To Aid Drought-plagued West
Western droughts wreak social, economic and environmental havoc. Yet the ability to predict drought at seasonal lead times -- months or longer -- has scarcely improved since the 1960s. Computer simulations aim to improve freshwater forecasts.




MP3 Music Downloads

Preview songs, Download Free Music,Burn CDs at ITunes.com
iTunes_RGB_9mm

 


Google




InformationQuickFind.com - Find Information Fast

Links | Privacy Policy | News |