From: Xah Lee
Subject: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <e21774d9-4d6e-4eec-8491-49f079fe298d@v5g2000prm.googlegroups.com>
Dear lispers,

LOL.

There's is a paper by Kent Pitman, about something about why lisp
doesn't have copy or the complexities of meaning of equality. This
essay is often cited by lispers in comp.lang.lisp, about every few
months in the past 9 years.

the current url is here:
 http://www.nhplace.com/kent/PS/EQUAL.html

I became aware of this essay maybe in early 2000s. I actually never
red it. I just knew that it's something lisper quote frequently like a
gospel. In the back of my mind, i tend to think it is something
particular to lisp, and thus is stupid, because many oft-debated lisp
issues, never happens in Mathematica, nor any dynamic langs i have
become a expert of since 2000. (e.g. perl, python, php, javascript.).

Today, out of boredom, i went and took a look (it has been just cited
again, by a old-time lisper Rob Warnock). I thought: let's see what
would happen, and perhaps it would cause me to write some damning
refutation about it.

This is when i LOL'd.

The paper, basically indicates a fundamental problem of lisp i have
tried to tell lispers for long. Namely: The cons prevents lisp from
developing into a coherent, consistent, libraries of functions that
deals with tree data. Secondly, the problem is caused by Lisp's
“internal” representation of things so-called “object”.

It is not a wonder, why these problems doesn't occur in other dynamic
languages, in particular PHP, Mathematica. (it does occur to some
degree in Perl, since it somewhat heavily relies on some “internal”
gook about references, type globs, file handles, distinction of its
own peculiar notion of list and array, etc.)

These 2 issues i have discussed in depth in the past. See:

• Fundamental Problems of Lisp
  http://xahlee.org/UnixResource_dir/writ/lisp_problems.html

• Is Lisp's Objects Concept Necessary?
  http://xahlee.org/emacs/lisps_objects.html

here's a short quote from the first essay:

«Lisp at core is based on functional programing on lists. This is
comparatively a powerful paradigm. However, for historical reasons,
lisp's list is based on the hardware concept of “cons” cell. From a
mathematical point of view, what this means is that lisp's lists is
limited to a max of 2 elements. If you want a longer list, you must
nest it and interpret it in a special way. (i.e. effectively creating
a mini-protocol of nesting lists, known as proper lists.) The cons
fundamentally crippled the development of list processing.»

Many lispers do not understand it, in fact actively accuse me of no
understanding. (this is in the context of comp.lang.lisp.) Most of
this reaction is rather just being defensive. (i presume lispers in
real life would receive it better.)

Kent's essay, may be viewed with 2 reactions. One of them, typically
taken by lispers, is this:

1. Typical programers are ignorant about lisp. They should learn lisp
before “attacking” (and see the light!).

However, it can be viewed in another way:

2. Lisp is a old lang, one of the first lang, with first running
version in the 1960s. Many later development in computing theory,
isn't caught up in lisp for many social reasons that is naturally
understandable, in particular after 1990s when lisp ceased to be used
in the industry. Many lisp's ways, thus is quaint, incompatible with
today's language views and practices, and sometimes, if not often, not
the best.

  Xah
∑ http://xahlee.org/

☄

