Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: the necessi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 2738 of 2912
Post > Topic >>

Re: the necessity of Lisp's Objects?

by Ken Tilton <kennytilton@[EMAIL PROTECTED] > Jan 23, 2008 at 01:44 PM

Xah Lee wrote:
> Hi Kenny!

Xah!

> 
> Ken Tilton <kennytil...@[EMAIL PROTECTED]
> wrote:
> 
> 「If I say (eq (list 1)(list 1)) in Lisp I get nil, aka, nope, they are
> not EQ, EQ being the test for object identity. (They happen also not
> to be EQL, just EQUAL (the one that digs into structure)).
> 
> What happens in Mathematica?
> 」
> 
> In[5]:=
> Equal[List[1],List[1]]
> 
> Out[5]=
> True
> 
> This is the beauty of mathematica. Simple, easy to understand. What
> you see is what you get. No behind the scenes stuff.
> 
> 「The advantage to me in Lisp is that I can have two lists starting
> with the same textual expression and they will, well, be two different
> lists, not one.」
> 
> This is exactly the point of confusing, behind-the-scenes lang model,
> i mean. Depending on the language, they can get quite convoluted. (in
> particular, Java, with its access specifiers, constructors, objects,
> arrays, references etc.)

I do find things like C++ pretty scary in this respect, mostly because 
of that whacky syntax. :) I am just not sure mutable state is 
necessarily confusing. I suppose (but am prepared for rectification) you 
are OK with slots of structs and cl***** (does Mathematica have such 
things?) being mutable, such that a change to a slot of an instance is 
visible from any reference that might be held to that instance. And I 
surmise also you do not consider this magic nor even behind-the-scenes? 
If so (and again I understand you might not in fact agree so far), then 
all we have in Lisp is that our lists (and other things other than 
numbers and characters) also have object identity, so if there are 
multiple references to the same thing they all change together, like an 
in-memory database if you will.

Now if I am wrong and you do find mutable state in general confusing, 
well, I guess many agree with you, namely the entire FP community. And 
even I agree: the functional paradigm is a huge win for transparency and 
program correctness. I just never enslave my self to good principles 
like FP, I always reserve the right to do what I want, shucks, even use 
tagbody-go in moments of weakness. :)

> 
> 「I can mutate one without mutating the other, holding references to
> each in different places, and then see different lists when those two
> places are compared, or (the flip side) see "the same" list even when
> the contents of the list have changed. ie, I might have two Lisp
> "places" bound to the same list and want changes to be visible
> regardless of the binding.」
> 
> Note here that Mathematica language programing doesn't have any
> concepts of momeries, pointers, or references in any way. So, this
> means, you can't like change one entity and expect some other entity
> will also be changed mysteriously or magically.

