What is dicey about code and data having the same representation? You use the word 'syntax' rather than representation but s-expressions is not a syntax per se.
defun function-name argument-list declarations/documentation forms
Above is syntax.
An example of a function using a lot of syntax:
(defun foo (n &optional (a 10 a-p))
"This is the function FOO"
(declare (type (integer 0 *) n a))
(declare (ignore a a-p))
(loop for i from 0 below n by 10
sum i into s1
sum (expt i 2) into s2
finally (return (/ s1 s2))))
Lisp has complex argument lists with required, keyword and optional arguments.
It has syntax for a bunch of declarations.
It has macros like the LOOP macro which implement a lot of syntax. Actually the syntax of LOOP is quite long.
Well... But to be fair, LOOP is something of an oddity within Lisp... The Marmite (or Vegemite) of Lisp, due to exactly that: introducing a COBOL-like language for iterating.
PS: I like all your coments on Lisp, Rainer. Very informative.
(LOOP FOR X FROM M TO N DO (PRINT X) WHILE (PRIMEP X))
Warren's greater idea was to have a very forgiving syntax for Lisp, with spell checker and DWIM (do what I mean) support. Write expressions in different order, with spelling errors, etc. Lisp will figure out what you mean.
DEFINEQ((UNION (LAMBDA (X Y)
(IF ~X THEN Y
ELSEIF X:1 MEMBER Y THEN UNION X::1 Y
ELSE <X:1 !(UNION X::1 Y)>]
In MLISP:
EXPR UNION (X,Y)
IF ¬X THEN Y ELSE
IF X[1] ε Y THEN UNION(X↓1,Y)
ELSE X[1] CONS UNION(X↓1,Y);
In CGOL (Algol syntax on top of Lisp)
define x "UNION" y, 14, 13;
if not x then y
else if member(car x, y) then cdr x union y
else car x . cdr x union y <>
or CGOL with extended character sets:
define x "∪" y, 14, 13;
if ¬x then y else if αx ε y then βx ∪ y else αx . βx ∪ y <>
'Conversational' syntax elements were for example often used in some AI systems as user interfaces into knowledge based systems. Rules were often written in similar expressions, example from KEE:
(IF (THE SWITCH OF LIGHT IS ON)
(THE LOOK OF LAMP IS NO.LIGHT)
THEN (DELETE (THE STATUS OF LAMP IS WORKING))
(THE STATUS OF ROOM IS DARK))
Though I'd think the main purpose of LOOP is to have an example that Lisp can incorporate a wider range of embedded syntax variants and to make the language purists run away...
Does that make more sense to you?
What is dicey about code and data having the same representation? You use the word 'syntax' rather than representation but s-expressions is not a syntax per se.