× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Tue, Jan 12, 2010 at 8:54 PM, Hans Boldt <hans@xxxxxxxxxx> wrote:


You want to see how to code this using a yield in Python? OK:

-----------
def getNum(line):
   for n in line.split(","):
       yield int(n) if n.isdigit() else None

line = "123,213,33,3534"
for num in getNum(line):
   if num:
       print num
   else:
       print "item could not be parsed"
-----------

Frankly, I think Python has spoiled me. I look at C# code and I see
ugliness and cruft.

I like that Python code. If we can't get a fully working, documented
pre compiler in ILE, sure IBM should add "yield" to the new RPG.

As I understand it the difference between C# and Python is due to
dynamic vs static typing. There certainly is a ton of stuff you need
to learn to work in C#. I think the objective is to be able to write
composable code. Where functions are "side effect free" And objects
are immutable. New applications can actually be composed from a
hierarchy of individual/unit tested objects and methods. As has been
promised from the days of the first procedure with parameters.

an excellent lecture series on functional programming on the MSFT
channel 9 site:
http://channel9.msdn.com/shows/Going+Deep/C9-Lectures-Dr-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-13-of-13/

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.