Well, the c.l.l savages always ridicule me on this, but one /does/ have 
to master the cons to do well with Lisp. And I guess you are right, many 
a noob (all?) trips over Lisp lists early on. Hell, I have always 
maintained Lisp lists should be explained this way: there is no such 
thing as a list, there are just conses with cars and cdrs.
> 
> Remember, everything is textual, “what u see is what get”, thinking
it
> as a formal mathematics system. (formal means FORMal. The word
> “formal” is a example of bad/mutated terminology that creates
endless
> confusion)
> 
> Kenny wrote:
> 「Mind you, this all comes down to the question of state. Does
> Mathematica
> have that concept, or is it purely functional? (not that I am
> conversant
> with FPL either). If not, sure all list[1,2,3]s can be collapsed into
> one, no need for object identity, there it is, list[1,2,3]. But in
> Lisp
> we can have two variables bound to the same list:
> 
>   (setf x (setf y (list 1 2 3))
> 
> ...and then (delete 2 y) and see the result in x because x is "/the
> same/ list as y", it is /not/ "the list of 1, 2, and 3".
> 
> Is that necessary? It is what it is, which is different than
> Mathematica
> it seems, but I do not see an interesting issue here.
> 」
> 
> Excellent example to illustrate the issue. I'd pick on your
> characterization about this being stateful vs not-stateful. What the
> behind-the-scenes hard-linked kinda thing is basically modeled on a
> state machine kinda thinking. (actually, more just because it's easy
> to implement)
> 
> Mathematica does not use “behing the scenes” lang model but you can
> assign vars in Mathematica and change it later in your program. The
> Mathemtica programing culture is more like “whatever works”, in this
> sense a lot like Common Lisp as contrasted to Scheme lisp.
> 
> In Mathematica, if you want the behavior as of hardlinking 2 behind-
> the-scene things, just assign them to the same var... like this:
> 
> In[25]:=
> data={1,2,3};
> x := data;
> y := data;
> 
> In[28]:=
> data=Delete[data,2]
> 
> Out[28]=
> {1,3}
> 
> In[29]:=
> x
> 
> Out[29]=
> {1,3}
> 
> In[30]:=
> y
> 

And?:

Out[30]=
{1,3}

I guess so, since it seems no diff than x. Can I go the other way, 
Delete[x,2] and see it back in data? Or has x become like a symbol-macro 
for data? Anyway...

> The “:=” is syntax shortcut for “SetDelayed[]”, while “=” is
“Set[]”.
> The difference, is that the Set evaluate the rhs before assignment,
> while SetDelayed evaluate the rhs only when it is called.

And once it is called? What if you had evaluated x /first/ and seen 
1,2,3 and /then/ deleted 2. Would a second evaluation of x still return 
1,2,3? If it returns 1,2, then := in a sense gives one the same thing as 
object identity, except (and this may be an advantage, if I want to 
achieve this behavior I must remember to use :=. ie, if I now want to 
have z refer to the same list, I must say z := x.

> 
>  In my 2 decades of progaming experiences, with 5+ years of geometry
> programing and 5+ years in web application development and unix sys
> admin, expert at several languages, i don't think there is a instance
> where i needed 2 things to be linked in some hard way.

I do it all the time. Lists are a very powerful data structure and with 
a full suite of list-processing functions such as CL has one can go 
quite far with them without getting into structs and cl*****. This works 
especially well inside functions where it is not all that hard to keep 
track of what is in each position in a list one dashes off on the fly.

> And, whenever a
> lang sup****t such a idea, it usually just hamper the use of the
> language. (one example is unix file system's hardlinks)

But if we cannot mutate lists we lose expressive power. Lisp programs 
that always copy structure cannot scale beyond toy size. So mutable 
state is not there just to confuse people, it extends the language (so, 
yes, there is more to be learned).
> 
> Basically, i think the concept of linking things is one of those easy-
> to-implement paradigm that just gets rooted in the early time of
> computing, when hardware (as well as software techs) are rather
> primitive. Over time, these types of paradigms gets ****fted and
> eliminated. (e.g. dynamic/lexical scope, pointers vs so-called garbage-
> collection, primitive statics typing (a la C, Java) vs dynamic typing
> (lisp,perl,python,php, ruby, javascript ...on and on) or typing with
> inference (haskell) or no types and mathematical types (Mathematica))
> 
> People unfamiliar with ultra high level languages such as Mathematica
> (or perhaps haskell too), can understand this “what u see is what u
> get” by comparing to dynamic and lexical scope. Lexical scope, in a
> sense, is of the model “wysiwyg”, while dynamic can be likened to
> “behind the scenes happenings”.

OK, but if one thinks of dynamic scope as up the stack instead of behind 
the scenes, it is not so scary. Mind you, this means using special 
variables with discipline, only ever binding them in let clauses.

> The behavior of Mathematica expression
> is wysiwyg, while lisp's expressions with its “objects” is “behind
the
> scenes happenings”. Also, the “behind the scenes” style are often
the
> brainless of the two to implement, that's why they are everywhere. But
> as i repeated quite a few times, as computer langs throughout the past
> 2 decades, we see a progress towards higher level with less and less
> these behind-the-scenese lang model kinda langs.

I wish I knew more about FP, it sounds like you would prefer that to the 
extra mental housekeeping we Lispers take for granted (and sometimes 
screw up).

> 
> Kenny wrote:
> 「No beauty either way, just different.」
> 
> There is much beauty far beyond lisp, Kenny.

You are right, it has been too long since I dropped this URL:

    http://www.tilton-technology.com/cello-shot-06.jpg

> 
> I get frustrated seeing how people truly are moronic in comparison to
> me, having no idea what i'm talking about while i fully understand
> what they are talking about. In the past few years i began to reckon
> that i'm just a genius, whose views are maybe 30 years into the future
> beyond the average computer scientists or industrial programers. (a
> bit scary to say this myself, i know.)

I have not read much of the thread, but you are not going to change the 
audience, all you can change is Xah. (No, it is not easy changing 
oneself, either, but unlike changing others it is remotely possible.) 
The change you can make is simply to continue only those subthreads you 
find worthwhile, which may well be the null set. I think you already do 
this with the hysterical Greek chorus that always screeches "Troll!" at 
you, just do the same with exchanges you do not find intellectually 
stimulating.

> 
> In this particular thread, i claim, that high level langs of the
> future is getting rid of the “behind the scenes” lang model, as i
have
> repeatedly voiced it in this thread. When i posted my first post, i
> had some reservations, thinking that lisp's objects concept are
> perhaps necessary in some way for the lang's area of applications. Now
> having seen the many replies and have thought more about it, i more
> inclined to think it's simply another baggage of 1970s computing era,
> and probably can be eliminated without effecting the power of the lang
> in any way.

No, mutable lists rock and are one of the great bits of genius behind 
Lisp, the idea that the singly-linked list is an incredibly versatil 
data structure. To have that and all the list-processing functions just 
sitting there at ones fingertips while da****ng off little algorithms is 
simply huge, explaining Greenspun's Tenth (the replication of Lisp in 
other HLLs).

> 
> --------------
> 
> I don't like to write short replies... but there are messages going on
> in this thread that's going wild... i'll address a few shortly here.
> 
> John Thingstad is going wild stating that i confused “object” in OOP
> with “lisp's objects”. I have absolutely no idea how he construed
> that, honestly, absolutely no idea. In fact in one of my post i
> specifically, explicitly, stated that the 2 shouldn't be confused.
> Possibly he replied to Rainer's writings thinking it was mine.
> 
> The Jon Harrop character, although very informative, tends to spew
> taunting remarks selling his stuff. He's throwing a few bad mouthing
> of Mathematica, i may or may not retort. (one about how Mathematica
> doesn't have some beautiful static typing as his love OCaml, the other
> has some technical merits about how mathematica's “list” isnt
“true
> lists” but “vectors”. (very computer scientist-moronic, use of
> jargons))
> 
> The Rainer Joswig character, is a silly one. He replied to my
> messages, telling me to do some simple computations in Mathematica and
> pointing out some Mathematica do***entation to me, as to demonstrate
> some of his points. Did he miss the fact that i'm the world's top
> expert of Mathematica? Or is that not believed? If he belived, at
> least, that i have like 10 years of experience of actually programing
> in Mathematica, how could he think in such a way as if i didn't
> understand some detail in the manual? So, to infer further, perhaps
> any disagreement in our post must be attribute to other causes than my
> not understanding some aspect of Mathematica?
> 
> Rainer's posts, are often like this. Perhaps it's his personality or
> way of communication or thinking pattern.

If it helps, what I notice is the character-orientation of your summary. 
  eg, What happens if my last sentence instead was, "That summary is 
character-oriented?" You and I just disappeared, and the chance of 
interpersonal conflict diminishes. On those rare occasions when I am not 
actively making trouble here, I sometimes go back and rewrite so all the 
pronouns disappear. Fascinating exercise.

> ... sometimes i think perhaps i should be nicer to people or
> something. 

Ironically, that is hard for you because you are /too/ social an animal. 
The sociopath feels no connection to others and so can charm them into 
doing anything. Your thin skin (a great metaphor, btw) leaves you no way 
to keep people out, no way to shrug off those whose e-company you do not 
enjoy. In a sense, by reacting strongly to others you make their 
problems your problem, in that you cannot be comfortable as long as they 
are jerks. Not a recipe for contentment.

There are billions of people on this planet, put your energy into those 
you enjoy, not so much into those you do not. When your will weakens, 
well, hey, what's a killfile for? :)

> Oh well, the depths and mysteries and questions of life and
> living and cosmos...

You worried above about being a genius, here's something you might like. 
I got the idea from a bumper sticker, so you know it's good: "If you 
think you can do anything, try sailing." Made relevant, nothing is 
harder or more rewarding for folks like us than getting along with 
others. So if you think you are a genius, Xah, figure out how to get 
along with folks on Usenet. I'll give you a headstart from your roots: 
"Win without fighting."

kt

-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Con****ius
 




 1 Posts in Topic:
Re: the necessity of Lisp's Objects?
Ken Tilton <kennytilto  2008-01-23 13:44:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 17:05:53 CDT 2008.