Talk:Functional programming/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Have done initial merge with Nupedia article. Still needs work, esp. the section "functional programming" needs to be merged into main (new) text. -- Lexor 03:30, 14 Aug 2003 (UTC)

Nice work

Thanks for the good effort.

First Example

The article describes the first implemented functional language as IPL, and then later as LISP. This is an inconsistency.

Contrast

The article contrasts Functional Programming to Imperative Programming, yet in the Programming Paradigm article Functional Programming is contrasted by Procedural Programming. Imperative Programming and Procedural Programming are orthoganal. This is an inconsistency.

First of all, this need not be inconsistent. 3 or more concepts can be in contrast with each other. For example, you could contrast 3 political parties against each other. However, in this case, we must first define what distinguishes Procedural and Imperative programming. Only then we can decide whether we should contrast this article with either or both. --Raboof 11:46, 13 Apr 2005 (UTC)

XQuery

Look at XQuery also as another example

Note added to article by anon user

[ Note and Question: comparing a mathematical calculation of a program constant with programmatic reading of user input is not a valid comparison between programming lanuages, in my opinion. Your sqrt(2) example could be just as easily optimized in an imperative programming language...

The problem is that the optimization is safe only if the function call has no side effects. Although the compiler of an imperative language might know that this is true for the special case of the sqrt() function, it can't know that in general for an arbitrary function, not even in principle; see Rice's theorem. -- Dominus 3 July 2005 03:03 (UTC)
I don't think this is true. Take Java for example. There is root syntax set that is idempotent e.g. i = 2 + 2 never has side effects. It cannot. Given that, it's not hard to evalute recursively that if a body of a method contains only idempotent operations, it is also idempotent and if a method only calls other idempotent methods it is idempotent. This is actually a real feature (escape analysis) that is being implemented in 1.6 to allow stack allocation of Objects and other VM optimizations. Dubwai 19:15, 10 January 2006 (UTC)
Er... I believe that i = 2 + 2 does have side effects: it alters the value assigned to the variable "i". --Allan McInnes (talk) 21:21, 24 March 2006 (UTC)

...This example doesn't explain the advantages of functional programming or why I would want to change, which is unfortunate. Perhaps the goal was to illustrate that it is impossible to write functions in a functional programming language which cause side effects. If this is the case, it would be useful to have an example which shows how a functional programming language handles user input without these side effects, in a presumably better way than C. This would be very enlightening. ]

NPOV concerns

This article could have the potential to be a Featured Article, but I have some concerns about POV. Regardless of whether or not functional programming is actually better than other forms such as imperative, the article needs to increase the number of lines allotted to criticisms. The current layout involves one or two sentences worth of criticism at the beginning, followed by paragraphs about what's wrong with the criticisms. I would suggest clumping the most common/notable criticisms under a "criticisms" section at the end and expanding on them. It might also be good to merge the two "functional languages" sections into one, and expand the history section. -- BRIAN0918  04:10, 4 August 2005 (UTC)

Logic Programming

How does functional programming relate to Logic programming? -Chira 10:20, 19 August 2005 (UTC)

They're both different paradigms. The concept of referential transparancy features in both in some form. Wouter Lievens 08:49, 11 October 2005 (UTC)

I/O in functional languages

How does I/O work in functional languages? It seems to me that I/O functions cannot be idempotent, so input and output could only be implemented as the parameters and return to the "main" function. This would be extremely limiting, I cannot imagine that all functional languages are restricted in this way. -- Chris Q 08:04, 11 October 2005 (UTC)

Functional languages are "restricted" this way. However, most languages which classify as functional, are not longer only functional. They are a hybrid of languages that seem most like a true functional language (example of hybrid: Common Lisp). Assuming I understand you correctly, it is actually not limiting in creating algorithms. They have the same computational power, and usually less lines. It is limiting in creating algorithms that run efficiently on systems based on Von Nueman Machines, where iteration is faster than recursion. It is really quite interesting to program in truely functional languages, or those as close as possible (using only true function, besides maybe a procedure which defines functions). -has
The issue is pure vs. impure functional languages, or as I like to call them useless vs practical languages (take that with a :-) or two). In impure functional languages I/O works just like you'd expect it to. See OCaml, my favorite. Richard W.M. Jones 09:20, 31 October 2005 (UTC)
Well, let's not be uncivil. Haskell programmers seem to get on nicely with monads, a way of segregating "messy" I/O from "clean" function code. I personally can't make head nor tail of monads, but plenty of people seem able to -- for one example, Perl 6 (pugs) is written in Haskell. :) --FOo 09:45, 31 October 2005 (UTC)

Should have less focus on "pure functional"

