Re: What is process_lines? and general complaint on the new manual
- Posted by lionel Jan 20, 2011
- 2023 views
It used to be that all functions required a return value, or else an error would be thrown. Now, when you call a function, you don't need a return value ... Kind of makes the procedure redundant ...
I see. May I ask the reasoning behind this change? Knowing nothing about language design, it's not obvious to me.
...
I am under the impression that process_lines() is like read_lines(), but with user-defined mojo. Like custom_sort() vs sort(). Do I assume correctly?
process_lines() and read_lines() work quite differently though and that's throwing me off. read_lines() returns a result sequence but process_lines() does not, I think.
I need an easier example. Let's say "namelist.txt" contains a list of names:
Amy Matt Robert Craig David Ali Joan Arthur Lee
and I want to extract and build a sequence of names that only begin with 'A'. Very simple. Would process_lines() be good here, and how do we do it?
Lionel