Functional programming style for Oberon?
Some years ago when the OO-paradigm was at it's peek, ETHO was extended to handle procedure types, which could be passed as arguments. There's great advantages in avoiding temporary-fads, so I never exercised OOP. Now [using LEO] that it's less easy to access my old NativeOberon files, I failed to find the documentation, and example uses of the <passing PROCs as arguments>. Where should I look? Can Oberon procedure types facilitate the <functional/compositional> style of programming? Which is NOT a passing fad. *nix's <piping of functions/data-transformers> is staggeringly economical in user's effort, but has a terrible syntax. The benefit of removing the need to learn ad-hoc syntaxS is my motivation for syntax-directed-editors & menu-driven-usage: which ETHO already used successfully. An example of *nix's ability to easily get results by piping a sequence of existing/proven/well-tested functions together [but using understand-able syntax] is:-- CheckTheFileDataBaseForFilesNamed *roc*ointer* | ButSkipAllFiles *.pdf *.zip *.ps *.gz | AndListThoseContainingString "beron" The big advantage of this functioal/compositional style is the maintainablity. Which is the whole idea of NW's "MODUL"a and "COMPONENT" pascal. Some years ago, when my then ISP introduced Sender-must-ID for email, it was quite a job to modify the ETHO <emailer>. Now there's a new-fad which messes my TextToSpeech facility: instead of 'saying' "can't", it says "Sea Aye Enn Tea"; because many feature/fad-following clowns are replacing the one-byte single-quote [ASCII] by 3 bytes. Since the substantial processing-stages of fetching [unfortunately these days http-formatted] text, visually scanning it to wipe-out <bad sections> by an ETHO-like editor, and getting the TestToSpeech to a device, as a suitably-named file, needs only a few mouse-chords and typing the chosen name, you don't need to understand the details of each stage. So you can just plug-a-function-into-the-pipe-line to: <translate the 3-byte-quote-fad to ASCII(SingleQuote)>. Which just needs pasting from your library of examples, a 10 char line, and editing/modifying it; into the suitable pipe-line position. That's why I call it MickeyMouse programming. A most convincing argument, for me, for the functional style, is:-- Let's create a list of all even numbers up to 100, and another list omitting the first five of them. The program written in Java. final int LIMIT=50;int[] a = new int[LIMIT]; int[] b = new int[LIMIT - 5]; for (int i=0;i < LIMIT;i++) { a[i] = (i+1)*2; if (i >=5) b[i - 5] = a[i]; } The program written in ### let a = [2,4..100] let b = drop 5 a It is immediately clear that with ###, you can understand what's going on; whereas in Java, or any imperative language, you can barely tell what the code is supposed to do because you are overwhelmed with the low-level minutia. This effect increases as programs grow more complex. From this simplicity and abstraction flow most of ###'s advantages. ----------------------------- end of extract. -------------------- ### <- let's not get stuck on NAMES. Let's rather first understand the CONCEPTS. Of course, the above is an extreme example, but ETHO's already existing facilities could perhaps do: MapFunctionOverElements(DigitToText:PROC, DigitSequence: TextString):TextString; MapFunctionOverElements(TestForPrime:PROC, Ints1toN: IntegerList):IntegerList; There's nothing new about this. Extracting from McCarthy [designed lisp in 60s?]:- These three procedures clearly share a common underlying pattern. They are for the most part identical, differing only in the name of the procedure, the function/job of a used to compute the term to be added, and the function that provides the next value of a. We could generate each of the procedures by filling in slots in the same template: ------ snip lisp code --- The presence of such a common pattern is strong evidence that there is a useful abstraction waiting to be brought to the surface. Indeed, mathematicians long ago identified the abstraction of summation of a series and invented ``sigma notation,'' to express this concept. The power of sigma notation is that it allows mathematicians to deal with the concept of summation itself rather than only with particular sums -- for example, to formulate general results about sums that are independent of the particular series being summed ... What are unforeseen problems in using ETHO to do this too? == Chris Glur. PS. it's very problematic pasting the pre-written text into the web-browser for gmail [designed for F/B-twitter kiddies=modern] compare to the 90's N-O emailer. Can Linux:Aos handle gmail?
Cris, what an excellent excuse to evade the truth of our existence: We WILL NOT LEARN! :) To me a programming language is a tool to convince the hardware into doing something useful. When it tries to do more than that I have a terrible itch to dump it. So yes sometimes i have found use for OO, sometimes I have found use for functional programming, and sometimes I shot myself in the foot with either of them because I thought I did not have to LEARN; the language paradigm would do the job for me. hahaha. For Oberon section 6.6.1 in the green book sums up everything there is to learn to be able to do functional programming in Oberon. You are free to expand on that and make your own library Modules. After all Robert Dewar did a SPITbol package for Ada. (Look up Snobol in wikipedia) and it is very nifty. Although at first sight Ada's paradigm and Snobol's paradigm are eons apart. And here is the weekend laugh: http://www-users.cs.york.ac.uk/susan/joke/foot.htm Cheers, j. On Sat, Oct 17, 2015 at 8:40 AM, eas lab <lab.eas@gmail.com> wrote:
Some years ago when the OO-paradigm was at it's peek, ETHO was extended to handle procedure types, which could be passed as arguments.
There's great advantages in avoiding temporary-fads, so I never exercised OOP. Now [using LEO] that it's less easy to access my old NativeOberon files, I failed to find the documentation, and example uses of the <passing PROCs as arguments>.
Where should I look?
Can Oberon procedure types facilitate the <functional/compositional> style of programming? Which is NOT a passing fad.
*nix's <piping of functions/data-transformers> is staggeringly economical in user's effort, but has a terrible syntax.
The benefit of removing the need to learn ad-hoc syntaxS is my motivation for syntax-directed-editors & menu-driven-usage: which ETHO already used successfully.
An example of *nix's ability to easily get results by piping a sequence of existing/proven/well-tested functions together [but using understand-able syntax] is:--
CheckTheFileDataBaseForFilesNamed *roc*ointer* | ButSkipAllFiles *.pdf *.zip *.ps *.gz | AndListThoseContainingString "beron"
The big advantage of this functioal/compositional style is the maintainablity. Which is the whole idea of NW's "MODUL"a and "COMPONENT" pascal.
Some years ago, when my then ISP introduced Sender-must-ID for email, it was quite a job to modify the ETHO <emailer>.
Now there's a new-fad which messes my TextToSpeech facility: instead of 'saying' "can't", it says "Sea Aye Enn Tea"; because many feature/fad-following clowns are replacing the one-byte single-quote [ASCII] by 3 bytes.
Since the substantial processing-stages of fetching [unfortunately these days http-formatted] text, visually scanning it to wipe-out <bad sections> by an ETHO-like editor, and getting the TestToSpeech to a device, as a suitably-named file, needs only a few mouse-chords and typing the chosen name, you don't need to understand the details of each stage.
So you can just plug-a-function-into-the-pipe-line to: <translate the 3-byte-quote-fad to ASCII(SingleQuote)>.
Which just needs pasting from your library of examples, a 10 char line, and editing/modifying it; into the suitable pipe-line position.
That's why I call it MickeyMouse programming.
A most convincing argument, for me, for the functional style, is:--
Let's create a list of all even numbers up to 100, and another list omitting the first five of them.
The program written in Java.
final int LIMIT=50;int[] a = new int[LIMIT]; int[] b = new int[LIMIT - 5]; for (int i=0;i < LIMIT;i++) { a[i] = (i+1)*2; if (i >=5) b[i - 5] = a[i]; }
The program written in ###
let a = [2,4..100] let b = drop 5 a
It is immediately clear that with ###, you can understand what's going on; whereas in Java, or any imperative language, you can barely tell what the code is supposed to do because you are overwhelmed with the low-level minutia. This effect increases as programs grow more complex. From this simplicity and abstraction flow most of ###'s advantages. ----------------------------- end of extract. -------------------- ### <- let's not get stuck on NAMES. Let's rather first understand the CONCEPTS. Of course, the above is an extreme example, but ETHO's already existing facilities could perhaps do:
MapFunctionOverElements(DigitToText:PROC, DigitSequence: TextString):TextString;
MapFunctionOverElements(TestForPrime:PROC, Ints1toN: IntegerList):IntegerList;
There's nothing new about this. Extracting from McCarthy [designed lisp in 60s?]:- These three procedures clearly share a common underlying pattern. They are for the most part identical, differing only in the name of the procedure, the function/job of a used to compute the term to be added, and the function that provides the next value of a. We could generate each of the procedures by filling in slots in the same template: ------ snip lisp code --- The presence of such a common pattern is strong evidence that there is a useful abstraction waiting to be brought to the surface. Indeed, mathematicians long ago identified the abstraction of summation of a series and invented ``sigma notation,'' to express this concept. The power of sigma notation is that it allows mathematicians to deal with the concept of summation itself rather than only with particular sums -- for example, to formulate general results about sums that are independent of the particular series being summed ...
What are unforeseen problems in using ETHO to do this too?
== Chris Glur.
PS. it's very problematic pasting the pre-written text into the web-browser for gmail [designed for F/B-twitter kiddies=modern] compare to the 90's N-O emailer. Can Linux:Aos handle gmail? -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
]For Oberon section 6.6.1 in the green book sums up everything there is to learn to be able to do ]functional programming in Oberon. My oberon/docu/Chapter6.Text goes up to: 6.5.3 Oberon System 3 for Linu... Please give URL of <green book> == TIA.
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of eas lab Sent: Friday, 23 October 2015 12:22 PM To: ETH Oberon and related systems Subject: Re: [Oberon] Functional programming style for Oberon?
]For Oberon section 6.6.1 in the green book sums up everything there is to learn to be able to do ]functional programming in Oberon.
My oberon/docu/Chapter6.Text goes up to: 6.5.3 Oberon System 3 for Linu...
Please give URL of <green book>
There were three Oberon books (a.k.a. the "Oberon Trilogy") published by Addison Wesley / ACM Press in the early days of Oberon (about 1992). The 'green book' (the colour of its cover) is "Programming in Oberon - Steps Beyond Pascal and Modula" by Martin Reiser and Niklaus Wirth. You can download a copy from: http://www.ethoberon.ethz.ch/WirthPubl/ProgInOberonWR.pdf Section 6.6 is "More on function procedures" Section 6.6.1 is "Side-effects" Regards, Chris Burrows CFB Software http://www.astrobe.com
OK, thanks. Pity that it's a <photograph> else I could TextToSpeech parts while lying down. "functional programming" is very different from our "imperative programming". ETHO's HUmanComputerInterface allows each-step-of-the-pipe/chain to be done manually, by depositing the intermediate results in a new TextFrame. Here's a real sequence that I needed to do earlier today, and could be done in a functional/piping system - at least partially. Goal: Find what Oberon-V4 tells about that <macroKeys> system, named *Key* System.Execute locate Key | grep beron | grep V4 .....can't continue test/demo... I normally write the report in LEO *WHILE* I test & log the code. Now I'm writing straight to this crappy gmail, which prevents a valid demo..... Every thing else is lame compared to LEO !! On 10/23/15, Chris Burrows <chris@cfbsoftware.com> wrote:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of eas lab Sent: Friday, 23 October 2015 12:22 PM To: ETH Oberon and related systems Subject: Re: [Oberon] Functional programming style for Oberon?
]For Oberon section 6.6.1 in the green book sums up everything there is to learn to be able to do ]functional programming in Oberon.
My oberon/docu/Chapter6.Text goes up to: 6.5.3 Oberon System 3 for Linu...
Please give URL of <green book>
There were three Oberon books (a.k.a. the "Oberon Trilogy") published by Addison Wesley / ACM Press in the early days of Oberon (about 1992). The 'green book' (the colour of its cover) is "Programming in Oberon - Steps Beyond Pascal and Modula" by Martin Reiser and Niklaus Wirth.
You can download a copy from:
http://www.ethoberon.ethz.ch/WirthPubl/ProgInOberonWR.pdf
Section 6.6 is "More on function procedures"
Section 6.6.1 is "Side-effects"
Regards,
Chris Burrows CFB Software http://www.astrobe.com
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
OK, thanks. Pity that it's a <photograph> else I could TextToSpeech parts while lying down.
FWIW, https://www.inf.ethz.ch/personal/wirth/Oberon/PIO.pdf has a more recent version of Programming in Oberon where the PDF is created directly from text (rather than scanned as a bitmap ) but it's very different from the green book that was written with Reiser. HTH Paul
Thanks. Since I started using ETHO a 'while back', [when my ISP said I couldn't use Win3.1 and must buy W95] I'm more interested in extending its facilities. How many of you know about the astounding [decades old] EditKeys.Tool ? You just type: Suitablename: M and hit <InsertKey> and your "Suitablename: M" is replaced by: MODULE Suitablename; .. <rest of syntactically valid template> END Suitablename. Recursively, after eg. Proc'sName:P entering<Insert> replaces <that line> with the syntactically valid <Proc Template>. Unfortunately this brilliant macroTool, mostly just intends to remember the syntax for you. The other MORE IMPORTANT function of a menu-system, is missing: that it replaces the need to remember by the ability to RECOGNISE. Which is related to functional composition modularity: economy of mental effort. ETHO is already partly on the way to being able to do functional/compositional/ piping style programming. [by manually passing the data through a sequence of textFrame]. So my "functional query" won't be found in historic Oberon literature. EditKeys comes into the picture, since when you investigate your Nth language, eg. Haskell [or see 'trankvila' mentioned in USEnet c.l.oberon and claiming to be Oberon related] you don't want to *LEARN AGAIN*. You'd better just put this next-new language to your existing smartMacro/SyntaxAwareEditor and test/use it. And you will learn the syntax by usage -- as a child does. == Chris Glur. On 10/24/15, Paul Reed <paulreed@paddedcell.com> wrote:
OK, thanks. Pity that it's a <photograph> else I could TextToSpeech parts while lying down.
FWIW, https://www.inf.ethz.ch/personal/wirth/Oberon/PIO.pdf has a more recent version of Programming in Oberon where the PDF is created directly from text (rather than scanned as a bitmap ) but it's very different from the green book that was written with Reiser.
HTH Paul
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
LEO - where? I.e., where can i download it? (And what is it's alias if it has one) On 10/24/15, eas lab <lab.eas@gmail.com> wrote:
OK, thanks. Pity that it's a <photograph> else I could TextToSpeech parts while lying down.
"functional programming" is very different from our "imperative programming".
ETHO's HUmanComputerInterface allows each-step-of-the-pipe/chain to be done manually, by depositing the intermediate results in a new TextFrame.
Here's a real sequence that I needed to do earlier today, and could be done in a functional/piping system - at least partially.
Goal: Find what Oberon-V4 tells about that <macroKeys> system, named *Key* System.Execute locate Key | grep beron | grep V4 .....can't continue test/demo...
I normally write the report in LEO *WHILE* I test & log the code. Now I'm writing straight to this crappy gmail, which prevents a valid demo.....
Every thing else is lame compared to LEO !!
On 10/23/15, Chris Burrows <chris@cfbsoftware.com> wrote:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of eas lab Sent: Friday, 23 October 2015 12:22 PM To: ETH Oberon and related systems Subject: Re: [Oberon] Functional programming style for Oberon?
]For Oberon section 6.6.1 in the green book sums up everything there is to learn to be able to do ]functional programming in Oberon.
My oberon/docu/Chapter6.Text goes up to: 6.5.3 Oberon System 3 for Linu...
Please give URL of <green book>
There were three Oberon books (a.k.a. the "Oberon Trilogy") published by Addison Wesley / ACM Press in the early days of Oberon (about 1992). The 'green book' (the colour of its cover) is "Programming in Oberon - Steps Beyond Pascal and Modula" by Martin Reiser and Niklaus Wirth.
You can download a copy from:
http://www.ethoberon.ethz.ch/WirthPubl/ProgInOberonWR.pdf
Section 6.6 is "More on function procedures"
Section 6.6.1 is "Side-effects"
Regards,
Chris Burrows CFB Software http://www.astrobe.com
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
LEO - where? I.e., where can i download it? (And what is it's alias if it has one)
"walk with me" while I [show how to] fetch the answer to your question.. On one of the original [at boot time] TextFrames I can see: ETH Oberon (2.4.3) for Linux x86 which I just pasted here. Being interested to see the size of the <install-archive>, I use LEO's ability to execute *nix commands, and guess at: System.Execute locate beron | grep tgz which gives me a dozen lines, where I recognise: /mnt/hdc6/home/Debug/ThreadObn/Unix_Oberon_r243_Src.tgz /mnt/hdc11/ETHZ/UnixAos/Unix_Oberon_r243_Src.tgz /mnt/DebDVD1bak/p11v/ETHforum/LEO/Unix_Oberon_r24_Src.tgz Why have I got duplicate copies? And these are the <source archives>; not what I want. But lets see their sizes: directly instead of via *nix: System.Directory /mnt/hdc6/home/Debug/ThreadObn/Unix_Oberon_r243_Src.tgz\d == 08.02.2009 05:36:42 3492833 System.Directory /mnt/hdc11/ETHZ/UnixAos/Unix_Oberon_r243_Src.tgz\d == 08.01.2013 07:46:16 3492833 So I've got an unintended duplicate. Of course you don't type-in these long FileID's.; you just paste. Let's try: System.Execute locate "Unix_Oberon" Not good: the same 3. Let's try: System.Execute locate beron | grep nix That's many, and the probable target is: /mnt/DebDVD1bak/p11v/ETHforum/LEO/Unix_Oberon_r24_Src.tgz\d Importantly, all this navigation is on the same screen, without <turning over pages, and losing your place/focus>. To see the size, just paste "System.Directory \d" == 31.01.2013 22:38:39 3234358 So the size is 3M2. Now for the fetch URL ? That's probably listed in the same dir, so try: System.Execute grep http /mnt/DebDVD1bak/p11v/ETHforum/LEO/* which leads to: http://www.informatik.uni-bremen.de/~fld/UnixOberon/x86.Linux/Readme.txt So the URL is: http://www.informatik.uni-bremen.de/~fld But there's probably a <README> in that Dir; so try: System.Directory /mnt/DebDVD1bak/p11v/ETHforum/LEO/* and /mnt/DebDVD1bak/p11v/ETHforum/LEO/Log probably shows how/when I fetched it. No; let's klik-on /mnt/DebDVD1bak/p11v/ETHforum/LEO/LEOdir ==>ftp://ftp.ethoberon.ethz.ch/ETHOberon/Unix/x86.Linux/ -rw-r--r-- 1 ftp ftp 2519 Nov 22 2004 Readme.txt -rw-r--r-- 1 ftp ftp 3234358 Nov 22 2004 Unix_Oberon_r24_Src.tgz -rwxr-xr-x 1 ftp ftp 492 Sep 20 2000 inst.oberon -rw-r--r-- 1 ftp ftp 10545812 Nov 22 2004 x86_Linux_Oberon_r24_Sys .tgz "Sources = Unix_Oberon_r24_Src.tgz" == 3'234'358 -------------- It's pointless for me to pretend that I just *KNOW* the answer, rather than demonstrate how you must WORK with LEO, to get it ? == Chris Glur. NB. very little of this text was typed in; it's mostly just pasted.
eas lab wrote:
"functional programming" is very different from our "imperative programming".
You've been sold a lie by the religious cult known as functional programmers. It's not that different at all really. What ends up happening is all sorts of side effects are required for the functional program to actually do something useful, i.e. haskell Monads.... There is NO scientific proof whatsoever that ramming a bunch of side effects into monads makes it better than having the side effects like "writeln()" right there in a pascal program or cout() in a c program. At some point you have to deal with side effects sooner or later and delaying it until the last minute so that your program does absolutely nothing until it hits the "monads" section is kind of like shoving all your code into one long procedure that does anything useful, and putting all the code that doesn't do anything into other procedures elsehwere. SHOW me the science, and the studies done that prove this code is more reliable, less bug prone, etc. Then there is the parallelization hype.... But GoLang has goroutines for that, is GoLang functional? Show me the science and the studies done. Functional programmers are guilty of religious cult propaganda. Join our cult because we know more than all the other cults out there! trust our bible over at Haskell Wiki because it's God's word! Oh really? Show me the SCIENCE. Ask Dijkstra, he said something along the lines of "massaging all your code" is what functional programming is. Also, is the relational model, functional? If you end up actually updating your database with anything useful, you've got a side effect. Without side effects you are castrated, like a cow that has his balls cut off. Wise GoLang programmer said "I used a functional programming language that was doubly functional. Doubly in the fact that it actually did something." Lisp is jokingly a procedural language being fraudulently sold as functional.
] Lisp is jokingly a procedural language being fraudulently sold ] as functional. Wrong. Try to work scientifically; with definitions, not slogans. ]Show me the science and the studies done. ... I gave you an example of how *nix-piping impressed ME. Imagine the complexity of taking text from inet | converting the text to speech in *.wav format | convering the *.wav to *.mp3 | writing the *.mp3 to your mobile-phone ? What is the code to do it?. 3 tokens: textFileID, DestinationFileID, utility to doit. So avoiding clutter, you can: T12Z <FileName> <DestName> Like with ETHO which *IS* functional: T12Z & <FileName> are just one klik each. I'm more impressed with the ETHO's OS than the language. The OS already follows the functional/piping style:. Then because of some new-fad [probably M$ originated], single-quotes are not 1-byte, but 3. So the complete TTS system fails. With Oberon or other normal/procedural code, you'd need to dig in and decode the source to fix it. With functional/*nix-piping, you just add a 20-char-function that: replaces the <new fad/virus bytes> with Char("'") and you don't WANT to know about the rest of the code. As previously stated ETHO OS does piping: Eg. Exchange all "red" with "yellow" in files: *Fruit*.Mod in <DirTree> A proper functional language [apparently Wolfram's Mathematica is good] might do: find <DirTree> FileName: *Fruit*.Mod | ReplaceAll("red","yellow") <- I lapsed into PASCAL ;-) Instead of piping the results between each stage/function: ETHO OS puts each result to an anonymous [you don't need to remember its name] TextFrame. Since eg. ET.Tool can position, create & kill TextFrames, I suspect that an ET.Do script could be written to: mark TextFrame position [to be able to kill it after use] Get list of files [to TextFrame] next operation/function on list of files, to alternate TextFrame; Kill position1 TextFrame, for further use to position new TextFrame .....REPEAT. ML seems an interesting functional programming language: the output if each stage [of the functional pipe] is called "it". So you don't need a vocanulary of Identifiers like with non functional languages. PASCAL's functional style, shows how the local variables are <got rid of; so to find: Maximum of age-difference between SetOfCats, SetOfDogs ABS(Age(Dogs,oldest)-Age(Dogs,youngest) - Age(cats,oldest-Age(cats,youngest)); This is related to your data-base that you wrote about. Don't get hung-up on Haskell and monads. Reading their literature exposes that they're saying <if FEELS nice>, but they can't explain why. OTOH, there are some classical texts from decades ago with solid proof/examples of the ECONOMY of effort from FP. Eg. Backus's 70's award winning ACM lecture. Traditional coding, eg. Oberon is good to reduce unemployment. The format is:-- declare all the soldiers and materials = zillion names to remember DoStage1 declare all the soldiers and materials = MORE zillion names to remember DoStage 2 using also any NAMED previously returnedvalues declare all the soldiers and materials = MORE zillion names to remember DoStage 3 using also any NAMED previously returnedvalues REPEAT ..... Each newly declared variable is an extra mental load and potential error. By contrast the FUNCTIONAL TextToSpeech example structure is: 1.Put chosen name in fixed location for finalStage to use: Name := Jon 2.Get TextFile to use as input: TextFile := <TextFile> 3. GetTextFile | CleanBadSuff1....CleanBadstuffN | convert to TextFile.wav | convert to TextFile.mp3 | store to final location using pre-set Name [ie. Jon] produces Jon.mp3 at final location. ==Chris Glur. PS. a previous contributer here: Sorren; started on the ETHO. implementation of a version of the 'joy' functional language. I see no point in writing the functions in joy or forth. Oberon would be easier. The way the ETHO *O S* with Gadgets, and perhaps Layla, which I've never used, is built ON TOP OF Oberon [ie. extending Oberon]. is what I'm advocating. PSS. ETHO has already got a usable Scheme.Tool
PS. it's very problematic pasting the pre-written text into the web-browser for gmail
When everything else fails try the Windows way: Control-C Control-V j. On Sat, Oct 17, 2015 at 8:40 AM, eas lab <lab.eas@gmail.com> wrote:
Some years ago when the OO-paradigm was at it's peek, ETHO was extended to handle procedure types, which could be passed as arguments.
There's great advantages in avoiding temporary-fads, so I never exercised OOP. Now [using LEO] that it's less easy to access my old NativeOberon files, I failed to find the documentation, and example uses of the <passing PROCs as arguments>.
Where should I look?
Can Oberon procedure types facilitate the <functional/compositional> style of programming? Which is NOT a passing fad.
*nix's <piping of functions/data-transformers> is staggeringly economical in user's effort, but has a terrible syntax.
The benefit of removing the need to learn ad-hoc syntaxS is my motivation for syntax-directed-editors & menu-driven-usage: which ETHO already used successfully.
An example of *nix's ability to easily get results by piping a sequence of existing/proven/well-tested functions together [but using understand-able syntax] is:--
CheckTheFileDataBaseForFilesNamed *roc*ointer* | ButSkipAllFiles *.pdf *.zip *.ps *.gz | AndListThoseContainingString "beron"
The big advantage of this functioal/compositional style is the maintainablity. Which is the whole idea of NW's "MODUL"a and "COMPONENT" pascal.
Some years ago, when my then ISP introduced Sender-must-ID for email, it was quite a job to modify the ETHO <emailer>.
Now there's a new-fad which messes my TextToSpeech facility: instead of 'saying' "can't", it says "Sea Aye Enn Tea"; because many feature/fad-following clowns are replacing the one-byte single-quote [ASCII] by 3 bytes.
Since the substantial processing-stages of fetching [unfortunately these days http-formatted] text, visually scanning it to wipe-out <bad sections> by an ETHO-like editor, and getting the TestToSpeech to a device, as a suitably-named file, needs only a few mouse-chords and typing the chosen name, you don't need to understand the details of each stage.
So you can just plug-a-function-into-the-pipe-line to: <translate the 3-byte-quote-fad to ASCII(SingleQuote)>.
Which just needs pasting from your library of examples, a 10 char line, and editing/modifying it; into the suitable pipe-line position.
That's why I call it MickeyMouse programming.
A most convincing argument, for me, for the functional style, is:--
Let's create a list of all even numbers up to 100, and another list omitting the first five of them.
The program written in Java.
final int LIMIT=50;int[] a = new int[LIMIT]; int[] b = new int[LIMIT - 5]; for (int i=0;i < LIMIT;i++) { a[i] = (i+1)*2; if (i >=5) b[i - 5] = a[i]; }
The program written in ###
let a = [2,4..100] let b = drop 5 a
It is immediately clear that with ###, you can understand what's going on; whereas in Java, or any imperative language, you can barely tell what the code is supposed to do because you are overwhelmed with the low-level minutia. This effect increases as programs grow more complex. From this simplicity and abstraction flow most of ###'s advantages. ----------------------------- end of extract. -------------------- ### <- let's not get stuck on NAMES. Let's rather first understand the CONCEPTS. Of course, the above is an extreme example, but ETHO's already existing facilities could perhaps do:
MapFunctionOverElements(DigitToText:PROC, DigitSequence: TextString):TextString;
MapFunctionOverElements(TestForPrime:PROC, Ints1toN: IntegerList):IntegerList;
There's nothing new about this. Extracting from McCarthy [designed lisp in 60s?]:- These three procedures clearly share a common underlying pattern. They are for the most part identical, differing only in the name of the procedure, the function/job of a used to compute the term to be added, and the function that provides the next value of a. We could generate each of the procedures by filling in slots in the same template: ------ snip lisp code --- The presence of such a common pattern is strong evidence that there is a useful abstraction waiting to be brought to the surface. Indeed, mathematicians long ago identified the abstraction of summation of a series and invented ``sigma notation,'' to express this concept. The power of sigma notation is that it allows mathematicians to deal with the concept of summation itself rather than only with particular sums -- for example, to formulate general results about sums that are independent of the particular series being summed ...
What are unforeseen problems in using ETHO to do this too?
== Chris Glur.
PS. it's very problematic pasting the pre-written text into the web-browser for gmail [designed for F/B-twitter kiddies=modern] compare to the 90's N-O emailer. Can Linux:Aos handle gmail? -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
eas lab wrote:
Some years ago when the OO-paradigm was at it's peek, ETHO was extended to handle procedure types, which could be passed as arguments.
There's great advantages in avoiding temporary-fads, so I never exercised OOP. Now [using LEO] that it's less easy to access my old NativeOberon files, I failed to find the documentation, and example uses of the <passing PROCs as arguments>.
Where should I look?
Can Oberon procedure types facilitate the <functional/compositional> style of programming? Which is NOT a passing fad.
You might want to read Wirth more... Wirth has articles such as Through the Looking Glass.... and he seems to think Functional programming is a fad, but that OOP has something to offer us.... Which is why his languages have OOP in them or advanced structured programming. Essentially OOP is just extending the type system further than before, whereas a lot of pathetic OOP languages use snake oil terms like "class" in place of type. An object is an instance of a class. Hmm. Why not an instance of a type? Why is it even an object and not just a struct? a struct or record, is an instance of a type. Now we have no OOP, just advanced structured programming... Wirth seems to think OOP solves the parallelization problem better than functional programming if you check his articles. Through the looking glass might be the one, or there are others. I am simply too lazy to link to them and not feeling like searching for it.
participants (6)
-
Chris Burrows -
eas lab -
Jan de Kruyf -
Lars O -
Mayson Lancaster -
Paul Reed