From: Rock
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <45b09452-ccee-464a-839b-96cbd41d607a@a12g2000yqm.googlegroups.com>
On Jan 30, 4:06 am, Xah Lee <······@gmail.com> wrote:
> Dear lispers,
>
> LOL.
>
> There's is a paper by Kent Pitman, about something about why lisp
> doesn't have copy or the complexities of meaning of equality. This
> essay is often cited by lispers in comp.lang.lisp, about every few
> months in the past 9 years.
>
> the current url is here:
>  http://www.nhplace.com/kent/PS/EQUAL.html
>
> I became aware of this essay maybe in early 2000s. I actually never
> red it. I just knew that it's something lisper quote frequently like a
> gospel. In the back of my mind, i tend to think it is something
> particular to lisp, and thus is stupid, because many oft-debated lisp
> issues, never happens in Mathematica, nor any dynamic langs i have
> become a expert of since 2000. (e.g. perl, python, php, javascript.).
>
> Today, out of boredom, i went and took a look (it has been just cited
> again, by a old-time lisper Rob Warnock). I thought: let's see what
> would happen, and perhaps it would cause me to write some damning
> refutation about it.
>
> This is when i LOL'd.
>
> The paper, basically indicates a fundamental problem of lisp i have
> tried to tell lispers for long. Namely: The cons prevents lisp from
> developing into a coherent, consistent, libraries of functions that
> deals with tree data. Secondly, the problem is caused by Lisp's
> “internal” representation of things so-called “object”.
>
> It is not a wonder, why these problems doesn't occur in other dynamic
> languages, in particular PHP, Mathematica. (it does occur to some
> degree in Perl, since it somewhat heavily relies on some “internal”
> gook about references, type globs, file handles, distinction of its
> own peculiar notion of list and array, etc.)
>
> These 2 issues i have discussed in depth in the past. See:
>
> • Fundamental Problems of Lisp
>  http://xahlee.org/UnixResource_dir/writ/lisp_problems.html
>
> • Is Lisp's Objects Concept Necessary?
>  http://xahlee.org/emacs/lisps_objects.html
>
> here's a short quote from the first essay:
>
> «Lisp at core is based on functional programing on lists. This is
> comparatively a powerful paradigm. However, for historical reasons,
> lisp's list is based on the hardware concept of “cons” cell. From a
> mathematical point of view, what this means is that lisp's lists is
> limited to a max of 2 elements. If you want a longer list, you must
> nest it and interpret it in a special way. (i.e. effectively creating
> a mini-protocol of nesting lists, known as proper lists.) The cons
> fundamentally crippled the development of list processing.»
>
> Many lispers do not understand it, in fact actively accuse me of no
> understanding. (this is in the context of comp.lang.lisp.) Most of
> this reaction is rather just being defensive. (i presume lispers in
> real life would receive it better.)
>
> Kent's essay, may be viewed with 2 reactions. One of them, typically
> taken by lispers, is this:
>
> 1. Typical programers are ignorant about lisp. They should learn lisp
> before “attacking” (and see the light!).
>
> However, it can be viewed in another way:
>
> 2. Lisp is a old lang, one of the first lang, with first running
> version in the 1960s. Many later development in computing theory,
> isn't caught up in lisp for many social reasons that is naturally
> understandable, in particular after 1990s when lisp ceased to be used
> in the industry. Many lisp's ways, thus is quaint, incompatible with
> today's language views and practices, and sometimes, if not often, not
> the best.
>
>   Xah
> ∑http://xahlee.org/
>
> ☄

Well, then, I would really like to know what you think of Clojure.
Since it apparently hasn't got the above mentioned limitations
regarding the cons cell. It abstracts away from the concept of the
list moving up towards the concept of the "sequence". In Clojure a
list, a vector, a hash-map, and a set are all sequences. And a
sequence in particular is not a set of nested cons cells, but an
abstract concept on which one can operate with "first" and "rest".

How about that?

Rock
From: Xah Lee
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <5ed59cf9-5a59-4df6-b7c2-fcce635f602e@q30g2000prq.googlegroups.com>
Xah Lee wrote:
• Why Lisp Do Not Have A Generic Copy-List Function
  http://xahlee.org/UnixResource_dir/writ/lisp_equal_copy_list.html

Rock <···········@gmail.com> wrote:
> Well, then, I would really like to know what you think of Clojure.
> Since it apparently hasn't got the above mentioned limitations
> regarding the cons cell. It abstracts away from the concept of the
> list moving up towards the concept of the "sequence". In Clojure a
> list, a vector, a hash-map, and a set are all sequences. And a
> sequence in particular is not a set of nested cons cells, but an
> abstract concept on which one can operate with "first" and "rest".
>
> How about that?

I think that's great.

A number of new lisp langs, tried to fix the cons in various ways.
I think newLisp has index access to list elements instead of car/cdr.

  Xah
∑ http://xahlee.org/

☄
From: Kenneth Tilton
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <4984001e$0$20303$607ed4bc@cv.net>
Xah Lee wrote:
> Xah Lee wrote:
> • Why Lisp Do Not Have A Generic Copy-List Function
>   http://xahlee.org/UnixResource_dir/writ/lisp_equal_copy_list.html
> 
> Rock <···········@gmail.com> wrote:
>> Well, then, I would really like to know what you think of Clojure.
>> Since it apparently hasn't got the above mentioned limitations
>> regarding the cons cell. It abstracts away from the concept of the
>> list moving up towards the concept of the "sequence". In Clojure a
>> list, a vector, a hash-map, and a set are all sequences. And a
>> sequence in particular is not a set of nested cons cells, but an
>> abstract concept on which one can operate with "first" and "rest".
>>
>> How about that?
> 
> I think that's great.

oh, yeah, let's get rid of that whacky idea, the linked list. what were 
we thinking?!!!

<sigh>

