Hello python-list,<br><br>I decided to have some fun and altered a copy of python to use a Haskell-like syntax for declaring lambdas.<br><br>>>> filter( \ x -> x == 3 or x > 8 , [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] )
<br>[3, 9, 10]<br>>>> ( \-> "Hello World!" )()<br>'Hello World!'<br><br>While doing this I found something interesting while changing the grammar to :<br><br> old_lambdef: ( 'lambda' | '\\' ) [varargslist] ( ':' | '->' ) old_test
<br> ...<br> lambdef: ( 'lambda' | '\\' ) [varargslist] ( ':' | '->' ) test<br><br><br>In Parser/tokenizer.c, instead of needing to change only the PyToken_OneChar function to have a
<br> case '\\': return LAMBDAARGS;<br>option, I also had to add <br> case '\\':<br> switch (c2) {<br> case '\\': return LAMBDAARGS;<br> }
<br>to PyToken_TwoChars.<br><br>The interactive runtime requires the OneChar definition, and the compilation process ( specifically pgen ) requires the TwoChar definition.<br><br>If anyone wants the changes required to play around with it just email me and I'll find somewhere to stick them on the web for download.
<br><br>It seems a waste that whack acts only as an end of line continuance.<br><br>- Michael Speer<br><br>