This article is very biased towards Haskell and "pure functional" style of funcional programming, which is in fact just a very small and rather extreme position in the funcional programming (a bit like Smalltalk's "pure object oriented" programming in the object oriented programming).

First, defining functional programming by the lack of side effect is wrong in two ways:

  • One cannot define something by a lack of a certain feature. It's like claiming that the point of structural programming was not having goto. The point was providing some new control structures (procedures, loops etc.) that only accidentally made goto unnecessary most of the time. Likewise, the functional programming provides some new control structures, primarily the high level (polymorphic) functions and efficient tail recursion, but also macros, continuations, exceptions, parametric modules etc., that make the old imperative features necessary less often.
  • Almost all functional languages do have side effect. It seems that the most popular functional languages are all kinds of Lisp (by a very big margin) then MLs, Ruby, and all kinds of semi-functional programming in otherwise imperative languages (like Perl, or Java with inner classes). All with side effects. The "pure functional" programming languages like Haskell are just a very small branch of the functional programming (and in fact most of the concurrent extensions to Haskell do have side effects, so even Haskell isn't 100% pure).
  • The pure functional programming misses a lot of the most interesting features of the functional programming. There are no continuations, exceptions, macros etc. in the pure functional world.

The specific examples of the advantages of the (purely) functional programming are also not based in reality:

  • The claim that "program optimisation" is a strong point - imperative and impure functional have a much better performance than pure functional languages
  • verification - surprisingly, most of the verification research of the real programs (like the proof-carrying code stuff) seems to be operating on assembler level, to get around the difficulty of verifying the big and complex piece of code that the optimizing compiler is. And the model checking is also quite imperative. Am I missing something here ? Are there some real-world verification tools for the functional programs, as I only know the ones that are quite imperative.

OK, that's what I see wrong in the introduction. I suggest we:

  • separate the pure functional stuff somewhere else, and leave only the things common to most of the functional languages here
  • neutralize the article

Taw 14:40, 31 January 2006 (UTC)

  • JA: Yes, I agree in spirit with these remarks, and with much of their substance. But I don't think that it would take a major rewrite of the article, as most clans and ilks of programmers and theorists have long been more than happy to fly their particular colors, whether "pure and untyped" (PAU), "mixed and untyped" (MAU), "pure and typed" (PAT), "mixed and typed" (MAT), or whatever. So all we need to do is exercise a little bit of "truth in labeling" (TIL) within the outline of the article, and of course add in more content with regard to those POV's that are currently under-represented. It not so much plain vanilla as neopolitan or maybe spumoni -- heavenly hash codes, anybody!? Jon Awbrey 15:02, 31 January 2006 (UTC)
  • JA: Then again, the representation of programming paradigms in WikioPolis is pretty exhaustive, so why not just lay in a few more layers of link'o'rama? Jon Awbrey 15:24, 31 January 2006 (UTC)
Sounds OK to me, though of course references to pure functional programming and Haskell should be present. I am unconvinced by Java with inner classes being semi-functional programming, most uses of inner classes are either to implement an interface in-line, or so that you can access the enclosing classes members. -- Chris Q 15:08, 31 January 2006 (UTC)
Is there really a big enough problem to warrant an NPOV warning? I haven't got a strong enough opinion to remove it, but I still think the article is good in general. -- Chris Q 15:10, 31 January 2006 (UTC)
I do feel strongly enough that the NPOV tag is not warranted that I'll remove it. There are some good suggestions for improvements to be made (and some less good ones: for example, I don't think removing side-effects is, well, a side-effect, but an actual design goal... not the only one, but hardly just a "by the way..."). But these suggestions are just normal editing goals that don't really resemble any neutrality dispute. I really dislike the use of {{npov}} as a way to say: "Pay more attention to my edit goal than the others!" rather than as an actual dispute. Lulu of the Lotus-Eaters 18:28, 31 January 2006 (UTC)
It needs to be tagged somehow (from what I've seen, it usually takes about 10 times as much time to fix untagged articles ;-) ). It talks about one kind of functional programming as if it was the only existing kind of functional programming. It's either very strong Haskell bias or very strong inaccuracy. Taw 10:14, 1 February 2006 (UTC)
Why not just fix it, rather than misuse a template? From what I can see, you've identified an extremely minor focus issue that you are perfectly well able to correct yourself. Lulu of the Lotus-Eaters 11:32, 1 February 2006 (UTC)

Cleaning needed

...but not enough to warrant a {{cleanup}} tag.

Language bias and lists of languages

Wikipedia does have some problems with language-based bias; in the articles I've read (and edited), I've seen a very strong influence of Haskell (somewhat surprisingly) and LISP (and dialects thereof), C++ and Java (unsurprisingly), Python, and Perl, often at the expense of a great many other languages (including historically important languages like FORTRAN, COBOL, Ada, Pascal, and Algol). Similarly, many articles (including this one) have tended to grow large lists of "contributor's favorite languages that happen to have this feature". While it is appropriate to provide examples in real-world languages, and it is often helpful to give an example of a language that implements a feature being described, a large list is almost never comprehensive (and therefore carries a POV) and should be avoided (this is why we have categories!). I don't believe that any bias in this article is intentional (or even strong enough to warrant an NPOV tag), but the article does need some rounding-out. --bmills 19:42, 31 January 2006 (UTC)

In defense of Haskell

I think the concern with the focus on Haskell is somewhat overstated. In contrast to most of the other languages we mention or might mention, Haskell was designed in large part as a teaching language, meant to concisely express (pure) functional ideas. Sure you can do functional stuff in, e.g. Perl or Java. But if you give an example in those language of some FP concept, you have to add a bunch of explanatory caveats: ignore this, and that, and the other thing, which don't relate to the FP concept itself, but only to other features or syntax of the language. In contrast, when you present the concept in Haskell, it comes closer than anything else I know of to expressing all and only that concept. This doesn't mean that other languages don't do FP, just that in explaining FP abstractly, Haskell is often the clearest choice of presentation language.

I agree that the article could add some clarifying comments about just why Haskell examples are given, and that doesn't mean to claim that other languages don't do FP too. But the use of Haskell does not seem like a problem to me, per se. Lulu of the Lotus-Eaters 20:01, 31 January 2006 (UTC)

The use of haskell for examples isn't really a problem (I've used it myself in the Church encoding article for precisely the reasons you've given); the problem is that the "functional programming languages" section is very much written from a Haskell (or other pure-only language) POV. The inclusion of loaded phrases such as
  • "As intuitive as it sounds,"
  • "the hidden complexity"
  • "hidden information leaks"
regarding side effects (which are present in many functional languages!) is inaprropriate. --bmills 02:20, 1 February 2006 (UTC)

Other problems

The article has some other issues in serious need of attention; it variously claims:

  • "The strength of a functional paradigm is the removal of side-effects during computation."
    • I (and many other functional programmers I know) use functional programming to improve compositionality and to use recursion; side-effects are important, too, but not the only strength.
How about "...strengths of FP include removal of side-effects, ease of compositionality, emphasis on recursion, ..." ? (sort of like the Monty Python Spanish Inquisition bit :-)) Lulu of the Lotus-Eaters 20:03, 31 January 2006 (UTC)
  • "A functional program is immutable: rather than modify state to produce values, it constructs state from older pieces of state in the program."
    • This is inaccurate; a functional program may contain mutation if it is not purely functional.
  • "More generally, higher order functions could be said to be a part of natural language. For example, adverbs can modify verbs (actions) giving rise to derived verbs. As a pattern of thought, imperative verbs are similar to "ordinary" functions in programming languages."
  • "There are two methods of evaluating functional languages, strict (or eager) and lazy evaluation. Strict languages evaluate all function arguments before evaluating the function itself, while lazy languages only evaluate them when they are required. ... Lazy evaluation can add significant performance overhead keeping track of unevaluated functions; however, it makes programming easier in many ways."
    • Languages do not necessarily fall neatly into "strict" or "lazy" (SML/NJ has a lazy extension, as does Scheme; there are likely many others). The claim that lazy evaluation makes programming easier is overgeneralized.
  • "The competitive performance of modern (impure) functional programming languages such as OCaml and SML has resulted in their adoption in conventionally Fortran-dominated areas of scientific computation."
    • This is unsourced; while O'Caml is designed to be efficient for use in scientific computation, there is little evidence that the scientific community outside of CS research is actually using it. AFAIK, SML is still used mainly by researchers in PL (of which I am one). I would be very happy if it were verifiably true, but I'm not in a position to make that claim.

--bmills 19:42, 31 January 2006 (UTC)

Lazy evaluation does make my life easier! But I agree that the article needs a clearer separation between pure and impure functional languages. However if you talk about functional programming concepts in general you would usually do so from the pure perspective as the impurities are more practical hacks than... uhh... well-founded priciples? —Ruud 18:21, 2 February 2006 (UTC)

npov

I felt the article still had npov problems but I think my relatively minor edits suffice. Please let me know what you think.

I am very interested in alternative programming paradigms so I have studied functional and pure functional programming, but I do not believe either is the best paradigm available, so I think I can help with npov. I agree it would help to have a significant criticisms section but I hesitate to actually start it since I need help determining which of the criticisms I can think of belong in wikipedia and which are only my opinion.

I welcome your comments.

Ideogram 22:58, 26 May 2006 (UTC)

Putting a "criticism" section in this article is really "off" IMO. It's sort of like putting in a criticism of some other abstract concept: "criticisms of Fermat's Little Theorem"; or more computer-oriented, "criticisms of event loops" or "criticisms of memory management". None of those things have "pro-" and "con-" positions in the way that, say, a political viewpoint might (or even a specific programming language that might be chosen over some other language for some task; where one has pros and cons). A discussion of what state makes easy is OK, but it's not a criticism, just a question of programming solutions. LotLE×talk 01:42, 27 May 2006 (UTC)
perhaps calling it "criticism" is a misnomer. the fact is that programming languages and paradigms are tools that do have advantages and disadvantages and people do disagree on what the advantages and disadvantages of a specific language or programming paradigm are, amd also what the causes of those advantages and disadvantages are. there is a consistent POV throughout the article that most of the disadvantages of pure functional programming are caused by the fact that programmers are simply more accustomed to the imperative paradigm. even if true (note I am not saying it is false) it is not proven (and I doubt it is provable) nor widely believed outside of the pure functional community. this is fundamentally the source of your NPOV problem, the presumption that your smaller community's diagnosis of the cause is a more neutral point of view than that of the wider programming world's belief system, which is admittedly dominated by the imperative paradigm. a NPOV isn't about stating what's true, it's about stating what's uncontroversial, or most widely believed. if most of the world believes the earth is flat, then stating the earth is round constitutes original research, even if it is later proven true
There's a certain faction of programmers who think X is the greatest solution to every programming problem, for various values of X. Certainly, functional programming has such excessive enthusiasts. Or OOP programmers. And likewise (at a somewhat different level), some folks think Java, or Lisp, or Ruby, or whatever is the greatest of all programming languages, and anyone using something else is foolish. Or similarly for things like libraries within languages, or among tools.
To a small degree, I can see a legitimate concern that this article not fall into such an advocacy pitfall. But if it had done so at all, it was to a very small degree; the "balancing" deletions and additions you made really responded much too dramatically to a proportionally small concern. Maybe a few words of tone can be adjusted, but the article was basically pretty informative without getting on a soapbox.
The original research concern is certainly legitimate, but it needs to be balanced by a concern with just what it is that readers come to this article looking for. I doubt there's any study that quantifies X% of problems in functional programs are due to the fact programmers have a background in imperative programming; certainly nothing like that was cited, and even if it had been I wouldn't want to belabor the point. Nonetheless, it seems pretty likely that a large majority of people who read this WP article are programmers who have more experience in imperative langauges, and are trying to learn just what FP is (maybe they've heard a little bit, but are unclear). Just out of common sense, non-programmers probably won't read this article at all, and the developers of Haskell know much more than this article will present.
So a lot of the tone of the article sort of assumes a readership in a reasonable way. It's not necessary or desirable to be hyper-technical or overly pedantic in the distinctions. But generally, if we e.g. mention that pure functional programs don't maintain state, programmers of imperative languages will scratch there heads over how that's even possible. Letting them know at that point in the article that such is possible, and not necessarily anything painful or capricious (just a different way of approaching and thinking about matters) is helpful to readers. Maybe a brief example of such things helps too. On the other hand, there's also a concern directly related to WP:NOR that pushes for something along the lines of what the article does: It's orginal research-ish to say that the "disadvantage" of pure-functional programming is X; it's not OR-ish to say that the "perceived disadvantage" is Y (especially if we cite a comment on such perception). It's not our place to judge what ultimately are advantages or disadvantages, but we can present 3rd party opinions... and given the topic, a lot of the relevant 3rd parties will be people who do FP. LotLE×talk 04:52, 27 May 2006 (UTC)
let me address your edits in detail.
line 6 you added back the text from the deleted section to the history section, but this expanded section now covers more than history. I have added a section header "Related Work".
Seems like a good subsection name. LotLE×talk 04:52, 27 May 2006 (UTC)
line 66 I agree with you that this is a better place for the comments about state. I was wondering if the description of monads as being notoriously difficult to grasp would survive since it could be challenged as not being NPOV (I am not able to cite a reference in support for instance). maybe you just haven't gotten around to it yet.
I think the language is a little bit awkward right now. But I wanted to move your general comment somewhere, and let editors tweak it. "Notoriously difficult" seems a bit POV, but given that I'm a bit of an "expert" and can't entirely get my head around monads still, I don't think it's entirely unfair. Let's find some more neutral way to describe the perceived advantages/disadvantages of statefullness (but without saying either side is right or wrong). LotLE×talk 04:52, 27 May 2006 (UTC)
i very strongly feel the new section paradigms and influences, restoring basically all the text I deleted, is weak npov although perhaps not an outright violation. For example, why do you emphasize programmers accustomed to the imperative paradigm find functional programming difficult? can you cite studies showing that people new to programming don't find functional programming difficult, which is the subtle implication?
See the readership thing above. I think something along the lines of that section is quite important to have; some reworking is certainly possible.
I agree with you that identifying our readership is critically important. I'm going to try to breakdown this section sentence by sentence.
"Many programmers accustomed to the imperative paradigm find it difficult to learn functional programming, which encompasses a whole different way of composing programs." This sentence clearly belongs somewhere in the article, although I'm not sure where. Maybe even the top of the article.
Sure, this is a very important sentence. I think its true. You probably think its true too. But what we put in Wikipedia is supposed to be verifiable, not just "what we think is right". --Allan McInnes (talk) 16:34, 27 May 2006 (UTC)
Do you think we should delete it or reword it? Ideogram 23:41, 27 May 2006 (UTC)
I think we should find a reference that supports it. I'll see what I can dig up myself, but if you find anything appropriate before I do please add it to the article. --Allan McInnes (talk) 01:03, 28 May 2006 (UTC)
Addendum: I find it a little disconcerting that the top Google hit for imperative programmer learning functional programming is this article. --Allan McInnes (talk) 16:55, 27 May 2006 (UTC)
Welcome Allan. I think you will be an excellent resource on complying with general Wikipedia standards.
The Google hit is funny. Is the implication that writing an article to teach imperative programmers about functional programming consititues OR? If so, what can we safely assume about our audience? Ideogram 23:18, 27 May 2006 (UTC)
Sorry, should have been more clear: my point was that if this article is the number 1 hit for a discussion of imperative programmers learning functional programming then maybe the issue isn't as big a deal as the article seems to be claiming. That said, I don't think a Google hit is a good enough data point to make a judgement; I'd rather find a reference of some kind that discusses the problems (or lack thereof). --Allan McInnes (talk) 01:03, 28 May 2006 (UTC)
There is precedent for teaching functional programming to an audience that does not already know imperative programming. The best known is the famous Structure and Interpretation of Computer Programs, used at many universities for the introductory programming class, which actually spends several chapters programming in a functional style before introducing the notion of state. Another excellent textbook is "Functional Programming: Practice and Theory" by Bruce J. MacLennan. Ideogram 23:30, 27 May 2006 (UTC)
Sure. See also Felleisen et al.'s How To Design Programs, and Van Roy and Haridi's "Concepts, Techniques, and Models of Computer Programming" (which starts with a declarative model before moving into explicit state, OO, and concurrency).
I think the key thing to keep in mind here is that this is supposed to be an encyclopaedia article. The audience may well include imperative programmers, but is also likely to include people who are not programmers at all, or who are just starting out. The article should provide useful information to all of them. It's probably reasonable to have a section that discusses the difference between imperative and functional styles. But framing the entire article from that perspective would be a mistake in my opinion. --Allan McInnes (talk) 01:03, 28 May 2006 (UTC)
"This difficulty, along with the fact that functional programming environments do not have the extensive tools and libraries available for traditional programming languages, are among the main reasons that functional programming has received little use in the software industry." This is probably the sentence I have the most trouble with and therefore the only one I really want to delete.
I just deleted it; I agree it seems forced without really saying anything. LotLE×talk 06:44, 27 May 2006 (UTC)
"Functional languages have remained largely the domain of academics and hobbyists, and what little inroads have been made are due to impure functional languages such as Erlang and Common Lisp. It could be argued that the largest influence of functional programming on the software industry has been by those academically trained programmers who have gone on to apply the impure functional programming style to their work in traditional imperative languages." I am not sure whether our identified readership of curious imperative programmers really need to read this. Furthermore it continues the previous sentence and if we delete that this will at a minimum need to be reworked.
Something about the academic focus seems worth mentioning; I'd welcome better wording. LotLE×talk 06:48, 27 May 2006 (UTC)
Immediately suspicious phrase: "It could be argued that..." — argued by whom? As it stands, the paragraph smacks of original research. --Allan McInnes (talk) 16:34, 27 May 2006 (UTC)
"Functional programming ideas have also influenced the constructs available in languages such as Perl, Python, and Ruby. These languages offer features, such as lambda functions, higher-order functions, first-class functions, list comprehensions, map, reduce, zip, filter, and various other constructs borrowed from functional programming languages." I think this could be moved to the Related Work section.
Yeah, something like that sounds fine. I think it's worth pointing out that FP has had influence beyond FP-languages as such is worth having. But exactly where and how phrased isn't crucial. LotLE×talk 06:48, 27 May 2006 (UTC)
So it seems this section could be removed and parts of it distributed elsewhere in the article. What do you think? Ideogram 06:00, 27 May 2006 (UTC)
But imperative programmers really do have a steep curve in jumping into FP ways of thinking. The curve isn't infinite though, people do eventually get the hang of it. I'm not saying that this is a matter of Saul becoming Paul on the road to Damscus... it's not that imperative programmers give up all their old "sins" once they learn the true path of FP. I certainly haven't, even as one of the cited references in this article; most of what I program is plain old do-this, then do-that, then change-some-state.
Similarly with OOP, I've found. I'm an old enough fogey that I did a pretty good bit of regular structured programming before I did OOP. And the first... gee, years, of OOP work I did was sort of fumbling around with a slightly different syntax without entirely getting the gestalt of OOP. Then at some point the whole thing just gelled; nowadays I fairly indifferently move between metaclasses and inheritance thinking, and encapsulation is a banal matter of data structures. Along the way, it helped to have a few friendly "Don't panic" essays in front of me. The "paradigms and influences" section is a bit like that... it's worth saying to readers: "This might all look confusing, but in the end it's not nonsense, and it's something you can understand". LotLE×talk 04:52, 27 May 2006 (UTC)
the statement that "this difficulty, along with (lack of extensive libraries and tools) are among the main reasons that functional programming has received little use in the software industry" is clearly a statement of opinion that could never be backed up with a citation, and subtly contributes to the impression that the fact that imperative programming is more widespread than functional programming is due to the historical accident that imperative programming came first and that it is not likely that imperative programming was simply easier to understand for the first computer designers than the lambda calculus, which already existed at the time. Ideogram 03:51, 27 May 2006 (UTC)
Be careful about pushing an opposite original hypothesis about what's inherently easier to understand.
I wasn't really trying to push that hypothesis, I should have said "it is not likely, for example, that" but I guess it shows how tricky maintaining NPOV can be when we have unconscious biases. Ideogram 06:00, 27 May 2006 (UTC)
I tend to think your analysis is more-or-less correct, but it's not something we should get into in this article. It should be possible to present the fact that there are different ways of thinking, and that imperative programming is generally more widespread, without telling some historical counterfactual story about what might have happened if Church had been hired to break Enigma instead of Turing (actually, for all I know, Church worked on it too... but the point is that we should avoid writing retro-fiction and speculation). FP is pretty widepread too, in any case, though often in places folks don't entirely recognize it like in SQL and XSLT. Definitely C is used in industry more than Haskell is. LotLE×talk 04:52, 27 May 2006 (UTC)

delisted good articles

what would it take to move this article out of the delisted good articles category and back into the good articles category? Ideogram 06:02, 27 May 2006 (UTC)

are there really still grammar problems here? I don't see them Ideogram 06:18, 27 May 2006 (UTC)

major surgery

I have made a top-to-bottom reorganization and rewrite.

Please note that I am philosophically inclined towards brevity and high level overview rather than completeness and detail. Therefore I have deleted a lot of material I considered questionable (when in doubt, throw it out). Please discuss here before reverting on general principle. Ideogram 01:12, 28 May 2006 (UTC)

On the lead paragraph: the old article started off with an admission that there was no consensus on what constitutes functional programming. this is an extraordinarly weak position for an encyclopedia to have. if there is no consensus, why does it deserve an entry? in my opinion (and I do recognize it is my opinion) it is better to start with the paper, for two reasons: it is generally recognized as being the most influential, and it is a reference. Ideogram 01:18, 28 May 2006 (UTC)

I very strongly disagree with almost all these changes! You have deleted almost all the good material, and left barely a stub of an article in place. Deletion is just plain wrong! If in doubt, reword. Just simply don't delete anything from an article that is already too short, or at least not at this level. I'm tempted to simply rollback the whole of the changes, but I guess I'll try restoring the deletions in the much more laborious way. But don't do this again! LotLE×talk 01:16, 28 May 2006 (UTC)
Wikipedia style is to start with a definition of some sort. Starting with a paper is not only contrary to that style, but doesn't really help the reader to determine whether or not they should bother reading the article &mdashl they would have to look at the paper to even know what the article is about. A better approach might be to use a definition from that paper. Or better yet from a more modern paper. --Allan McInnes (talk) 01:25, 28 May 2006 (UTC)
Thank you, I understand. I will try to work towards this. Ideogram 01:39, 28 May 2006 (UTC)

I didn't expect these changes to be uncontroversial. But I don't see why I shouldn't "do this again", I am trying to be bold. Ideogram 01:20, 28 May 2006 (UTC)

Don't be. This is a good article that has been stable. Joining WP to delete most of the material from an article that has generally reached consensus, all for no good reason and no prior discussion on the talk page is extremely disruptive, and even worse manners. LotLE×talk 01:22, 28 May 2006 (UTC)
at the top of this very page and again at the bottom there is a note that it has been delisted from the category of good articles. Among the problems listed are NPOV and lack of stability.
From my perspective the article appears to be poorly organized and lack focus. You don't fix those kinds of problems by simply aggregating more material. This article needs editing, and an editor needs freedom to delete. I may not be the right person for the job, but to argue against deletion on general principle is not acceptable.
I have not deleted "most of the material." I think you are overreacting. I have tried to say most of the same thing in a more concise manner. I have tried to delete mainly two classes of information: information I did not consider verifiable (providing verification will make me agree to replacing it) and material I felt was distracting. Again, I am prepared to discuss any individual deletion, but telling me I am not allowed to delete anything is unacceptable. Ideogram 01:31, 28 May 2006 (UTC)
Concur with LotLE here. This article has been fairly stable for a while now. While it no doubt needs some work, making radical changes without discussion is not generally a very good idea. Particularly when those radical changes involve substantial deletions. Being bold is fine. But part of being bold is "taking it to the talk page" when your boldness results in a revert. Please don't make the same changes again without discussion. --Allan McInnes (talk) 01:28, 28 May 2006 (UTC)
if a revert occurs I will certainly refrain from further editing until consensus is reached. I do not want to start a revert war. I was not aware that edits could be considered "too radical" since all older copies are still available.
I am of course new and I am sorry I have violated community standards and I am willing to learn. But I am truly puzzled by the blanket statement that "deletion is bad". Ideogram 01:37, 28 May 2006 (UTC)
Very dramatically violating standards, in a really annoying way. Basically, deletion is bad. Rewording and refactoring is good. And obviously, it's not such a black-and-white thing as no word or sentence should be deleted. But deleting many whole paragraphs that express ideas many editors have found important is very bad. I think the deletions quite literally were more than 50% of the article, but I didn't do an actual byte count. Also important is the difference between articles that are already really much too long, and contain lots of redundancy, and articles (like this one) that need expansion rather than deletion. WP isn't trying to find the shortest dictionary definition of a term, it's trying to contain an encyclopedic discussion.... and WP:PAPER observes that we need not be as concise as printed versions do (though summary style is needed to let readers "drill down" as they wish).
Moreover, there's a big difference between being a major contributor to an article for six months or more, and using some discretion to delete relatively large swatches, and joining WP with practically your first edit being mass deletion. Discretion and boldness is something you earn (on a per-article basis). For example, I've been a moderately large contributor to this article, and a larger one to e.g. Python programming language. Folks over there would trust me to be pretty bold in refactoring and large changes. However, I've never made a single edit to Java programming language or Scheme programming language; if I were to change those latter articles, I'd be very careful to start small and conservative, and pay lots of attention to reaching consensus on the talk page. Likewise for other examples unrelated to programming. Even though I'm among the top couple hundred WP contributors by edit count, I still need, as a matter of manners, to defer to existing editors on topics I have not previously edited. LotLE×talk 02:08, 28 May 2006 (UTC)
Not to worry. As you say, the history is there, so reversion of an edit that's a little too bold is always a possibility. The important thing is that once someone objects to a bold edit (i.e. LotLE and me in this case) we all stop being bold and starting talking about it. In that sense, your boldness has worked, since it's started a discussion.
As for deletion, it's not inherently bad. But large-scale deletion of without any warning (say on a talk page) is generally frowned upon. --Allan McInnes (talk) 01:52, 28 May 2006 (UTC)

Please justify why SQL is relevant to functional programming. SQL, so far as I know, doesn't have higher order functions.

I am not familiar with XSLT but I would still like some justification. Is this statement verifiable? Ideogram 01:24, 28 May 2006 (UTC)

Apparently so. See here. --Allan McInnes (talk) 01:32, 28 May 2006 (UTC)
Thank you. I will put it back. Ideogram 01:43, 28 May 2006 (UTC)
Errr, I mean I concur with it having been put back. I still think SQL should be removed. But I'm going to refrain from touching anything until consensus is reached. Ideogram 01:45, 28 May 2006 (UTC)
Novatchev's paper is definitely interesting, and we should link it in the article (FWIW, I was a pre-press reviewer on Dimetre's paper). It's often not obvious that XSLT is a fully functional language. Actually, something like Make files are possibly worth mentioning too as a very common "little language". SQL is interesting too: even though it's purpose is in large part to update database values (i.e. modify state), the query language is actually pure functional, and in fact very list-oriented in a LISP-ish style. Subqueries and joins, after all, are immutable collections.... interestingly, even INSERT statements are not themselves stateful: they modify the outside world (the DBMS), but there is no maintenance of state variables within the language itself. The designers of SQL very much had in mind a FP paradigm, but it's "sold" in practical terms, not for the theoretical angle. There are probably another half-dozen rather widely used "little languages" that are FP-on-the-sly... things that people use for years without noticing their using FP. LotLE×talk 02:08, 28 May 2006 (UTC)
Does SQL have higher-order functions? Can you verify a definition of Functional Programming that leaves out higher-order functions? Ideogram 02:36, 28 May 2006 (UTC)
At one point the article mentioned the query sublanguage of SQL as a functional language. Has that discussion now been removed in favor of just talking about SQl in general?

If we're going to have differences of opinion on the definition at the top, our positions had better be verifiable. From my perspective, the primary distinguishing factors of functional programming are avoiding side effects, higher order functions, and recursion. I admit I currently do not have verification. I will work on it. Ideogram 01:49, 28 May 2006 (UTC)

I don't understand why closures are important. Please verify. Monads I see as primarily a feature of Haskell (I can't find a tutorial on the web that doesn't assume knowledge of Haskell.) Please verify that it is common. Ideogram 01:51, 28 May 2006 (UTC)

I would have to read the paper to understand what "combining forms" and "algebra of programs" mean. From my perspective using these terms without explaining them does not inform. The "principle of compositionality", being a link, is more defensible, but I still consider its relevance weak. Ideogram 01:53, 28 May 2006 (UTC)

since the distinction between higher order functions and first-class functions is subtle, I have tried to avoid the use of the term first-class functions and consistently use the term higher order functions. Ideogram 01:55, 28 May 2006 (UTC)

"programmers using 'mostly imperative' languages may have utilized some of these concepts" The use of the word "may" is a dead giveaway that this statement is not verifiable. Ideogram 01:56, 28 May 2006 (UTC)

I think the addtion of the "Concepts" section is a good idea and that the reinsertion of material I deleted here is good. Recursion might belong here but the specific information currently placed under recursion really belongs in the comparison of functional and imperative programming. Recursion does have its own entry so maybe we can delete the subsection. Ideogram 02:01, 28 May 2006 (UTC)

The description of LISP as a "much-improved functional programming language" is a statement of opinion. Ideogram 02:14, 28 May 2006 (UTC)

Please just purge the word and concept "delete" from your mind while working here!
Allan, do you concur that I'm not allowed to delete anything? Ideogram 02:27, 28 May 2006 (UTC)
At this point, I'd suggest that you avoid deleting anything in this article. If for no other reason than to avoid protracted talk page arguments. If a chunk of material looks misplaceed, move it to the right section rather than deleting it. If the material is poorly written, try refactoring it a bit. If it's questionable, slap a {{fact}} tag on it. --Allan McInnes (talk) 05:41, 28 May 2006 (UTC)
The deletions have almost all been quite bad. I agree the recursion discussion should be adjusted (and expanded) to better fit its section under "concepts", but I wanted to get some sensible structure in place first, then work on tweaking the content of each. Recursion is certainly a major concept in FP, and the concept deserves expansion in the article. I think maybe something on "list processing" is worth having as a concept too, but there's nothing yet to put in it... still, all those "list application functions" (map, reduce, filter, fold, etc) are pretty prominent in FP (even if not in the definition as such). LotLE×talk 02:23, 28 May 2006 (UTC)

I beleive the reinsertion of the final paragraph in comparison of FP and IP repeats information I summarazed in my rewrite. Furthermore it includes a "citation needed" note. Rather than leave ugly scaffolding in public I'd prefer to delete the dubious unverified statement completely. Ideogram 02:05, 28 May 2006 (UTC)

Don't. Find a citation, don't delete material just because someone has annotated the need for it. Likewise with the "much-improved" thing on LISP. Frankly, Lisp makes me crazy personally; but almost no one would seriously maintain that Lisp wasn't a big jump forward at its time. We can dig up some comment to cite, but a judgement that would be shared by 99%+ of the people who understand it isn't "mere opinion". The speed stuff is pretty similar... people quibble over benchmarks, but it's just plain foolish to imagine that O'Caml isn't "pretty darn fast" compared to just about every other programming language. Or likewise the array stuff with J and K.
Asking for citations on facts that prior editors might have found "obvious" is fair enough. But deletion of facts that really are consensus opinion, just because a cite is not yet provided, is just obnoxious LotLE×talk 02:23, 28 May 2006 (UTC)
It's generally preferable to either dig up a reference for uncited text, or just leave it with a "citation needed" tag. Ugly scaffolding is fine. In fact, some Wikipedians claim that "citation needed" tags should be ugly, because it encourages people to find references. Removing uncited text should generally only occur if no reference is forthcoming, and there's general agreement on the talk page that the text in question is bogus. --Allan McInnes (talk) 05:45, 28 May 2006 (UTC)

If we're going to mention "currying" I'd like some explanation of what it's good for. Ideogram 02:16, 28 May 2006 (UTC)

I don't see why it's necessary to mention imperative/object-oriented progamming in the lead paragraph of the Concepts section. Ideogram 02:47, 28 May 2006 (UTC)

In retrospect I probably should have "sandboxed" my changes. But I haven't done that yet and it seemed so easy to just edit instead of learning something new. Sorry. Ideogram 02:24, 28 May 2006 (UTC)

good faith

can we please negotiate in good faith? It seems to me that LotLE is very angry with me, using adjectives like "annoying" and "obnoxious". I am new and inevitably going to make mistakes. Rather than defend against statements that impugn my motives, can I ask for a litle patience? I have already said I'm not going to touch anything until we reach consensus. Ideogram 02:31, 28 May 2006 (UTC)

OK, I'll step back and assume good faith. I'm confessedly crotchety; but I don't think I'm wrong to be annoyed at large deletions. Let's just assume is was a misstep, XXOO, and all that. Some wording changes you have made have been good; but this is an article I've long thought needed expansion; so deletions struck me particularly badly.
I simply haven't put in the work studying FP that you and others here have, so I cannot help you with expansion. I simply don't know as much as you do. The one way in which I can contribute is by taking information already in the article and streamlining it and reorganizing it, imposing consistent POV, improving the logical structure and presentation, and generally making it easier to read.
There's a question of balance. If there's a lot of information on one topic (e.g. Haskell, monads) and not a lot on common alternatives, it gives the impression that the mentioned subjects are more important than the subjects not mentioned. Certainly the best solution is to expand on the other subjects, but as I said, I'm not capable of that. That's one of the reasons I delete things, to focus on what's important and not what random contributors found interesting enough to type in. Ideogram 03:36, 28 May 2006 (UTC)
I think the focus on monads and pure-functional styles is a bit too much, myself. "Impure" languages like Lisp need some more coverage; well, not the languages themselves, since those are different articles, but the style of thinking emphasized by those. A lot of that is about declarative list processing. So functions like map, filter, reduce/fold are really important in the "Lisp school", while stuff like monads and purity are hardly discussed there at all (that's much more on the Haskell/ML side of things). Moreover, programmers in "mostly imperative" languages like Python, Perl, Ruby, TCL are quite likely to care about map() and friends, but a lot less likely to care about monads or currying. And SQL, for example, does the whole map()-like stuff, but that's about it. Note that map/filter/reduce are HOFs in a technical (though constrained) sense, but there's "higher" and there's "so-high-it-blows-your-brain". The former tends to get more day-to-day use outside of academia. LotLE×talk 03:53, 28 May 2006 (UTC)
It's a big topic that is only selectively addressed, but what is here has seemed fairly good to me (I'm no advocate of FP, FWIW; though I'm also no critic... it's one of a number of paradigms or concepts that grabs my interest).
although earlier I might have implied that you were biased, rest assured I believe you now Ideogram 03:36, 28 May 2006 (UTC)

The "perfect article"

Sort of a fiction we talk about on WP. You comment, Ideogram:

So what do you think the solution is? If you never want to delete stuff that is less imporant, you'll always have a problem with balance. This is a pretty deep question that applies to all of Wikipedia. Allan, do you have any input? Ideogram 04:06, 28 May 2006 (UTC)

Obviously, I'd like to hear from others. But there are a few things that strike me as what would be in the "perfect article" on FP:

  • About twice as long as it is right now. What we've got is rather stubby, given the pretty broad subject. Obviously we don't want words for padding, but there are enough concepts to talk about.
    • For reference: this one is now about 16k and the OOP one is about 38k (seems like the closest conceptual analogy I could think of). The one on Python is 22k, but it was factored (by me) into children Python syntax and Python software, it's probably over 50k in total. Other languages like Perl, C, Java, have been factored into even more children, so more total length.
Maybe you know enough about FP to double the length of the article, but I obviously can't just insert padding if I have nothing to say. Ideogram 05:18, 28 May 2006 (UTC)
That's fine of course. It's not your job versus some other editors'. We certainly don't want padding for it's own sake; but within reason it's better to let readers know more rather than less (as long as the organization lets them easily skip what they don't care about)... past 40-50k or so, article start to desperately need refactoring into child articles, but we have a long way to go. LotLE×talk 05:24, 28 May 2006 (UTC)
  • No more length than what we have now on comparisons with imperative styles.
  • Perhaps eventually factored according to summary style to spin off child articles on some specific topics.
  • Slightly more material on some Haskell-ish topics mentioned passingly (monads, purity, referential transparency)
I think something that makes monads comprehensible to someone who doesn't know category theory or Haskell would be unique on the web. I don't know what purity is if it isn't completely disallowing side effects. The whole subsection labeled Pure functions is really about referential transparency. Ideogram 05:25, 28 May 2006 (UTC)
  • About as much material on Lisp-ish topics as on Haskell-ish (lists, map, filter, fold/reduce), none of which really exists now.
This sounds like a good idea and something I might be able to do besides. Ideogram 05:25, 28 May 2006 (UTC)
  • A little bit more on tail recursion and continuations.
The problem I see here is that these topics have their own entries, tail recursion being quite long. What can we say about them in this article that doesn't belong there? Ideogram 05:25, 28 May 2006 (UTC)
  • More code samples, and some improvement to the imperfectly focused examples for referential transparency.

The way to get there is most certainly not be deleting the stuff we have that is pretty good (even if slightly lonely without the other needed sections), but rather by growing what's missing. LotLE×talk 05:09, 28 May 2006 (UTC)

Again, I can't contribute the raw information. I can only advise on the overall balance of what is already there. Ideogram 05:25, 28 May 2006 (UTC)

FP and "little languages"

On the SQL issue: I did a few web searches. I can find a bunch of people passingly refer to SQL as functional, but none seem like really solid citations in terms of centrally discussing that issue, rather than just mentioning it in an off-handed way. Certainly "declarative" is a better description, which is related to "functional" but not quite the same thing. So I'm thinking probably the lead is too prominent; but some later mention is still worthwhile.

SQL does not, of course, have higher-order functions, or does so only in the most tenuous sense (a JOIN is theoretically a kind of composition; so's a subselect). However, not all definitions emphasize HOFs. For example, the second result on google for the query "define:functional programming" gives http://www.jsoftware.com/books/help/jforc/glossary.htm. That definition is:

A method of writing programs that describes only the operations to be performed on the inputs to the programs, without the use of temporary variables to store intermediate results.

In that definition, SQL is certainly functional. And the predicative nature of SQL filters (WHERE and HAVING clauses) has a very FP feel to it. But it's hard to be completely definitive on SQL: it's not a Turing-complete language, after all. The same sort of issue arises in discussing something like LEX/YACC, which are FP-ish, but not really "languages" in the full sense. LotLE×talk 03:16, 28 May 2006 (UTC)

Here's another likely source. The comp.lang.functional FAQ gives:

Functional programming is a style of programming that emphasizes the evaluation of expressions, rather than execution of commands. The expressions in these language are formed by using functions to combine basic values. A functional language is a language that supports and encourages programming in a functional style.

Again, nothing there about HOFs; and again SQL would seem to qualify. But that brings in the equally fuzzy distinction between expressions and commands. If you take "commands" to mean "state" it's clear; but that's not necessarily the only reading. LotLE×talk 03:29, 28 May 2006 (UTC)

The textbook "Functional Programming: Practice and Theory" that I mentioned earlier draws a distinction between "The world of expressions and the world of statements". I would say one of the distinguishing features is that statements must be evaluated in order while the parts of an expression can (theoretically) be evaluated in any order.
But I don't think any definition is going to create a well-delineated category. All attempted definitions are going to be inclusive rather than exclusive because of their attempt to be general. Lots of things are going to be included that aren't good examples.
Besides, if you've studied the work of linguist George Lakoff, you'll know that human categories are often ill-defined; to use an object-oriented analogy they are often prototype based and not class based. Given this I don't think we should be attempting to mention every sort-of-functional language, we should concentrate on the best examples. Ideogram 03:54, 28 May 2006 (UTC)
I didn't think I'd see Lakoff in this thread :-). But the question is what's "best" about a given example. This article has mostly gone with "canonical" in the past, which basically means talking about Haskell. That's not an unreasonable meaning. But "widespread" seems like a fair meaning of "best" too (hence SQL). And "easily understood by readers" isn't a bad sense either... which might push for some more list processing examples (Lisp syntax can be off-putting, but the idea of elementwise application isn't bad). LotLE×talk 04:49, 28 May 2006 (UTC)
In my opinion "best" means the prototype closest to the center of the category cloud. It can be there because it was seminal (Lambda calculus, Lisp) or by design (Haskell). "widespread" by itself in my mind doesn't qualify. the problem with "widespread" is it lends itself too easily to accusations of self-aggrandizement. "See, FP is important because you use it every day!" If you want to point to a widespread example, I'd say stick with Lisp, which is widespread and also a good example by other measures. Ideogram 04:59, 28 May 2006 (UTC)
The thing about paradigms is that they change the way you look at the world. The reason they exist is because they explain a lot of diverse things. That doesn't mean those things are good examples of the paradigm. I really don't think it's a good idea to label anything that doesn't have state as functional (as you note, "declarative" may be better). SQL may have similarities to a functional langauge, but (also as you note) it's not even Turing-complete, so aren't we comparing apples and oranges?
I don't know if you saw any of the Carl Hewitt controversy, but part of the problem was that he was trying to apply his Actors paradigm to a wide range of subjects. Again, it's a paradigm, but that doesn't mean it needs to be mentioned in relation to everything it touches. For instance, there's a mention of Actors on the Scheme page. Personally I don't believe it belongs there (see comments on balance above) but after this little experience I'm not going to go anywhere near that for a while. Ideogram 03:45, 28 May 2006 (UTC)
I don't know anything about the controversy you allude to. LotLE×talk 04:49, 28 May 2006 (UTC)
It's a public record, but it's a LOT of reading and probably not worth your time. Ideogram 05:00, 28 May 2006 (UTC)
It's almost certainly not worth your time unless you (a) care about concurrency theory, and (b) enjoy reading convoluted arguments involving deep technicalities and much dodging of the question. --Allan McInnes (talk) 06:05, 28 May 2006 (UTC)
The Hewitt affair was (IMHO) mostly an issue of undue self-promotion across multiple articles, usually combined with a lack of verifiable references. I don't think that's quite the same thing as mentioning in passing (in a single article) that SQL has a functional sublanguage (assuming a reference can be found). Actually, I think the SQL connection is interesting, simply because I'm sure many people don't think of it as a functional language.
LotLE, if you can find a reference that the designers of SQL thought of it as a functional language, that there was a historical connection and they were influenced by the concept, I will drop my objection. If you merely want to assert that it generally fits the definition, my objection stands. Ideogram 06:23, 28 May 2006 (UTC)
Add a "fact" tag to it if you're concerned. I'm not going to find it tonight, but I can eventually. Or maybe someone else will. And if I turn out to be wrong, at least give me (and other editors) a little while to dig for a good cite. LotLE×talk 06:43, 28 May 2006 (UTC)
I've decided to take a break from editing. I'm in no hurry. Ideogram 07:15, 28 May 2006 (UTC)
OTOH, one can program in a functional style using C++ too :-) Perhaps what we need is a section that discusses the distinction between functional languages, and programming in a functional style.
I like the new section heading very much. I'm not sure it belongs under the "Concepts" section though. It might go under the FP vs. IP section, or maybe its own section. Ideogram 07:26, 28 May 2006 (UTC)
Yeah, I waffled on that a bit myself. Moved it back and forth a couple of times in preview, and just couldn't decide. I eventually decided to stick in "Concepts" for now, and wait to see how it evolves. But I'd be more than happy to see it moved somewhere else, or given it's own section. --Allan McInnes (talk) 07:40, 28 May 2006 (UTC)
I think that's right. The lead somewhat introducees the distinction between functional languages and styles, but I think a couple paragraphs in a subsection could help flesh out that idea nicely. There's a book from a while back about "object oriented programming in assembly", FWIW (that might be the exact title)... so it's certainly true you can "do anything with anything" :-). But some "mostly imperative" langauages make FP style particularly easy. LotLE×talk 06:43, 28 May 2006 (UTC)
As an aside, I suspect it's probably reasonable to mention the Actor model in the Scheme article: Scheme was ostensibly developed partly to enable Steele and Sussman to explore the implications of the Actor model. --Allan McInnes (talk) 06:05, 28 May 2006 (UTC)