kth
From: Xah Lee
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <e529f2d2-cc39-42c6-a3a9-e6b3e182e3ab@n33g2000pri.googlegroups.com>
On Jan 30, 11:39 pm, Kenneth Tilton <·········@gmail.com> wrote:
> XahLeewrote:
> >XahLeewrote:
> > • Why Lisp Do Not Have A Generic Copy-List Function
> >  http://xahlee.org/UnixResource_dir/writ/lisp_equal_copy_list.html
>
> > Rock <···········@gmail.com> wrote:
> >> Well, then, I would really like to know what you think of Clojure.
> >> Since it apparently hasn't got the above mentioned limitations
> >> regarding the cons cell. It abstracts away from the concept of the
> >> list moving up towards the concept of the "sequence". In Clojure a
> >> list, a vector, a hash-map, and a set are all sequences. And a
> >> sequence in particular is not a set of nested cons cells, but an
> >> abstract concept on which one can operate with "first" and "rest".
>
> >> How about that?
>
> > I think that's great.
>
> oh, yeah, let's get rid of that whacky idea, the linked list. what were
> we thinking?!!!
>
> <sigh>

Kenny, ask yourself what is a linked list. And, why, almost all modern
languages, doesn't have it?? is it because that's why lisp is superior
than them all? Is it because all modern lang creators, committees, the
Haskellers, the Meta Language Ocaml F# are stupid? Larry Wall of Perl
is a moron, Guido of Python is a moron, Yukihiro of Ruby is moron,
Rich of Clojure is a moron, Lutz of newlisp is moron? O, and Stephen
of Mathematica is a moron, in your opinion, hum?

rly, how to you explain the above? Is it really because other langs
don't get it? their design decision is bad? Their design traded off
something very important? They missed linked list by mistake? Or,
perhaps, their views in general of not including linked list (whatever
that means), is just a modern school of thought, which, in old-time
lisper's school of thought, is really bad decision??

really, what the fuck is a linked list? O, this is not a rhetorical
question. Define, explain, what exactly it is? Is it defined by the
syntax of nesting cons?? Or, is it a abstract concept? Is it a
computer language implementation detail on a sequence kinda abstract
entity?? is it a generic abstract computer science data structure that
can be implemented in any lang? Is it a particular language's
datatype??? humm? hum? all of the above? some of the above? other?
which is your view hum? What aspect, definition, concept, detail, are
you presumably using to imply that lispy langs dropping lisp's cons is
stupid?

Now, pick a definition. Then, let's discuss its relation to the cons,
or the why should or should not it be significant in computer
languages, why lisp has it, why ther langs seemingly have or don't
have it, etc.

Woot kenny, Woot! Meet me in Second Life. We can voice chat, n i
introduce you to sexy chicks if you want.

  Xah
∑ http://xahlee.org/

☄
From: Kenneth Tilton
Subject: New Song for Xah [was Re: Kent Pitman's essay on why lisp doesn't have copying of lists.]
Date: 
Message-ID: <4984c85e$0$25425$607ed4bc@cv.net>
Xah Lee wrote:
> On Jan 30, 11:39 pm, Kenneth Tilton <·········@gmail.com> wrote:
>> XahLeewrote:
>>> XahLeewrote:
>>> • Why Lisp Do Not Have A Generic Copy-List Function
>>>  http://xahlee.org/UnixResource_dir/writ/lisp_equal_copy_list.html
>>> Rock <···········@gmail.com> wrote:
>>>> Well, then, I would really like to know what you think of Clojure.
>>>> Since it apparently hasn't got the above mentioned limitations
>>>> regarding the cons cell. It abstracts away from the concept of the
>>>> list moving up towards the concept of the "sequence". In Clojure a
>>>> list, a vector, a hash-map, and a set are all sequences. And a
>>>> sequence in particular is not a set of nested cons cells, but an
>>>> abstract concept on which one can operate with "first" and "rest".
>>>> How about that?
>>> I think that's great.
>> oh, yeah, let's get rid of that whacky idea, the linked list. what were
>> we thinking?!!!
>>
>> <sigh>
> 
> Kenny, ask yourself what is a linked list. And, why, almost all modern
> languages, doesn't have it?? is it because that's why lisp is superior
> than them all? Is it because all modern lang creators, committees, the
> Haskellers, the Meta Language Ocaml F# are stupid? Larry Wall of Perl
> is a moron, Guido of Python is a moron, Yukihiro of Ruby is moron,
> Rich of Clojure is a moron, Lutz of newlisp is moron? O, and Stephen
> of Mathematica is a moron, in your opinion, hum?

Sorry to throw you off by focusing on linked lists. The problem is one 
of what gets copied if one just says "copy", and this has to do with 
shallow vs deep structure. I do not know why Kent said static languages 
know what to copy because AFAIK only pure functional languages would not 
have that problem because the copy is always deep (and then they go to 
work on fixing that efficiency nightmare).

If one is not using linked lists but still manages to be efficient, 
something tells me there is a linked list in there somewhere (thus 
addressing your question below "what is a linked list?").

As for your list of moronic languages (de-hominizing somewhat) all I can 
say is that I have heard good things about Clojure. The rest I am happy 
to dismiss as in anyway constituting objections by superior example to 
anything in CL.

peace,kth

