Talk:S-expression/Archive 1

Latest comment: 16 years ago by Lee-0 in topic What are ...?
Archive 1


Explain

Could somebody add an example please? --HJH —Preceding unsigned comment added by Hirzel (talkcontribs) 17:20, 31 October 2002

What does the S stand for? —Preceding unsigned comment added by Hirzel (talkcontribs) 19:37, 20 January 2003

What's this got do with SGML/XML? —Preceding unsigned comment added by 137.111.13.32 (talkcontribs) 04:50, 8 November 2002

Like XML, this is a format for data storage. Among those who know about it it's generally considered to be much better (many claim that it's easier to write your own s-expression parser than learn to use a pre-made XML parser). It is unfortunate that crappy standards win over nice technologies. -- Lament —The preceding comment was added on 02:38, 31 January 2003.


I totally agree... with all of it... What does the S stand for? and an example or 2 would have been useful... —Preceding unsigned comment added by 80.212.137.175 (talkcontribs) 16:45, 30 October 2003

The link to "Recursive Functions of Symbolic Expressions" is broken.

--Furrykef 07:17, 6 Apr 2004 (UTC)

S: symbolic

S stands for "symbolic" in S-expressions. A more detailed treatment is there at: http://theory.lcs.mit.edu/~rivest/sexp.html

The new pov/or/vanity section

"Readability as a programming notation". There are so many things wrong with it, I don't know where to begin.

"However, many find raw S-expressions difficult to read."

Citation needed as they say... I say most people can read properly indended sexps with little guidance. Which can't be said about syntax-heavy languages like C++ or Ruby.

"Even Paul Graham, an advocate of Lisp, admits that he finds the lack of built-in infix notation to be a significant drawback."

Who cares whether it's built in or not. There are so many infix libraries floating around.

"In addition, typical programs written with S-expressions include many more parentheses than their equivalents in other notations, which most developers find much more difficult to read."

Yes, the other notations also have curly braces, semi-colons and other symbol-soup to add to the count. Which makes them easier to read, I guess...

"Nearly all languages developed after Scheme do not use S-expressions as a surface notation."

Ever heard of Common Lisp?

"In 2006, David A. Wheeler described sweet-expressions"

Now we get to the whole point of this section: self-promotion. Well, unfortunately for Mr. Wheeler, it isn't a new idea (it gets reinvented every 2 years or so), it isn't a good idea (see comp.lang.lisp threads on the topic) and, basically no one uses it. One has to wonder why people didn't switch to this obviously superior notation. Perhaps it isn't so superior after all...  Grue  10:13, 18 January 2007 (UTC)

The explanation for S-Expressions mostly misses the point

S-Expressions stand for Symbolic-Expressions. It means we are talking about Expressions with Symbols. Which is related to 'Symbolic Computation', that is computation with Symbols. Symbolic Computation is for example used in Computer Algebra Systems, Natural Language Systems, Knowledge Representation and more. Symbols often map to 'concepts'.

Typical symbols are:

  • name, Name, NAME
  • |This is a symbol|

Then we have lists

  • (heinz klaus dieter)
  • (|Susanne Klickerklacker| |Sabine Mustermann|)
  • (persons ((firstname susanne lastname klickerklacker) (firstname sabine lastname mustermann)))

Common Lisp also defines keyword symbols (:foo) and symbols are organized in packages: (person:klaus person:dieter). Common Lisp also defines a notation to represent circular data structures.

Many other data types (in Common Lisp) have a defined external representation that can be used in S-expressions: numbers, strings, arrays, structures, characters, ...

For example we could use the following S-Expression to describe an application window:

(application :title "Editor" :class editor :default-position #(30 50) :default-size #(200 200) :select-character #\e)

Or we have an Integral:

  • (integral (expt (/ (sin x) (cos x)) 2) d x)

Or we have an initial state in the blocks world:

  • ((ON C A) (CLEAR B) (CLEAR C) (HANDEMPTY T) (ONTABLE A) (ONTABLE B) (HOLDING NIL))

The Lisp function to read S-Expressions and convert them into internal data-structures is called READ. There are also basic Lisp functions to print and pretty-print S-Expressions.

In Lisp programs are also written as S-Expressions. S-Expressions is used for the external notation. Again READ is used to read a program written as S-Expression. EVAL evaluates this program and PRINT prints the result of the program. This runs in a loop. The so-called READ-EVAL-PRINT-LOOP, or short REPL.

To sum it up

  • S-Expressions are a notation for data.
  • S-Expressions are used for Symbolic Computation
  • Lisp provides functions to read and write S-Expressions.
  • Lisp can evaluate S-expressions that are read and can print the result in a S-Expression form. —Preceding unsigned comment added by 85.176.10.25 (talk) 20:08, 30 September 2007 (UTC)

Should be this added?

S-expressions used also in some configuration files in text form. For example, in Oracle network services: [1] --Yonkie (talk) 18:11, 16 June 2008 (UTC)

What are ...?

Hmm, ok, so what are symbolic expressions? A way of saying (something) using ((something)) that is not what (something) is said about but (((something))) representing it? Or: What is _not_ a symbolic expression? --Lee-0 (talk) 17:49, 13 July 2008 (UTC)


Archive 1