What elements of functional programming do SQL and Lex use, besides eschewing mutable values? we already dispensed with higher-order functions. closures? I suppose you could make an argument for recursion. but for functional programming to lay claim to a universal mathematical concept like recursion is ridiculous. Ideogram 04:00, 28 May 2006 (UTC)

Well... the two definitions I found both focus almost entirely on that specific element of the definition; and it didn't take looking anywhere unlikely or obscure to find such definitions. Of course SQL of Lex/Yacc don't use HOFs in a rich sense, and no closures, no continuations. Still, closely related to mutability we get referential transparency. And parsers are big on recursion. Recursion is a mathematical concept, sure. But so are lots of things. I hardly think we skip discussing function calls in the C article because it's mathematical.
I'm not saying we shouldn't discuss recursion, I'm saying we shouldn't call everything that uses recursion functional. The threads seem to have gotten mixed up.
In the world of programming, recursion is associated with FP. LotLE×talk 04:49, 28 May 2006 (UTC)
I completely disagree with this statement. Can you verify? Ideogram 05:04, 28 May 2006 (UTC)
I have to agree with Ideogram here. While it's true that recursion sometimes gets associated with FP because FP doesn't support iteration (at least not directly), recursion is also used in imperative languages. Some problems (tree walks being a good example) are simply better suited to a recursive solution. If anything, I'd say that recursion is associated with particualr data structures (i.e. recursive ones), rather than particular programming paradigms. --Allan McInnes (talk) 06:09, 28 May 2006 (UTC)
Just on the historical sequence though, I think it's on pretty safe ground. Lisp introduced recursion in a big way, around the time that Fortran and Cobol (or assemblies) lacked it. All the languages that followed got the recursion idea from Lisp. Of course, some new language with a dozen influences is pretty far removed from that. But even as a style, a recursive call is automatically not the same as a mutation of a variable, so it get a bit into the FP "gestalt". While they might amount to the same thing, 'i++' and 'Func(i+1)' are different ways of conceptualizing the idea of "increment". LotLE×talk 06:49, 28 May 2006 (UTC)
Lisp is one of the oldest programming languages. Not everything that borrowed from Lisp deserves to be called functional. Languages that have automatic memory management with garbage collection don't qualify as functional, for instance. Lisp itself is many things besides being functional. Ideogram 07:17, 28 May 2006 (UTC)