ps. I found us a theme song!

http://www.jango.com/music/Gnarls+Barkley?l=0

"I remember when, I remember, I remember when I lost my mind
There was something so pleasant about that place.
Even your emotions had an echo
In so much space

And when you're out there
Without care,
Yeah, I was out of touch
But it wasn't because I didn't know enough
I just knew too much..."


:)k

> 
> rly, how to you explain the above? Is it really because other langs
> don't get it? their design decision is bad? Their design traded off
> something very important? They missed linked list by mistake? Or,
> perhaps, their views in general of not including linked list (whatever
> that means), is just a modern school of thought, which, in old-time
> lisper's school of thought, is really bad decision??
> 
> really, what the fuck is a linked list? O, this is not a rhetorical
> question. Define, explain, what exactly it is? Is it defined by the
> syntax of nesting cons?? Or, is it a abstract concept? Is it a
> computer language implementation detail on a sequence kinda abstract
> entity?? is it a generic abstract computer science data structure that
> can be implemented in any lang? Is it a particular language's
> datatype??? humm? hum? all of the above? some of the above? other?
> which is your view hum? What aspect, definition, concept, detail, are
> you presumably using to imply that lispy langs dropping lisp's cons is
> stupid?
> 
> Now, pick a definition. Then, let's discuss its relation to the cons,
> or the why should or should not it be significant in computer
> languages, why lisp has it, why ther langs seemingly have or don't
> have it, etc.
> 
> Woot kenny, Woot! Meet me in Second Life. We can voice chat, n i
> introduce you to sexy chicks if you want.
> 
>   Xah
> ∑ http://xahlee.org/
> 
> ☄
> 
From: Xah Lee
Subject: Re: New Song for Xah [was Re: Kent Pitman's essay on why lisp doesn't 	have copying of lists.]
Date: 
Message-ID: <318ceb00-05cd-4c3a-804b-66a7af2d3b81@a12g2000pro.googlegroups.com>
On Jan 31, 1:53 pm, Kenneth Tilton <·········@gmail.com> wrote:

> > Kenny, ask yourself what is a linked list. And, why, almost all modern
> > languages, doesn't have it?? is it because that's why lisp is superior
> > than them all? Is it because all modern lang creators, committees, the
> > Haskellers, the Meta Language Ocaml F# are stupid? Larry Wall of Perl
> > is a moron, Guido of Python is a moron, Yukihiro of Ruby is moron,
> > Rich of Clojure is a moron, Lutz of newlisp is moron? O, and Stephen
> > of Mathematica is a moron, in your opinion, hum?
>
> Sorry to throw you off by focusing on linked lists. The problem is one
> of what gets copied if one just says "copy", and this has to do with
> shallow vs deep structure. I do not know why Kent said static languages
> know what to copy because AFAIK only pure functional languages would not
> have that problem because the copy is always deep (and then they go to
> work on fixing that efficiency nightmare).

my gribe is rather not technical details on Common Lisp of Kent's
essay. It's more about how that essay, illustrate my point to a T,
about lisp's cons as discussed in my essay.

as to “deep structure”, that often means like a list that uses
reference in its elements to other lists, or create the tech-geeker
loved jargon circular list. This type of thing, is passe of the 1980
or early 1990s with low level languages. In high level langs or
today's langs, basically the concept of “reference”, “pointer” is
gone. Sure, in today's lang sometimes you could have still see it uses
the “a reference” terminology pecular to itself but has the general
meaning of “reference” in the contex of compiler. (e.g. OCaml has
“ref”) But basically, the entity of something that is intimately tied
to compiler stuff or “internal” stuff is gone, and programers don't
have to worry about that. (similiar applies to memory stuff. Tech
geeking morons daily sway & swoon about “garbage collection”. Garbage
collection, Garbage Collection. The ins and outs of garbage
collection. The speed of garabage collection. The types of garbage
collection.)

If you want a reference, you can implement in any high level lang that
has sufficient functional programing features such as control of eval,
first class function. Basically, you just use a variable for the
“reference”, with eval or holdEval.

> If one is not using linked lists but still manages to be efficient,
> something tells me there is a linked list in there somewhere (thus
> addressing your question below "what is a linked list?").

this kinda begs the question. So, if i code a nested list structured
like lisp's cons, in say perl, php, python, Mathematica, javascript.
What does that imply, the often cited reason by lispers, that cons in
lisp is important for reasons of linked list?

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

> As for your list of moronic languages (de-hominizing somewhat) all I can
> say is that I have heard good things about Clojure. The rest I am happy
> to dismiss as in anyway constituting objections by superior example to
> anything in CL.
>
> peace,kth
>
> ps. I found us a theme song!
>
> http://www.jango.com/music/Gnarls+Barkley?l=0
>
> "I remember when, I remember, I remember when I lost my mind
> There was something so pleasant about that place.
> Even your emotions had an echo
> In so much space
>
> And when you're out there
> Without care,
> Yeah, I was out of touch
> But it wasn't because I didn't know enough
> I just knew too much..."
>
> :)k

