When is Xah going to ease up on Emacs...

This is a discussion on When is Xah going to ease up on Emacs... within the lisp forums in Programming Languages category; xahlee@gmail.com wrote: > Frank Buss wrote: > There is only one interpretation of a leaf: It is a CONS with > cdr=nil. > > Not true. > > Recently there's a thread exactly on this. See > http://groups.google.com/group/comp....61883cabde5a84 > > I've given a detailed answer. See below: > > someone wrote: > > (setf bin-tree '(4 (2 1 3) (6 5 7))) > > Thus in my view the only fringe nodes (leaves) are 1, 3, 5, and 7. > You are right, there are many concepts how to build trees with lists. If you want just content ...

Go Back   Application Development Forum > Programming Languages > lisp

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
Reply

 

LinkBack Thread Tools Display Modes
  #11  
Old 08-23-2008, 08:03 AM
Frank Buss
Guest
 
Default Re: When is Xah going to ease up on Emacs...

xahlee@gmail.com wrote:

> Frank Buss wrote:
> There is only one interpretation of a leaf: It is a CONS with
> cdr=nil.
>
> Not true.
>
> Recently there's a thread exactly on this. See
> http://groups.google.com/group/comp....61883cabde5a84
>
> I've given a detailed answer. See below:
>
> someone wrote:
>
> (setf bin-tree '(4 (2 1 3) (6 5 7)))
>
> Thus in my view the only fringe nodes (leaves) are 1, 3, 5, and 7.
>


You are right, there are many concepts how to build trees with lists. If
you want just content in leafes and not nodes with children, there are more
compact representations.

> Now, consider this pseudo lisp: (4 (2 1 3) (6 5 7))
>
> which is closer to what you gave above. Now, the element at index {0}
> is 4, and at {1,0} is 2, and at {2,0} is 6.


This is still a binary tree? I don't understand the syntax {1,0}.

> (4 (2 1 3) (6 5 7))
>
> would not be a list datatype, however, the expression's structure is
> identical to the previous one, and still a tree. In this language,
> when the head of a expression does not have a valid definition, such
> as being a integer, it is simply left unevaluated.


You can achieve this in Common Lisp just with a quote in front of the list.
Not evaluating something which is not defined would not be very Lisp-like.
With Common Lisp you write what you mean. This prevents error like if you
have a spelling error and instead of an error, that a function is not
defined, with your concept it would silently ignored.

> So, in this lang, both
>
> (list (list 1 3) (list 5 7)) and (4 (2 1 3) (6 5 7))
>
> are valid expressions, and of identical structure. The expression
> itself represent a tree. The 2 expression can be easily transformed
> into each other, by simply doing a replacement of the atom list to
> one of integer, or vice versa. (e.g. replacing by pattern matching or
> actually apply a function to the head positions)


I don't see how it can be transformed. How does the transformer know that
the first "list" has to be replaced by "4"?

> Now, the thing about languages with a pure nested syntax is that, the
> head itself can be a nested expression. For example, you can have
>
> ((f x) 1 2 3)
>
> So, when you have a expression such as
>
> (x (y 1 3) (z 5 7))
>
> The indexes at {0}, {1,0}, {2,0}, i.e. the x, y, z, needs not to be
> atoms themselves. They can be arbitrary expressions (tree).
>
> So this means, in this language the head, or non-leaf nodes of a tree,
> can hold data, not just the leafs.
>
> In most lang that supports nested list, such as perl, php, python,
> only the leaf nodes holds data. But as you can see the above, in this
> lang with regular nested syntax, not only leaf nodes can hold data,
> but any node, including non-leaf nodes (heads), can hold arbitrarily
> nested data.


I don't understand this. With my proposal a Lisp list can do this, too. The
only limitation would be that a node can't hold a list as data, but this
could be solved by wrapping lists in a defstruct, or just adding one more
layer of lists for each node, or create your tree class library with CLOS,
if you really need it.

> In langs such as perl etc, assuming 1st element of list as non-leaf
> node is not a problem. But in lang with a purely nested syntax, by
> assuming the 1st element of list as non-leaf node, i think it
> necessarily introduces a more complex model of interpretation if you
> still want a isomorphism between the syntax, tree, and list datatype.


In Common Lisp not every list has to be evaluated, so I don't see a problem
doing the same in Lisp.

> Now, in lisp, because of the cons, combined with the fact that its
> syntax is irregular, truely, fucked up all the beauty and power of
> list processing.
>
> The problem of the cons business is well known. For example, your
> surprise at the various definition of leaf is just one Frequent
> puzzle. The other thing about its irregular syntax, such as
>
> '(1 2 3)
> (quote (1 2 3))
> (list 1 2 3)
>
> adds more complexity to the cons problem. For example, if you read
> again the above exposition about the isomorphism between the purely
> nested uniform syntax, tree, and list datatype, and try to apply it to
> Common Lisp, Emacs Lisp, or Scheme Lisp, you'll find all sort of
> problems, and really see how lisp is crippled, in the sense that it
> could have been far more consistent, simpler, powerful.
>
> The above pseudo lisp lang explanation is based on my knowledge of
> Mathematica. i.e. it is basically how Mathematica is.


Maybe the reason that I don't see the problem is that I know Common Lisp
and for me it looks logical. The syntax is very consise: If you evaluate a
list, the first element is always the function name and the rest are the
arguments. If you don't want to evaluate it, you quote it. Maybe Common
Lisp is not as orthogonal as it could be, e.g. you can't overload the
"+"-function to work with e.g. own defined CLOS classes (ok, you can, but
you have to shadow the system "+", and do some typecase switching in your
"+" function), but your (list 1 2 3) example is just the function "list",
called with 1 2 3. I don't see any irregularities with this.

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply With Quote
  #12  
Old 08-23-2008, 09:23 AM
xahlee@gmail.com
Guest
 
Default Re: When is Xah going to ease up on Emacs...

Hi Frank,

Frank wrote:
> > Now, consider this pseudo lisp: (4 (2 1 3) (6 5 7))
> > which is closer to what you gave above. Now, the element at index {0}
> > is 4, and at {1,0} is 2, and at {2,0} is 6.

>
> This is still a binary tree? I don't understand the syntax {1,0}.


See the 5 articles on trees here:

• Trees
http://xahlee.org/tree/tree.html

btw, just in the past 2 weeks there has been a thread with now over
100 messages. You can group.google.com it with string “Xah on Lisp”.

The thread basically cover everything we are discussing here. If you
don't care to wade thru the thread, i have actually culled all the
parts in these article:

• “The Concepts and Confusions of Prefix, Infix, Postfix and Fully
Functional Notations”
http://xahlee.org/UnixResource_dir/writ/notations.html

• Fundamental Problems of Lisp
http://xahlee.org/UnixResource_dir/w..._problems.html

btw, do you know any other functional language well? it would greatly
help if you know at least one other modern functional lang well. e.g.
haskell, ocmal, erlang, etc. It can greatly aid in your views to lisp.

Xah
http://xahlee.org/



Reply With Quote
  #13  
Old 08-23-2008, 10:33 AM
Marco Antoniotti
Guest
 
Default Re: When is Xah going to ease up on Emacs...

On Aug 23, 6:40*am, Ali <emailalicl...@gmail.com> wrote:
> On Aug 16, 12:26*pm, "xah...@gmail.com" <xah...@gmail.com> wrote:
>
> > You as a critic, complains that fons is bad. But then some brainless
> > gisp fan retort by saying: If you don't like fons, gist has cons,
> > too..

>
> I'm afraid
>
> cons / array
>
> is in no way analagous to
>
> fons / cons
>
> Besides, in other languages I find myself generally using one of
> x[0], x[i], or x[x.length]
>
> These methods of list usage are possible with cons-based lists too,
> without using *any* car's or cdr's!
>
> (nth 0 x), (nth i x), (nth (length x) x)
>
> although generally, you could use...
>
> (first x) (nth i x) (last x)


Careful. LAST is the last CONS of a list.

Cheers
--
Marco





> Your car and cdr problems solved. God I'm a genius.


Reply With Quote
  #14  
Old 08-23-2008, 08:37 PM
Ali
Guest
 
Default Re: When is Xah going to ease up on Emacs...

> Careful. *LAST is the last CONS of a list.

Oh dammit, thanks.

Even so, it is still not true that lisp

"forces programer to think of list in a low-level nested of 2-item
construction"

Because one can still access the elements directly through these
means, just as might be done in other languages.

(defun end (x)
(first (last x)))

(first x) (nth i x) (end x)
Reply With Quote
  #15  
Old 08-23-2008, 09:09 PM
Kenny
Guest
 
Default Re: When is Xah going to ease up on Emacs...

Ali wrote:
>>Careful. LAST is the last CONS of a list.

>
>
> Oh dammit, thanks.
>
> Even so, it is still not true that lisp
>
> "forces programer to think of list in a low-level nested of 2-item
> construction"


Good luck to anyone trying to program lisp without a profound
understanding of cons. Lotsa times one can get by without that
understanding but lotsa aint enough to write software.

kt
Reply With Quote
  #16  
Old 08-24-2008, 03:18 AM
Frank Buss
Guest
 
Default Re: When is Xah going to ease up on Emacs...

xahlee@gmail.com wrote:

> The thread basically cover everything we are discussing here. If you
> don't care to wade thru the thread, i have actually culled all the
> parts in these article:
>
> E The Concepts and Confusions of Prefix, Infix, Postfix and Fully
> Functional Notations
> http://xahlee.org/UnixResource_dir/writ/notations.html


I don't see how this is related to the problems with trees you wrote about.
Some points from your article:

| (1) Some 99% of programers are not used to the nested parenthesis syntax.
| This is a practical problem. On this aspect along, lisp's syntax can be
| considered a problem.
|
| (2) Arguably, the pure nested syntax is not natural for human to read. Long
| time lispers may disagree on this point.

I disagree on this points :-)

| (3) Most importantly, a pure nested syntax discourages frequent or advanced
| use of function sequencing or compositions. This aspect is the most
| devastating.

If you like, you can write your own compose funcion in Common Lisp to make
it easier to write and read long compositions:

http://www.bookshelf.jp/texi/onlisp/onlisp_6.html

But it is not as nice as e.g. in Haskell.

> E Fundamental Problems of Lisp
> http://xahlee.org/UnixResource_dir/w..._problems.html


Same problem: You don't like some constructs like ",@" etc. in Lisp. These
are just abbreviation, you can write anything in the usual prefix form.
E.g. this macro:

(defmacro one (x) `(1+ ,x))

can be written like this:

(defmacro one (x) (list (quote 1+) x))

So you are right, there are irregularities in the syntax, but it's just for
lazy programmers :-)

> btw, do you know any other functional language well? it would greatly
> help if you know at least one other modern functional lang well. e.g.
> haskell, ocmal, erlang, etc. It can greatly aid in your views to lisp.


I know a bit of Haskell, e.g. I've written some small demo programs to
understand the language, like this one:

http://www.frank-buss.de/haskell/OlympicRings2.hs.txt

which produces this image:

http://www.frank-buss.de/haskell/OlympicRings2.png

But currently I'm using JavaScript a bit more, which is a nice prototype
based language (I don't understand why they moved toward Java classes with
the new ActionScript 3 in Adobe Flash, but fortunately nearly every browser
still knows the real prototype based JavaScript, and there are open source
ECMA Script interpreters). It can be considered as a functional language,
because it has closures and supports higher-order functions. My latest
JavaScript program is an interpreter for the language COW:

http://www.frank-buss.de/cow.html

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply With Quote
  #17  
Old 08-24-2008, 05:49 PM
xahlee@gmail.com
Guest
 
Default Re: When is Xah going to ease up on Emacs...

Dear Frank,

On Aug 24, 12:18 am, Frank Buss <f...@frank-buss.de> wrote:
> > ‧ Fundamental Problems of Lisp
> > http://xahlee.org/UnixResource_dir/w..._problems.html

>
> Same problem: You don't like some constructs like ",@" etc. in Lisp. These
> are just abbreviation, you can write anything in the usual prefix form.
> E.g. this macro:
>
> (defmacro one (x) `(1+ ,x))
>
> can be written like this:
>
> (defmacro one (x) (list (quote 1+) x))
>
> So you are right, there are irregularities in the syntax, but it's just for
> lazy programmers :-)


