[Oberon] Small effort to add functional/piping ability ?

eas lab lab.eas at gmail.com
Tue May 15 18:38:52 CEST 2018

I've raised this point before, under the subject of functional-programming;
since the method of getting an answer by passing the data through multiple
stages is the essence of functional programming.

ETHO already uses this extensively, except that it's not yet automated:
the output/s go to ScreenFrames, which can be marked as the the input.
to the next stage of the <pipe>.

A somewhat contrived example is solving the intolerable situation
that ETHO doesn't show you the most recent files of a directory.

Imagine having a directory of 88 files, some of which are 2 years old,
and you want to continue with the project that you last worked on.
3 days ago.

Obviously you want immediate access to the most recent [say  6]
files which you <left on top of the work pile>.

System.Directory ^   Linux:*\d  gives  eg:...
Linux:Browser.Mod  19.05.1970 01:02:17   38540
Linux:C.Tool  04.05.2017 09:31:44    4372
Linux:Clipboard.Obj  04.11.2012 11:13:15    6677
Linux:CmprFiles  24.08.2017 21:00:37    1289
Under linux I've found that the most convenient listing format is:
FileSize : FileName
1454 : NeedPiping
49174 : oberon.log
1105 : NeedPiping.Bak
10485760 : oberon100321.dsk
1964988 : noname.eml
678 : oberon.cnf
48055 : HrOrderFuncts
and I vaguelly remember using ETHO's existing *FUNCTIONS* to do:
1. put the 2nd field to the front. ==
24.08.2017 Linux:CmprFiles 21:00:37    1289
2. rearange the date-strings. ==
3. sort the System.Directory lines using ETHO's existing function.
== file listing in recentcy order
4. output only the Size & Name fields.
== just show the size and FileName

So that's a 4stage-pipe.
The great advantage of functional/piping is the extreme modularity:
at any/every stage:N you only need be concerned about the output
of stage:N-1 and stage:N. Nothing else need be considered.

Since  ETHO already uses the manualy repeated 2 stage loop:
1.   Put Output:N-1 to  <F1 marked Frame>
2.   Take  <newly F1 marked Frame> as input to pipe-stage-N:
why can't we modify/extend this to be able to have  a syntax eg:
   <pipeSequenceCommand> <Argument> ?
eg. Pipe.ListRecentcyOrderedFiles  /sdc2/CRG/LNOspare/

Also our ET.Mod already can execute a sequence of M.P.
Adding the ability to have the text of stageN be the input of
stage(N+1) would give us functional/piping ability.

== crg

More information about the Oberon mailing list