(and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]

Xah Lee xahlee at gmail.com
Wed Sep 29 00:38:23 CEST 2010


On Sep 28, 12:07 pm, namekuseijin <namekusei... at gmail.com> wrote:
> On 28 set, 14:56, Xah Lee <xah... at gmail.com> wrote:
> > ultimately, all lang gets transformed at the compiler level to become
> > machine instructions, which is imperative programing in the ultimate
> > sense.
> > You say that “do” is merely macro and ultimately function application.
> > But to what level should we go down this chain on how the language
> > actually works when evaluating a function in source code?
> > any functional lang, quickly becomes imperative when compiled to some
> > intermediate code or interpreted. In a sense, it can't be any other
> > way. Functions are abstract mathematical ideas, while “do” loop or any
> > instruction are actual steps of algorithms.
> That is true as of Mathematica too.  Difference being that do in
> scheme is pretty-much user-level syntax.  If you look in most (good)
> implementations sources, do and let are defined in scheme itself, not
> C or lower-level:  C code only deals with transforming lambda
> application and tail calls into proper gotos.
> So, as far as we're talking about scheme, haskell or Mathematica code,
> it's all functional in its abstraction context.
> do syntax does allow for imperative commands to be issued in scheme,
> just like let.  It does not mean it was used in said examples nor that
> do is automatically inherently imperative just because of choice of
> name.  imperative do -> (do (steppers ...) (final-condition? result)
> malign-imperative-code-here ...)
> so, now that we got it clear why do in scheme is not (inherently)
> imperative why were you bashing useful (at times) functional syntax in
> the form of list comprehensions again?

le's get precise. The argument i want to make, is this:

• “list comprehension” is a very bad jargon; thus harmful to
functional programing or programing in general. Being a bad jargon, it
encourage mis-communication, mis-understanding.

• “list comprehension” is a redundant concept in programing. The
concept is of historical interest. e.g. when people talk about the
history of computer languages. The LC can simply be filter(map(func,
list), predicate).

• The special syntax of “list comprehension” as it exists in many
langs, are not necessary. It can simply be a plain function, e.g
LC(function, list, filter).

I gave a stand-alone explanation of these points at:

Do you disagree or agree with the above?

This is the point _I_ want to argue about, but you don't seem to admit
any part of it, but you seems to want to discuss about “do” in Scheme
lisp being functional.

So, perhaps we can now focus on this subject:

The “do” in Scheme lisp is not imperative, or, it can be considered as

Alright. To be honest, i haven't had enough experience to comment on,
but in general, i understand the example you've given, and i disagree.

Full report on your argument on this is given at:

Now, in your message (quoted above), you made further argument on
this. I think the main point is this, quote:

«do syntax does allow for imperative commands to be issued in scheme,
just like let.  It does not mean it was used in said examples nor that
do is automatically inherently imperative just because of choice of
name.  imperative do -> (do (steppers ...) (final-condition? result)
malign-imperative-code-here ...)»

i don't think your argument is forceful enough.

It appears that by this argument you even say that “let” is not

Here, the issue verges on what is functional? What is a function? If a
function in lisp is defined as macro, does it ceases to be considered
as a function? Likewise, if a lisp's has “for” loop that is defined as
a macro, is that “for” now considered a function?

this is getting quite iffy. What level or aspect are we considering?
In each lang, usually they define certain terms specifically to the
lang, and to various degree of precision. For eample, the term
“object” means very different things in a technical way in different
langs. Same for the word “function”, “keyword”, “command”, “module”,
“package” ...

So, overall, i consider your argument for “do” in Scheme lisp being
functional is weak, or trivial. It seems to be a pet peeve. You got
annoyed because i seem to have ignored it entirely. But i got annoyed
by you because you don't get the point about what i consider more
significant opinion on “list comprehension”, which you totally ignored
and kept at hacking the “do” in Scheme lisp.

 Xah ∑ xahlee.org ☄

More information about the Python-list mailing list