can I start editing again?

Ideogram 04:02, 28 May 2006 (UTC)

Well, it is an anarchy here. I ain't a god or a master. But I'd very much appreciate if you'd eschew deleting any concepts addressed currently, and focus instead on filling in the many gaps remaining in the article. LotLE×talk 04:57, 28 May 2006 (UTC)
Umm, again, I don't have the knowledge to fill the gaps. Maybe you could tell me what you're looking for and I'll try to find a match? I was thinking more along the lines of improving the general flow and readability. I don't intend any more major restructuring or deletion. Ideogram 05:08, 28 May 2006 (UTC)

I think there needs to be an explanation of what "non-mutable value passing semantics" are. I'm not sure myself. Ideogram 08:11, 28 May 2006 (UTC)

I don't understand what the place name in the References citations is for. Ideogram 08:18, 28 May 2006 (UTC)

Not sure exactly what you're asking about here. But if it's what I think it is, then the locations are publishers addresses (at least the city). It's common in academic papers to include a publishers location/address in book citations. --Allan McInnes (talk) 20:40, 28 May 2006 (UTC)

more help more work

There's a mandarin expression translated as the above, to be interpreted as "the more you help the more work I have to do". I feel like I've done that here and I'm very embarassed. Sorry. Ideogram 07:28, 28 May 2006 (UTC)

