Re: What is process_lines? and general complaint on the new manual

new topic     » goto parent     » topic index » view thread      » older message » newer message
lionel said...
ChrisB said...

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.

often you will see the function return assigned to a VOID or JUNK object and then never used. sometimes it is simpler to just ignore the return of an error value.

the error return of process_list() is what the caller of the function decides it is. this would probably be used in a real program, but you can also observe the output of those 20 lines to decide if there were an error. but is just an example.

lionel said...

...

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 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?

filter() or build_list() could return such a modified sequence.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu