Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!linac!att!ucbvax!BRFAPESP.BITNET!UNBCIC From: UNBCIC@BRFAPESP.BITNET Newsgroups: comp.lang.forth Subject: Functional Programming Message-ID: <9103271402.AA16072@ucbvax.Berkeley.EDU> Date: 25 Mar 91 21:25:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: UNBCIC%BRFAPESP.BITNET@SCFVM.GSFC.NASA.GOV Organization: The Internet Lines: 62 > I am glad that you have said this. I don't like to be picky, but I do > want to say that it was kind of confusing to start your previous message > with "hehehe, I'll show you that you are wrong". Sorry. My intention was to show that your arguments were not new. Just that. > These are the examples I suggested. However, the fact that these > examples arose in the context of functional programming does not mean > that they ARE functional programming. I didn't want to say that they ARE functional programming. I'm saying, instead, that they are PART of functional programming. > If you claim that these examples ARE "the functional paradigm", then Since I don't claim this... > you cannot make the statement that these are "operators to improve > functional programming." You must instead claim that these are > operators necessary for the implementation of functional programming. Sorry. Better wait and bring you all the reference. > I. We show that the functional paradigm does not imply the style I suggest. > > The following Scheme function: > (define (factorial n) > (if (= n 1) > 1 > (* n (factorial (- n 1))))) > is functional, since it does not make any assignments. However, it is > not written in the style I suggest. That would look like: > (define (factorial n) > (accumulate * 1 (enumerate-interval 1 n))) The first example is a poor use of functional programmi~rng. Yes, it avoids side effects, but that's not all we want to do. Yes example is a true functional program. That's why I claim what you suggest is functional programming. > Part II is important because it means we can program without explicit > control structures in a language like Forth without first making Forth > a functional language. I am also planning on using this style in C. Nothing is pure. You are pressuposing that anything that, by one way or other, have non-functional elements is non-functional. Then, almost everything is nothing. Right? > This is an interesting example, but I hope you understand that it is > not actually in the style I suggest, and so I will not be pursuing it. If you can program without any IFs, ok. I was suggesting a better structure to use instead of IFs, if you don't like IFs. > Adam (8-DCS) Daniel C. Sobral UNBCIC@BRFAPESP.BITNET