definitions

I feel that the category of Functional programming is better described with a prototype-based definition than with a class-based definition. I don't think you will ever get a satisfactory definition based on a list of features. Rather, I would prefer a classification focused on the prototypical examples: the lambda calculus, Lisp, and Haskell.

In support of this argument, I offer the fact that I read the introduction to the textbook "Functional Progamming: Practice and Theory" closely last night and could not find a single definition of Functional programming.

The description of functional programming in SICP is not a definition but says only:

"... functional progamming languages ... do not include any provision for assignment or mutable data."

I propose a lead something like the following:

Functional programming is a programming style that treats computation as the evaluation of mathematical functions and avoids state and mutable data. Functional programming emphasizes the definition of functions, in contrast to procedural programming, which emphasizes the execution of sequential commands.

Functional programming relies on concepts from the lambda calculus, Lisp, and more recently Haskell. Frequently mentioned are the avoidance of state and side-effects (which provides for referential transparency), higher order functions, recursion, and closures.

Ideogram 19:30, 28 May 2006 (UTC)

I'm not sure how this differs from the current lead. It's not quite verbatim identical, but it uses many of the same phrases, with no obvious difference in overall meaning or style. LotLE×talk 20:13, 28 May 2006 (UTC)
I agree with LotLE here. I'm also a little hesitant to try to define FP by enumerating languages (lambda calculus, Lisp, Haskell), since that requires the reader to know what all of things are, and be familiar with what features they provide. --Allan McInnes (talk) 20:38, 28 May 2006 (UTC)
well my contribution is mainly the second paragraph, which (to address allan's comment) also lists the concepts used explicitly. Let me make the edits, since they are small, and we can revert if you object. Ideogram 01:05, 29 May 2006 (UTC)

Can we please discuss the two versions instead of just changing it back and forth? You say the two versions have "no obvious difference", if you believe that why didn't you let the changes stand? Ideogram 05:36, 29 May 2006 (UTC),

Because you removed several important and agreed concepts from the lead; and also because you directly duplicated the mentions of influence that was already in the lead, three sentences later.
I did not see a duplication in my changed version. Are you talking about the information in the History section? Ideogram 06:48, 29 May 2006 (UTC)
No, I'm not talking about that. I'm talking about the fact that the list lambda-calc/lisp/haskell was mentioned twice in three short paragraphs! LotLE×talk 07:11, 29 May 2006 (UTC)
All right, that was an editing error. Sorry. Ideogram 07:24, 29 May 2006 (UTC)
Moreover, I entirely agree with Allan McInnes that mentioning lambda-calc/lisp/haskell in a definitional sense is misleading (which your duplicative mention did).
I deliberately left the first paragraph as unchanged as I could, to give more prominence to that definition than the tracing of historical influences. Ideogram 06:50, 29 May 2006 (UTC)
Except you removed every single wikilink to related concepts, and also removed the standard boldface on the article topic (I think a couple more typographic style violations too). LotLE×talk 07:11, 29 May 2006 (UTC)
Ok, sorry about that too. If you had told me that I would have been happy to fix it myself. Ideogram 07:24, 29 May 2006 (UTC)
I think it's OK to add (as I did per Ideogram's suggestion) lambda-calc/lisp/haskell as examples of influences; but the overly prominent suggestion of "relies on" gives a wrong impression. LotLE×talk 06:09, 29 May 2006 (UTC)
FWIW, notice I didn't simply rollback, but tried to incorporate what I could of your changes... even though it meant re-adding all the wikilinks and markup that was missing from your version. Still, it really feels like each of these changes is done to try to make some rather obscure and hyper-pedantic point, rather than actually to make a more readable and informative article (so obscure, in fact, that I haven't myself quite figured out what that point is supposed to be... maybe trying to starkly limit the meaning of FP to some ultra-narrow theoretical "core", despite the mentions of paradigms on this talk page). That continues to be frustrating to me. LotLE×talk 06:27, 29 May 2006 (UTC)
I can't believe that you linked to WP:POINT here. Do you really want to imply I am abusive in that manner? Let me ask you again to negotiate in good faith. I honestly believe that my goal is to make the article more readable, which means concise and to the point, to me. Why do I have to even spend time defending that? You keep saying you want to make the article longer, you measure the worth of the article in byte-count, which I've been trying to imply is not the right measure and now I state it explicitly. Ideogram 06:44, 29 May 2006 (UTC)
My point as it were is that you have no good definition and your version of the lead explicitly admits as much. And I don't think you're going to get an uncontroversial definition, given the weakness of the examples we've seen so far. In such a case I feel it is better to use the historical development of the concept and representative examples as a definition since they are less controversial. Ideogram 06:53, 29 May 2006 (UTC)
I don't like the mention of state machines in the lead since I certainly don't think I am creating an FSM when I engage in procedural programming.
I don't see how the phrase "a set of common concerns and themes" is better than "concepts", which is certainly shorter.
You criticize me for removing important and agreed concepts and then you remove the mention of the avoidance of state and side effects, and referential transparency! I can only hope this was a simple error.
State is mentioned in the very first sentence (currently, and for several years before I edited this article). You're right that I took the phrase "referential transparency" out of the lead... not really with any particular intent, but just during editing. I'm happy to put that mention back in. LotLE×talk 07:46, 29 May 2006 (UTC)
I placed recursion ahead of closures because I believe recursion is more important. You keep arguing that SQL is FP because it has recursion but it does not have closures.
I don't care about the order there, but simply removing mention of three or four of the concepts listed in the lead is no good. LotLE×talk 07:11, 29 May 2006 (UTC)
I'll yield on three of the four concepts but as noted below I still question monads. Ideogram 07:26, 29 May 2006 (UTC)
The articles roughly grades the importance in the way we introduce the concepts. None are "criterial", and I think we need a sentence that says that... it's not as precise as, e.g. "what a 'group' in mathematics?" But HOFs (and 1st-class funcs), closures, and recursion are given as "often considered important". At a lower level ("other common features") are continuations, Hindley-Milner, laziness, and monads. As a general grouping, the secondary stuff is definitely less central than the "primary" stuff, but still well enough known that readers might have those things in mind when coming to this article. Actually, Hindley-Milner seems more in the obscure direction than monads do; but both are more "interesting" than "central". I recognize and acknowledge that you could write a perfectly good book on FP w/o ever talking about monads, but it's good to pique readers interest, and I think the term "monads" has gotten a certain buzz. LotLE×talk 07:46, 29 May 2006 (UTC)
I challenge you again to verify that monads are "common" since I can't find an example on the web that doesn't rely on knowledge of Haskell. Ideogram 07:01, 29 May 2006 (UTC)
Well, monads came out of the Haskell community, so it's hardly surprising that most mentions of them involve Haskell. However, it's also possible to find discussion of
to name just a few. Monads have become a popular topic in FP circles (at least in those circles I travel in). --Allan McInnes (talk) 09:27, 29 May 2006 (UTC)
The difference between the terms higher-order and first-class functions is so subtle that mentioning them both in the lead borders on redundancy. Ideogram 07:04, 29 May 2006 (UTC)
I'll try to improve the explanation of the distinction. What you had added isn't quite right (though it's not that far off). But readers might have encountered one or the other term, but not necessarily both. So listing both near-synonyms is friendly to readers coming from various directions.
Ok I accept that. Ideogram 07:27, 29 May 2006 (UTC)

SQL ref

I added a link to one of the first papers presenting SQL, by R. R. Boyce. I don't have access to the full paper, but the abstract emphasizes the statelessness criterion. I noticed, however, that there seems not to be an article on Boyce. I mean, he's the B in BCNF for gosh sake; surely he deserves an article. Oh well, my knowledge of Boyce doesn't really extend any farther than what I just said though, so I'm not sure I can write it  :-).