the issue is about design consistency, is not about whether sugar
syntax are convenient.

For example, this sugar syntax:
“'(1 2 3)”
for
“(quote (1 2 3))”

can be designed alternatively like this:
“(' (1 2 3))”

which keeps lisp's regular form (f args).

This issue is emphasize in the article, and as well as a FAQ item in
the article. Please read the article carefully!

-------------------
Frank wrote:
«
I know a bit of Haskell, e.g. I've written some small demo programs
to
understand the language, like this one:
http://www.frank-buss.de/haskell/OlympicRings2.hs.txt
which produces this image:
http://www.frank-buss.de/haskell/OlympicRings2.png
»

Nice. Btw, what graphics system you used?

i recall now you are the one who did this algorithmic artwork:

http://www.frank-buss.de/lisp/functional.html

What graphics systems did you use on these? I mean, in Mathematica,
the graphics system is build in, where the lang has geometry
primitives and the editor can display them.

In perl, python, and other lang, i can produce graphics by generating
string that is basically the povray file. Then use povray to display
them.

but i'm interested in other such systems... could you give some
detail?

thanks.

(i tried to access
http://www.ecs.soton.ac.uk/%7Eph/papers/funcgeo2.pdf
but it seems down? or extremely slow
)

PS also, a good priciple in web design is to have a link to the index,
or some nav bar, else each of the page or article is a island...

Xah
http://xahlee.org/



Reply With Quote
  #18  
Old 08-24-2008, 07:13 PM
Cor Gest
Guest
 
Default Re: When is Xah going to ease up on Emacs...

Some entity, AKA "xahlee@gmail.com" <xahlee@gmail.com>,
wrote this mindboggling stuff:
(selectively-snipped-or-not-p)

>> So you are right, there are irregularities in the syntax, but it's just for
>> lazy programmers :-)

