Why is Python popular, while Lisp and Scheme aren't?
Jens Axel Søgaard
usenet at soegaard.net
Tue Nov 12 19:29:55 EST 2002
Andreas Leitgeb wrote:
Pascal:
>> If you are used to this kind of syntax, it's very simple. I don't
>> know enough Python (yet) in order to translate this, but in Java it
>> would look as follows.
>> 1 boolean buttonPressed (int slotId, Vector cardList) {
>> 2 return !(cardList.size() == 0) &&
>> 3 cardList.get(0).isVisible() &&
>> 4 ((slotId == 1) || (slotId > 5));
>> 5 }
>
> I'd have rewritten it differently (to show the point I was
> trying to make by calling the scheme-snippet ugly):
> 2 if (cardList.size() == 0) return false;
> 3 else if (!cardList.get(0).isVisible()) return false;
> 4 else return ((slotId == 1) || (slotId > 5));
> Now this doesn't make a big difference here, but it makes
> a lot of a difference, once, things get longer and deeper nested.
I find Pascal Constanzas version the easiest to read.
The if-then-else construction makes it hard to see
that it is boolean expression.
--
Jens Axel Søgaard
More information about the Python-list
mailing list