I'm not 100% happy with the cite I provide though. It's suggestive (and the full text might have more... any ACM members here?), but I'd like a more explicit discussion of the historical connections between relational querying and FP. LotLE×talk 20:36, 28 May 2006 (UTC)

The paper does not explicitly mention FP. However, there are fruther suggestive phrases such as
As computer systems become more advanced we see a gradual evolution from procedural to declarative problem specification.
and
The work on the Structured English Query Language (SEQUEL), presented in this paper, is consistent with the trend to declarative problem specification. It attempts to identify the basic functions that are required by data base users and to develop a simple and consistent set of rules for applying these functions to data.
So I think it's reasonable to claim a historical link between SQL and declarative programming. Of course, that's not quite the same as functional programming. --Allan McInnes (talk) 20:54, 28 May 2006 (UTC)
Declarative programming is most certainly not functional programming. Functional programming is a subset of declarative programming. Until there is a reference that explicity mentions functional programming my objection stands. Ideogram 01:02, 29 May 2006 (UTC) Logic programming is also declarative programming for instance. Ideogram 05:37, 29 May 2006 (UTC)

good faith (again)

I deliberately asked about my changes before making them since I thought they might be controversial. LotLE replied indifferently that he didn't see any difference. Only after I made my changes did LotLE immediately edit them and come up with some discussion for why his version was better. And furthermore he starts attacking me by saying I'm trying to make a hyper-pedantic point unrelated to making the article more readable.