Nice lyrics. Nice site. I didn't find the playable recording of this
song though... not sure its name...

Kenny, have you tried Second Life? Really... it's fun. There's lisp
group in world... but more so it's really a lot things, concepts,
practical utilities to explore.

For those unfamiliar:

• A Photographic Tour of Life in Second Life
  http://xahlee.org/sl/index.html

• Second Life, Tech Geekers, And Escapism
  http://xahlee.org/Netiquette_dir/Second_Life_vs_newsgroup_escapism.html

  Xah
∑ http://xahlee.org/
From: Kenneth Tilton
Subject: Re: New Song for Xah [was Re: Kent Pitman's essay on why lisp doesn't  have copying of lists.]
Date: 
Message-ID: <49881271$0$20307$607ed4bc@cv.net>
Xah Lee wrote:
> On Jan 31, 1:53 pm, Kenneth Tilton <·········@gmail.com> wrote:
> 
>>> Kenny, ask yourself what is a linked list. And, why, almost all modern
>>> languages, doesn't have it?? is it because that's why lisp is superior
>>> than them all? Is it because all modern lang creators, committees, the
>>> Haskellers, the Meta Language Ocaml F# are stupid? Larry Wall of Perl
>>> is a moron, Guido of Python is a moron, Yukihiro of Ruby is moron,
>>> Rich of Clojure is a moron, Lutz of newlisp is moron? O, and Stephen
>>> of Mathematica is a moron, in your opinion, hum?
>> Sorry to throw you off by focusing on linked lists. The problem is one
>> of what gets copied if one just says "copy", and this has to do with
>> shallow vs deep structure. I do not know why Kent said static languages
>> know what to copy because AFAIK only pure functional languages would not
>> have that problem because the copy is always deep (and then they go to
>> work on fixing that efficiency nightmare).
> 
> my gribe is rather not technical details on Common Lisp of Kent's
> essay. It's more about how that essay, illustrate my point to a T,
> about lisp's cons as discussed in my essay.

It is not a technical detail. Deep copying is not about pointer-free 
languages.

As to Second Life, I am not looking for more ways to get fat sitting at 
a computer, I am looking for another tennis partner.

As for "Crazy" by Gnarls Barkley, there was a play button on that page 
you need to find it because it is an amazing tune, won some awards that 
year.

hth,kzo
From: Jon Harrop
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <DbmdnfYZa-jHCxnUnZ2dnUVZ8vqdnZ2d@posted.plusnet>
Xah Lee wrote:
> On Jan 30, 11:39 pm, Kenneth Tilton <·········@gmail.com> wrote:
>> oh, yeah, let's get rid of that whacky idea, the linked list. what were
>> we thinking?!!!
> 
> Kenny, ask yourself what is a linked list. And, why, almost all modern
> languages, doesn't have it?

Kenny's statement is obviously missing the point but your response is just
as bad. Modern languages do have linked lists, of course. Indeed, languages
like Haskell are often accused of overusing linked lists (although they
actually have excellent support for rich data structures).

> Haskellers, the Meta Language Ocaml F# are stupid?

Those languages all have linked lists as first-class data structures built
into the language with special syntactic support. This is a linked list
literal in OCaml and F#:

  [1;2;3]

The following syntax is used both to construct and dissect a singly-linked
immutable list:

  h::t

For example:

  1 :: [2;3]

builds the list [1;2;3] or matches the list [1;2;3].

> ...Stephen of Mathematica is a moron...?

From my point of view, Mathematica's solution of providing a single uniform
data structure that is an array with O(1) random access is obviously
preferable in a dynamic language because it fits with the generality
inherent in the rest of the design. Unfortunately, they chose to call
it "List" in Mathematica but the basic idea seems ideal to me. This is an
array of values of any type in Mathematica:

  {1, 2, 3}

You can just as well do:

  {1, 2.3, "Hello", a + b c^d}

But what on Earth was the designer of Lisp's cons cell thinking?! I can only
assume it was a bit-twiddling maniac trying to squeeze as much out of a few
bits as possible. But why do that for an inherently wasteful data
structure? Anyway, it certainly has no place in a modern HLL.

> really, what ... is a linked list? ... is it a abstract concept?

Not abstract. A linked list is a concrete data structure composed of cells
that refer to each other by reference (the links) in a linear sequence.
Singly-linked lists have references only in one direction. Double-linked
lists have references in both directions. Immutable lists forbit the
references to be mutated but the elements of the list may still be mutable.

