Python from Wise Guy's Viewpoint

prunesquallor at comcast.net prunesquallor at comcast.net
Sun Oct 26 00:17:54 EDT 2003


gt5163b at prism.gatech.edu (Brian McNamara!) writes:

> prunesquallor at comcast.net once said:
>>I think I have a stumper.  I'll be impressed if a type checker can
>>validate this.  The same-fringe function takes a pair of arbitrary
>>trees and lazily determines if they have the same leaf elements in the
>>same order.  Computation stops as soon as a difference is found so
>>that if one of the trees is infinite, it won't cause divergence.
>
> Laziness is pretty orthogonal to static typing.
>
> This one is so easy, we do it in C++ just for spite.  :)
> I'm using the FC++ library as a helper.
>
[snip]

Yuck!  Type declarations *everywhere*.  Where's this famous inference?

What's this LispCons type?  I don't have that in my source.  My code
is built of lambda abstractions.  I don't have a lispvalue type either.
And it isn't limited to integers in the list.  Where did my functions go?

And how can you compare a LispCons to an integer?

This works, but it doesn't faithfully represent what I wrote.
In addition, with all the type decorations, it only serves to reinforce
the idea the static type checking means a lot of extra keystrokes.






More information about the Python-list mailing list