>
> the issue is about design consistency, is not about whether sugar
> syntax are convenient.


If you don't like it, rewrite the stuff, load it in your own
lisp-image as xahs-facistoid-syntax-reader.lisp and use it.
But do never ever come complaining here again, 'ya hear.

On the other hand you might try to bribe de whole ANSI committee to
change the specification, this might have a chance since it is rumoured
that something similar was done to ISO.

Cor
--
Mijn Tools zijn zo modern dat ze allemaal eindigen op 'saurus'
(defvar My-Computer '((OS . "GNU/Emacs") (IPL . "GNU/Linux")))
SPAM DELENDA EST http://www.clsnet.nl/mail.php
1st Law of surviving armed conflict : Have a gun !
Reply With Quote
  #19  
Old 08-25-2008, 02:31 AM
Frank Buss
Guest
 
Default Re: When is Xah going to ease up on Emacs...

xahlee@gmail.com wrote:

> the issue is about design consistency, is not about whether sugar
> syntax are convenient.
>
> For example, this sugar syntax:
> '(1 2 3)
> for
> (quote (1 2 3))
>
> can be designed alternatively like this:
> (' (1 2 3))
>
> which keeps lisp's regular form (f args).


But this wouldn't be very sweet syntactic sugar. Maybe you should try to
use Lisp for a larger project yourself to see if it is usable. I think the
way how ' is defined helps to write and read Lisp code. But you can change
the Lisp reader, if you don't like it and create your own syntax.

> Frank wrote:
>
> I know a bit of Haskell, e.g. I've written some small demo programs
> to
> understand the language, like this one:
> http://www.frank-buss.de/haskell/OlympicRings2.hs.txt
> which produces this image:
> http://www.frank-buss.de/haskell/OlympicRings2.png
>
>
> Nice. Btw, what graphics system you used?


I created my own TGA image write functions. It is included in the 129 lines
source code.

> i recall now you are the one who did this algorithmic artwork:
>
> http://www.frank-buss.de/lisp/functional.html
>
> What graphics systems did you use on these?


Postscript. See the end of the webpage.

> I mean, in Mathematica,
> the graphics system is build in, where the lang has geometry
> primitives and the editor can display them.
>
> In perl, python, and other lang, i can produce graphics by generating
> string that is basically the povray file. Then use povray to display
> them.
>
> but i'm interested in other such systems... could you give some
> detail?


For this page:

http://www.frank-buss.de/lisp/texture.html

I wrote a simple system, called CL-Canvas. It is just a canves, where I can
draw on, even interactivly from the REPL. But it works on Windows, only.
Nowadays I would use the SDL packages of the Application Builder project (
http://www.lispbuilder.org ), which I initiated some time ago.

> (i tried to access
> http://www.ecs.soton.ac.uk/%7Eph/papers/funcgeo2.pdf
> but it seems down? or extremely slow


Works for me, but I'm using Foxit Reader as an external program for reading
PDF documents. If you use Adobe PDF Reader, sometimes it tries to load the
file in parts with very many short requests, which can cause longer delays
than just loading the file with one request. You can try right click and
"save as" to save the file as one file, then open it locally.

> PS also, a good priciple in web design is to have a link to the index,
> or some nav bar, else each of the page or article is a island...


Yes. Now I just have to solve my laziness and time problems :-)

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply With Quote
  #20  
Old 08-25-2008, 02:51 AM
Pascal J. Bourguignon
Guest
 
Default Re: When is Xah going to ease up on Emacs...

Frank Buss <fb@frank-buss.de> writes:

> xahlee@gmail.com wrote:
>
>> the issue is about design consistency, is not about whether sugar
>> syntax are convenient.
>>
>> For example, this sugar syntax:
>> “'(1 2 3)”
>> for
>> “(quote (1 2 3))”
>>
>> can be designed alternatively like this:
>> “(' (1 2 3))”
>>
>> which keeps lisp's regular form (f args).

>
> But this wouldn't be very sweet syntactic sugar.


Doesn't matter. All these complains should be sent to the authors of
LISP. That is, 50 years back in time. Setting up a web site or
bothering cll today is idiotic. Xah needs a time machine!



--
__Pascal Bourguignon__ http://www.informatimago.com/

ADVISORY: There is an extremely small but nonzero chance that,
through a process known as "tunneling," this product may
spontaneously disappear from its present location and reappear at
any random place in the universe, including your neighbor's
domicile. The manufacturer will not be responsible for any damages
or inconveniences that may result.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 01:17 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.