> Now, pick a definition. Then, let's discuss its relation to the cons,
> or the why should or should not it be significant in computer
> languages, why lisp has it, why ther langs seemingly have or don't
> have it, etc.

Lisp-style cons cells have no benefits today.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
From: Xah Lee
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <f3479b5c-60d5-4b8a-b634-a49de5fa89a6@r41g2000prr.googlegroups.com>
Dear Jon idiot,

No, Ocaml doesn't have linked list. Looook:

>   [1;2;3]

That's a sequence of 3 numbers, separated by semicolon, then bracketed
by square brackets. As flat as you can see.

>   h::t

That's ocaml's syntax to deconstruct a sequece of things by pattern
matching the first element and the rest elements, so that programers
can retrieve either the first element or rest elements.

>   1 :: [2;3]

That's a syntax for prepending the element 1 to the flat sequece of 2
and 3. No link in sight.

> From Jon idiot's point of view, Mathematica...

O, Mathematica has linked list. Look:

 {1,{2,{3,{}}}}
 A  B  C

The list A's second element is referenced to the list B, who's second
element is linked to list C. See? Linked!

O, i forgot, that you forgot to define what you mean by linked list.
You wrote:

> Not abstract. A linked list is a concrete data structure composed of cells
> that refer to each other by reference (the links) in a linear sequence.
> Singly-linked lists have references only in one direction. Double-linked
> lists have references in both directions. Immutable lists forbit the
> references to be mutated but the elements of the list may still be mutable.

ummm.... egadz, so do you mean linked list is a computer language
engineering issue?? How's this apply to your example of Ocaml and
opinion of Mathematica? Do you mean their compilers work in certain
way therefore Ocaml has links and Mathematica don't? What is the
relation of how the compiler works to users of the lang? Does the
language C has linked list by your definition?

What lang has linked list by your definition above? Does Perl, Python,
PHP, Java? I tried to think this, but your def is impricise. What's a
“cell”, “linear sequence”? I mean, it has lots meanings in math,
computer science... depending what special context you are talking
about. The term “data structure” itself is quite flexible too. I mean,
don't you agree that you can implement any data structure with turing
machines too? In your fuzzy definition, then the Mathematica “{1,{2,{3,
{}}}}” is a linked list right? From your def: “data structure”, check.
“composed of cells”, check, “refers to each by reference in a linear
sequence”, check.

  Xah
∑ http://xahlee.org/

☄
From: Jon Harrop
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <NYqdnXb-_dRoVBnUnZ2dnUVZ8u-dnZ2d@posted.plusnet>
Xah Lee wrote:
> Dear Jon idiot,
> 
> No, Ocaml doesn't have linked list. Looook:
> 
>>   [1;2;3]
> 
> That's a sequence of 3 numbers, separated by semicolon, then bracketed
> by square brackets. As flat as you can see.
> 
>>   h::t
> 
> That's ocaml's syntax to deconstruct a sequece of things by pattern
> matching the first element and the rest elements, so that programers
> can retrieve either the first element or rest elements.
> 
>>   1 :: [2;3]
> 
> That's a syntax for prepending the element 1 to the flat sequece of 2
> and 3. No link in sight.

The "::" represents the link. The resulting data structure is not "flat" in
the sense that you cannot access any element in constant time: you must
start at the beginning and pull off elements until you reach the one you
are after. So getting the "n"th element is O(n).

>> From Jon idiot's point of view, Mathematica...
> 
> O, Mathematica has linked list. Look:
> 
>  {1,{2,{3,{}}}}
>  A  B  C

Exactly.

> The list A's second element is referenced to the list B, who's second
> element is linked to list C. See? Linked!

Yes. With dynamic typing you only need arrays (called Lists in Mathematica)
and you can nest them to get a linked list, exactly as you did.

Therefore, I have no idea why anyone would want a cons cell...

>> Not abstract. A linked list is a concrete data structure composed of
>> cells that refer to each other by reference (the links) in a linear
>> sequence. Singly-linked lists have references only in one direction.
>> Double-linked lists have references in both directions. Immutable lists
>> forbit the references to be mutated but the elements of the list may
>> still be mutable.
> 
> ummm.... egadz, so do you mean linked list is a computer language
> engineering issue?? How's this apply to your example of Ocaml and
> opinion of Mathematica? Do you mean their compilers work in certain
> way therefore Ocaml has links and Mathematica don't?

They both support links. In Mathematica, you just put one expression inside
another exactly as you did (with {} inside {1, {}} you have a linked list).
With OCaml you define a recursive datatype and the point where the datatype
refers to itself is a link:

  type 'a list = A | B of 'a * 'a list

Then you have an equivalence:

  OCaml/F#       Mathematica
  A              {}
  B(1, A)        {1, {}}
  B(1, B(2, A))  {1, {2, {}}}

