Python from Wise Guy's Viewpoint
prunesquallor at comcast.net
prunesquallor at comcast.net
Sat Oct 25 13:33:13 EDT 2003
gt5163b at prism.gatech.edu (Brian McNamara!) writes:
> "Marshall Spight" <mspight at dnai.com> once said:
>><prunesquallor at comcast.net> wrote in message news:wuaufe52.fsf at comcast.net...
>>> "Marshall Spight" <mspight at dnai.com> writes:
>>> > It would be really interesting to see a small but useful example
>>> > of a program that will not pass a statically typed language.
>>> > It seems to me that how easy it is to generate such programs
>>> > will be an interesting metric.
>>>
>>> Would this count?
>>>
>>> (defun noisy-apply (f arglist)
>>> (format t "I am now about to apply ~s to ~s" f arglist)
>>> (apply f arglist))
>>
>>Interesting, interesting. Thanks for taking me seriously!
>>
>>I'm trying to map this program into Java, and it's possible
> ...
>>Anyone have any comments?
>
> Well, in C++ you could say
>
> template <class F, class A>
> typename result_of<F(A)>::type
> noisy_apply( const F& f, const A& a ) {
> cout << "I am now about to apply " << f << " to " << a << endl;
> return f(a);
> }
>
I don't mean to nitpick, but APPLY takes an arbitrary list of arguments.
How do you parameterize over that without enumerating the power set
of potential types?
What if F `returns' void?
More information about the Python-list
mailing list