Any advantage in LISPs having simpler grammars than Python?
Douglas Alan
nessus at mit.edu
Wed Mar 8 16:58:07 EST 2006
"Carl Banks" <invalidemail at aerojockey.com> writes:
> Douglas Alan wrote:
>
>> For instance, if Python were to have been designed so that you would
>> write:
>>
>> let myVeryLongVariableName = 3
>>
>> I would have preferred this over
>>
>> myVeryLongVariableName = 3
>>
>> With the latter, I have to scan down the line to see that this line is
>> in an assignment statement.
>
> Interesting. I always found that the visual distinctness of non-Lisp
> programs made it easier to scan. For example, in Python I could blur my
> eyes such that I can't positively identify the letters, but could still
> tell an assignment from a function call from a mathemetical expression;
> not so easy in LISP where expressions are visually similar.
Hey, well I designed my own programming language "Drawl" that combines
the best of both worlds. A sample program in Drawl would look
something like this:
proc mostApplicableMethods (g args)
let appMethods = (filter [lambda (met) (mcProtoMetApp? met lex:args)]
(funMets g))
let nMets = (len appMethods)
if nMets = 1; appMethods
elif nMets = 0; %{}
else let retval = {}
for i in (range nMets)
let m1 = appMethods[i]
for m2 in retval + appMethods[i+1..inf]
if (isCongruentTo? m2 m1); break
else (append list=retval ele=m1)
retval
This would correspond to the following Python code:
def mostApplicableMethods(g, args):
appMethods = filter(lambda met: isMcProtoMetApp(met, args),
funMets(g))
nMets = len(appMethods)
if nMets == 1: return appMethods
elif nMets == 0: return ()
else:
retval = []
for i in range(nMets):
m1 = appMethods[i]
for m2 in retval + appMethods[i+1:]:
if isCongruentTo(m2, m1): break
else: retval.append(m1)
return retval
In Drawl all expressions are either functions calls that begin with a
"(" and are Lisp-like, or they are mathematical infix expressions.
Statements and macros, on the other hand, always begin with an
identifier that identifies the statement or macro. The exception to
what I just said is that statements and macros can be turned into
expressions by surrounding them with square brackets.
Too bad I never got around to actually implementing Drawl, though,
because we all know that what the world needs right now is another
programming language....
|>oug
More information about the Python-list
mailing list