The official Wikipedia line is to be inclusive and urges newbies to "be bold". The reality is far far different. I have really had just about enough of this. If something doesn't change I'm likely to dump the whole thing. Ideogram 07:17, 29 May 2006 (UTC)

As little as possible?!

I remain extremely frustrated by almost all the changes Ideogram makes to this article, always pretty much in violation of previous consensus. I'm trying to figure out the perceived logic in the changes, which have seemed to be deletions in every single case (sometimes rephrasing, but always to something shorter that also omits several aspects or concepts). The closest to making sense of it I can come is that Ideogram wants this article to say as little as possible about functional programming. S/he first want to remove absolutely everything that is not at the "core" of FP (whatever that is), rather than give readers coming from various directions a sense of what the topic is about. And going along with that, s/he deletes every sentence which is conceivably in need of additional citational support (though often I disagree that such is even desirable for many examples). And then finally, s/he removes additional concepts more-or-less at random, I guess because in her/his mind listing five related concepts is better than listing ten (even if all ten are generally topical).

As near as I can tell, under Ideogram's image of the "perfect article", this article would be reduced to a very short dictionary definition, and no longer resemble an encyclopedia article. I like dictionaries and all, but WP isn't that. Maybe editing Wikitionary would be more fulfilling to this goal. LotLE×talk 07:19, 29 May 2006 (UTC)

