Re: Xah on Lisp

This is a discussion on Re: Xah on Lisp within the Functional forums in Programming Languages category; The following are some additions to the my lisp criticism essay, that are added as a result of this debate. ---------------------------------- Q: You say that lisp syntax irregularities “reduce such syntax's power”. What you mean by “syntax's power”? Here's some concrete examples of what i mean by power of syntax. In lisp, the comment is done by the char “;” running to endof line. Note that this does not allow nested comment. So for example, if you have multi-line code, and you want to comment out them all, you have to prepend each line by a semicolon. However, if you ...

Go Back   Application Development Forum > Programming Languages > Functional

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-22-2008, 04:11 PM
xahlee@gmail.com
Guest
 
Default Re: Xah on Lisp

The following are some additions to the my lisp criticism essay, that
are added as a result of this debate.

----------------------------------
Q: You say that lisp syntax irregularities “reduce such syntax's
power”. What you mean by “syntax's power”?

Here's some concrete examples of what i mean by power of syntax.

In lisp, the comment is done by the char “;” running to endof line.
Note that this does not allow nested comment. So for example, if you
have multi-line code, and you want to comment out them all, you have
to prepend each line by a semicolon. However, if you have nested
comment syntax, one could just braket the block of code to comment it
out. This, is a simple, perhaps trivial, example of “power of a
syntax”.

In Python, the formatting is part of the lang's syntax. Many
programers may not like it, but it is well accepted that due to
Python's syntax, python code is very easy to read, and it much done
away about programer preferences and argument about code formatting.
This is example of power of a syntax.

Let me give another, different example. You know that perl's syntax,
often the function's arguments do not necessarily need to have a paren
around it. For example, “print (3);” and “print 3;” are the same
thing. This is a example of power of syntax, when considered as a
flexibity or save of typing, for good or bad. Similarly, in javascript
for example, ending semicolon is optional. (for sample perl and python
code, see Xah's Perl and Python Tutorial)

In Mathematica, the language has a systax syntem such that you can
have fully uniform nested notation, or you have have a uniform postfix
notation, and prefix notation, as well as infix notation, for ANY
function in the language, and you can mix all of the above. This is a
example of power of syntax.

(for detailed explanation of Mathematica syntax and comparison to
lisp's, see: The Concepts and Confusions of Prefix, Infix, Postfix and
Fully Functional Notations )

In general, a computer lang has a syntax. The syntax, as text written
from left to right, has various properties and characteristics. Ease
of input (think of APL as counter example), succinctness (e.g. Perl,
APL), variability (Perl, Mathematica), readibility (Python),
familiarity (C, Java, Javascript, ...), 2-dimentional math notation
(Mathematica), ease of parsing (lisp), regularity (APL, Mathematica,
Lisp, ...), flexibility (Mathematica)... etc. Basically, you can look
at syntax, and programer's need to type them, from many perspectives.
The good qualities, such as ease of use, flexibitity, ease of reading,
ease of parsing, ease of input, etc, can be considered as the syntax's
power.

As a example of syntax of little power, think of a lang using binary
digits as its sole char set.

----------------------------------
Q: If you don't like cons, Common Lisp has arrays and hashmaps, too.

Suppose there's a lang called gisp. In gisp, there's cons but also
fons. Fons are just like cons except it has 3 cells with car, cbr,
cdr. Now, gisp is a old lang, the fons are deeply rooted in the lang.
Every some 100 lines of code you'll see a use of fons and car, cbr,
cdr, or any one of the caar, cdar, cbbar, cdbbar, etc. You got annoyed
by this. You as a critic, complains that fons is bad. But then some
gisp fan retort by saying: “If you don't like fons, gisp has cons,
too.”.

You see, by “having something too”, does not solve the problem of
polution. Sure, you can use just cons in gisp, but every lib or
other's code you encounter, there's a invasion of fons with its cbbar,
cdbbar, cbbbr. The problem created by fons cannot be solved by “having
cons too”.

----------------------------------

Q: I like the cons concept. Even in functional languages like Haskell
it is popular, e.g. when matching in the form of (x:xs), which is the
same like car/cdr in Lisp.

Languages that has a list datatype and First, Rest functions do not
mean it has lisp's cons problem.

One part of the cons problem in lisp is that it forces programer to
think of list in a low-level nested of 2-item construction, with
explicit functions like “cons”, “car”, “cdr”, “caar”, “cadr”, “cdar”,
“cddr”, “caaar”, “caadr” etc.

In other langs, the programer is not forced to think of nested 2-
items.

The other problem with lisp's cons, is that it hinders any development
of tree data structure. For example, one might write a function that
extracts the leafs of a tree. But due to lisp's list made of cons,
there is a different interpretations of what's considered a leaf.
Similarly, binary tree in lisp can be implemented either using cons
natively, or use so-called “proper list” that is implemented on top of
cons. Worse, any proper list can be mixed with improper list. So, you
can have a list of cons, or cons of lists, cons of cons, list of
lists, or any mix. The overall effect of the cons is that it prevents
lisp to have a uniform view of tree structure, with the result that
development of functions that work on tree are inconsistent, few, or
otherwise hampered.

----------------------------------

The full article is at:
http://xahlee.org/UnixResource_dir/w..._problems.html

Xah
http://xahlee.org/


Reply With Quote
  #2  
Old 08-22-2008, 04:39 PM
Jon Harrop
Guest
 
Default Re: Xah on Lisp


These are old arguments.

xahlee@gmail.com wrote:
> The following are some additions to the my lisp criticism essay, that
> are added as a result of this debate.
>
> ----------------------------------
> Q: You say that lisp syntax irregularities ?reduce such syntax's
> power?. What you mean by ?syntax's power??
>
> Here's some concrete examples of what i mean by power of syntax.
> ...


Although I agree with your original statement, I think your response misses
the point. The stock Lisper response is "Languages like Python lack Lisp's
macros". So you should have said "Mathematica syntax is better and includes
much more powerful support for macros".

> ----------------------------------
> Q: If you don't like cons, Common Lisp has arrays and hashmaps, too.
> ...


Within the limitations of dynamic typing, it is clearly better to globally
replace Lisp's cons cells with arrays, as Mathematica did.

> ----------------------------------
>
> Q: I like the cons concept. Even in functional languages like Haskell
> it is popular, e.g. when matching in the form of (x:xs), which is the
> same like car/cdr in Lisp.
>
> Languages that has a list datatype and First, Rest functions do not
> mean it has lisp's cons problem.
>
> One part of the cons problem in lisp is that it forces programer to
> think of list in a low-level nested of 2-item construction, with
> explicit functions like ?cons?, ?car?, ?cdr?, ?caar?, ?cadr?, ?cdar?,
> ?cddr?, ?caaar?, ?caadr? etc.
>
> In other langs, the programer is not forced to think of nested 2-
> items.
>
> The other problem with lisp's cons, is that it hinders any development
> of tree data structure...


That is caused by typeless programming which is an inevitable consequence of
having a very rudimentary type system. Again, the only people who will
disagree with you will be those unaware of the alternatives.

> ----------------------------------
>
> The full article is at:
> http://xahlee.org/UnixResource_dir/w..._problems.html


Although I agree that Lisp is long since extinct I do take issue with your
claim that it was devoid of merit. Many successful languages have drawn
upon Lisp. Indeed, I would say that Mathematica is what Lisp should have
been.

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 11:42 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.