[Oberon] Re (2): Detecting whether a Text is a module source.
noreply at z505.com
Mon Jan 30 00:41:49 CET 2017
On Sun, January 29, 2017 11:31 am, eas lab wrote:
>> What is efficient code to find whether the word "Jaguar" is present
>> in a text for example?
> Efficient means minimal programming/maintenance effort,
> which also entails consideration of if/how to reuse the results later?
> More importantly: this is another example of where one should not be
> writing new code, from first principles. One should be using existing
> functions. Which is where piping and functional style comes in.
Oh for god's sake. You don't need functional programming, you just need to
pull in a module that already has a search Procedure
VAR Found: Boolean;
Found := Search("haystack.txt.", "needle");
IF Found THEN ....
This functional programming advocacy needs a real checking... it's like
this is 1943 and we've got a functional brown shirt here going out to the
farms telling people, with his functional programming patch on his arm
"you farmers should all be using functional programming because functions
can be reused like no other paradigm, even OOP!"
But I do agree with you that we should not reinvent the wheel and reinvent
a search algorithm when one already exists.
Unless you want to be creative and try to improve on search and invent
your own algorithm (without reinventing one from the 1970's).
More information about the Oberon