A replacement for lambda

Tim Roberts timr at probo.com
Sat Jul 30 01:14:12 EDT 2005


Scott David Daniels <Scott.Daniels at Acm.Org> wrote:
>
>What kind of shenanigans must a parser go through to translate:
>     <x**2 with(x)><<x**3 with(x)>
>
>this is the comparison of two functions, but it looks like a left-
>shift on a function until the second with is encountered.  Then
>you need to backtrack to the shift and convert it to a pair of
>less-thans before you can successfully translate it.

C++ solves this exact problem quite reasonably by having a greedy
tokenizer.  Thus, that would always be a left shift operator.  To make it
less than and a function, insert a space:
    <x**2 with(x)>< <x**3 with(x)>
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list