So they both support linked lists.

> What is the relation of how the compiler works to users of the lang? Does
> the language C has linked list by your definition?

I suppose you need someone able to express the link itself and that would be
a pointer or reference internally. In Mathematica, these linked lists are
stored as an array of pointers to their components. In OCaml and F#, the
linked lists use a pointer internally whenever a data structure contains a
list, including a list that contains its tail list.

> What lang has linked list by your definition above? Does Perl, Python,
> PHP, Java?

All of them, AFAIK. The only difference is that some languages provide
linked lists in their standard libraries and others do not. I think it will
be difficult to find a language that cannot express a linked list.

> I tried to think this, but your def is impricise. What's a 
> “cell”,

I suppose that has to be a product type containing some value (an element in
the list) and a reference to the tail list.

> “linear sequence”?

I meant that the type constructors in the ML definition refers to itself no
more than once:

  type 'a list = A | B of 'a * 'a list

If the type refers to itself (e.g. 'a t) twice then you have a binary tree:

  type 'a t = A | B of 'a t * 'a t

However, there are several pitfalls here. Linked lists can be cyclic, in
which case "linear" is a confusing term. With immutable singly-linked
lists, you often have several lists that share the same tail:

  let a = [2;3]
  let b = 0::a
  let c = 1::a

So "linear" might be a confusing term there as well.

> I mean, it has lots meanings in math,   
> computer science... depending what special context you are talking
> about. The term “data structure” itself is quite flexible too. I mean,
> don't you agree that you can implement any data structure with turing
> machines too?

That is an interesting question. Can a Turing machine read a location
encoded on the tape and then jump to that location along the tape?

> In your fuzzy definition, then the Mathematica “{1,{2,{3, 
> {}}}}” is a linked list right?

Yes.

> From your def: “data structure”, check. 
> “composed of cells”, check, “refers to each by reference in a linear
> sequence”, check.

Exactly.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
From: Matthias Buelow
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <6uomd2FgdiksU1@mid.dfncis.de>
Xah Lee wrote:

> Now, pick a definition. Then, let's discuss its relation to the cons,
> or the why should or should not it be significant in computer
> languages, why lisp has it, why ther langs seemingly have or don't
> have it, etc.

When may we see Xah Lisp (Leesp?), which fixes all those horrible things
that supposedly are dragging the current Lisps down (and, I'm quite
sure, all the other languages that had the misfortune of crossing your
path, too)?
From: Xah Lee
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <5abd6d94-7a3c-4392-8578-7ca4e176da3c@z6g2000pre.googlegroups.com>
On Feb 2, 8:47 am, Matthias Buelow <····@incubus.de> wrote:
> Xah Lee wrote:
> > Now, pick a definition. Then, let's discuss its relation to the cons,
> > or the why should or should not it be significant in computer
> > languages, why lisp has it, why ther langs seemingly have or don't
> > have it, etc.
>
> When may we see XahLisp (Leesp?), which fixes all those horrible things
> that supposedly are dragging the current Lisps down (and, I'm quite
> sure, all the other languages that had the misfortune of crossing your
> path, too)?

I have no problem with Mathematica, JavaScript, Pretty Home Page,
Emacs Lisp, and now, OCaml.

The most hateful, criminal, langs, roughly from most hateful to less,
are: Perl, C, C++, Java.

To a lesser degree, Python, Scheme, Haskell should be attached to the
end above.

You'll note, it's not about the tech nature of the lang.

• What Languages to Hate
  http://xahlee.org/UnixResource_dir/writ/language_to_hate.html

plain text version follows.

----------------------------
What Languages to Hate

Xah Lee, 2002-07-18

Dear lisp comrades and other concerned parties,

First, all languages have equal rights. Do not belittle other
languages just because YOUR favorite language is a bit better in this
aspect or that. Different people have different ideas and manners of
perception. Ideas compete and thrive in all unexpected fashions.
Societies improve, inventions progress. Lisp may be a first in this or
that, or faster or flexibler, or higher level than other languages old
and new, but then there are other languages the like of Mathematica &
Haskell & Dylan et al which ridicule lisps in the same way lisp
ridicule other languages.

Just because YOU are used to more functional programing or love lots
of parenthesis doesn't mean they are the only and best concepts. The
so-called Object Oriented programing of Java fame, or the visual
programing of Visual Basic fame, or the logic programing of Prolog
fame, or the format-stable syntax of Python fame, or the “one line of
Mathematica equals ten to one thousand lines of lisp” of _A New Kind
Of Science_ fame... all are parts of healthy competing concepts,
paradigms, or directions of growth.

The way some of you deride other languages is like sneering
heterogeneousness. If unchecked, soon you'll only have your sister to
marry to. Cute, but you do not want incest to become the only sex.
Next time your superiority complex makes you sneer at non-lisp or
newfangled languages, remember this. It is diversity of ideas, that
drives the welfare of progress.

Now, there is one judgmental criterion, that if a language or computer
technology fits it, then we not only should castigate at their
missionaries, but persecute and harass the language to the harshest
death. That is: utter sloppiness, irresponsibility, and lies. These
things are often borne out of some student's homework or moron's dirty-
work, harbored by “free” and wanton lies and personal fame, amassed
thru ignorance.

Of my short but diligent industrial unix computing experience since
1998, i have identified the following targets:

    * C (and consequences like csh, C++)
    * vi
    * Perl
    * MySQL
    * unix, unixism, and things grown out of unix. (languages,
protocols, philosophies, expectations, movements)

In our software industry, i like to define criminals as those who
cause inordinate harm to society, not necessarily directly. Of the
above things, some of their authors are not such criminals or are
forgivable. While others, are hypocritical fantastic liers selfish to
the core. When dealing with these self-promoting jolly lying humble
humorous priests and their insidious superficially-harmless speeches,
there should be no benefit of doubt. Tell them directly to stop their
vicious lies. Do a face-off.

As to their brain-washed followers for example the not-yet-hard-core
unix, C, or Perl coders rampant in industry, try to snap them out of
it. This you do by loudly snapping fingers in front of their face,
making it sound like a ear piercing bang. Explain to them the utter
stupidity of the things they are using, and the harm to their brain.
IMPORTANT: _teach_, not _debate_ or _discuss_ or falling back into
your philosophical deliberating indecisiveness. I've seen enough
criticisms among learned programers or academicians on these, so i
know you know what i'm talking about. When you see a unixer
brainwashed beyond saving, kick him out of the door. He has became a
zombie who cannot be helped.

There are other languages or technology, by itself technically are
perhaps mediocre but at least is not a egregious irresponsible hack,
therefore does not deserve scorn, but sometimes it comes with
overwhelming popular outrageous lies (euphemized as hype). Java is a
example. For this reason, it is equally deserving the harshest
treatment. Any loud proponents of such should be immediately slapped
in the mouth and kicked in the ass in no ambiguous ways.

Summary: all languages have equal rights. However, those utterly
SLOPPY and IRRESPONSIBLE HACKS with promoter's LIES should be severely
punished. It is these, that cause computing industry inordinate harm.
Meanwhile, it is wrong to haughtily criticize other languages just
because they are not your cup of tea. Now, please remember this and go
do society good.

  Xah
∑ http://xahlee.org/

☄
From: namekuseijin
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <gmcj0b$qip$1@adenine.netfront.net>
Xah Lee escreveu:
> On Feb 2, 8:47 am, Matthias Buelow <····@incubus.de> wrote:
>> Xah Lee wrote:
>>> Now, pick a definition. Then, let's discuss its relation to the cons,
>>> or the why should or should not it be significant in computer
>>> languages, why lisp has it, why ther langs seemingly have or don't
>>> have it, etc.
>> When may we see XahLisp (Leesp?), which fixes all those horrible things
>> that supposedly are dragging the current Lisps down (and, I'm quite
>> sure, all the other languages that had the misfortune of crossing your
>> path, too)?
> 
> I have no problem with Mathematica, JavaScript, Pretty Home Page,
> Emacs Lisp, and now, OCaml.
> 
> The most hateful, criminal, langs, roughly from most hateful to less,
> are: Perl, C, C++, Java.
> 
> To a lesser degree, Python, Scheme, Haskell should be attached to the
> end above.
> 
> You'll note, it's not about the tech nature of the lang.
> 
> • What Languages to Hate
>   http://xahlee.org/UnixResource_dir/writ/language_to_hate.html

You're fun, man.  Why not submit your posts to alt.humor as well?  done.
From: Leslie P. Polzer
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <846c3431-0e02-4c49-8697-bdc36aab49ce@y1g2000pra.googlegroups.com>
On Jan 31, 4:58 am, Xah Lee <······@gmail.com> wrote:

> I think that's great.
>
> A number of new lisp langs, tried to fix the cons in various ways.
> I think newLisp has index access to list elements instead of car/cdr.

Yes, for example the latest upstart "Common Lisp",
which I like a lot:

CL-USER(2): (nth 2 '(a b c d))

C
From: Stanisław Halik
Subject: Re: Kent Pitman's essay on why lisp doesn't have copying of lists.
Date: 
Message-ID: <gm2hsj$1nbr$1@opal.icpnet.pl>
In comp.lang.lisp Xah Lee <······@gmail.com> wrote:

> [...]

Guys, how about you reply to the post of this blatant troll only on
comp.lang.lisp, instead of sending responses to a dozen unrelated
newsgroups?

And Xah, you make even less sense than you usually do.