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

[Ironic] LONDON: A jailed cocaine dealer is working as Santa Claus on
John Tams, who dons beard, boots and red suit to work in a cafe's Christmas grotto, said he wanted to give something back to the community...

[Odd] A Romanian couple has named their son Yahoo as a sign of gratitu
Daily Libertatea said on Thursday Cornelia and Nonu Dragoman, both from Transylvania, met and decided they were meant for each other following a three-month relationship over the net.They married and had a baby this Christmas, whom they decided to name after one of the worldwide web's most popular portals."We named him Lucian Yahoo after my father and the net, the main beacon of my life,"Cornelia Dragoman was quoted as saying.

Women of Protest: Photographs From the Records of the National Woman's
"This online presentation is a selection of 448 photographs from the approximately 2,650 photographs in the Records of the National Woman's Party collection, housed in the Manuscript Division of the Library of Congress."The photographs, which represent "the militant wing of the suffrage movement,"are from 1875 to 1938 (mostly from 1913-1922). Includes essays and a timeline (1912-1997). From the American Memory Project of the Library of Congress.

Researchers Develop Assay That Could Be Applied To Drug Screening
Using state of the art imaging technology a team from Yale School of Medicine has glimpsed one of the cell's most important 'nano-machines' in action.

New Research Strives To Understand How Antidepressants May Be Associat
The National Institute of Mental Health, part of the National Institutes of Health, is funding five new research projects that will shed light on antidepressant medications, notably selective serotonin reuptake inhibitors (SSRIs), and their association with suicidal thoughts and actions (suicidality).

Microorganisms cited as missing factor in climate change equation
Those seeking to understand and predict climate change can now use an additional tool to calculate carbon dioxide exchanges on land, according to a new article.

Consequences of a Rising Bay/Global Warming: New Set of Maps Reveals H
These February 2007 maps, "which the Bay Conservation and Development Commission prepared for The Chronicle, offer a detailed look at how a changing shoreline would affect life around the [San Francisco] bay."Includes a map showing current shoreline and potential shoreline if bay rises one meter, and detailed maps for specific areas, such as Oakland Airport and the South Bay. Also includes link to related article. From SFGate.com, website for the San Francisco Chronicle.

Washington State University Tree Fruit Research and Extension Center:
Materials about the proper care and handling of tree fuit by producers after harvesting, for these Washington state crops: apples, pears, cherries, and stone fruit. Find articles on diseases and disorders, improving quality and flavor, marketing, packaging, storage, and shipping for specific varieties such as Gala and Fuji apples, Anjou and Bosc pears, and Rainier and Lambert cherries. Also includes general material about postharvest practices such as use of chemicals.

Strategies For Closing The 'Performance Gap' In Science And Mathematic
A new report from AAAS, the world's largest general science society, explains how ten K-12 school districts, serving some of the nation's poorest inner-city regions, are improving performance and closing the gap between minority and non-minority students in science and mathematics.

UK Scientists Get A "Whiff"Of Titan's Surface
Further insights into Titan were unveiled as scientists involved in the joint NASA/ESA/ASI Cassini-Huygens mission presented further results and images a week to the day after the successful descent and arrival of the Huygens probe on the surface of Saturn's largest moon.




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 |