That's it. You don't want me here, I'll go. Ideogram 07:31, 29 May 2006 (UTC)
If you are still interested in my viewpoint, you can see my explanation of it on User talk:Rossrs. Ideogram 21:14, 29 May 2006 (UTC)
For a useful comparison/contrast, take a look at the article object-oriented programming. I've never edited that article, and haven't even actually read the whole thing carefully. Actually, one thing about that OOP article made me cringe just now: the whole overly long "critiques" section seems like an utterly unencyclopedic attempt at a false meaing of "balance". As I've commented on this talk page, I just don't think most WP topics appropriately have "critics", which make them seem like a political debate rather than a scientific/historical/biographical/etc. article.
But aside from that one gripe, I think the lead of the OOP article is at a quite good level, and something we should model this article on (obviously, with lots of differences in the specifics). It's friendly to a general readership; it has some links to related concepts; it's about the right 3 paragraphs in length; it gives a slight sense of the issues/concepts that will be discussed at more length in the full article. Actually, I think the lead to this article (if not further deleted from) gets exactly the same right balance also. LotLE×talk 07:34, 29 May 2006 (UTC)

LISP v. Lisp

There's recently been some oscillation between writing "Lisp" and "LISP" in the history section. IMHO, we should be using "LISP", since the history section is talking about McCarthy's original LISP work (which he refers to as "LISP" in his "History of Lisp" paper), rather than modern Lisp. I'm fine with using "Lisp" elsewhere in the article, if that part is talking about modern Lisp. --Allan McInnes (talk) 19:54, 1 June 2006 (UTC)

I undid your change before reading your note. Fixed. — Preceding unsigned comment added by 65.116.35.251 (talkcontribs)
Thank you. I think the parenthetical note you added is a good compromise. --Allan McInnes (talk) 19:57, 1 June 2006 (UTC)