![]() ![]() Both have to emit symbol tables, constant tables, etc. This not only includes abstracting the format of machine instructions, and the layout of code and data and the tracking of labels, but also completely mundane things that even assembly programmers take for granted (thanks to high-level assemblers). What do these two systems have to abstract, relative to the machine code?īinary encoding: Both C and Lisp must abstract the encoding of a program into binary form. In the abstract, we can consider a C implementation that exposes just the essence of the language, and we can imagine a Lisp implementation that does the same*. > I can tell however that I’ve never heardįirst, let me point out that there is a distinction to be made between abstract and concrete systems, one that I failed to make originally. With Scheme, the situation is even more obvious: In the Scheme standard, the language is called an ‘algorithmic’ language, not a ‘functional’ language. ![]() The very same people were unable to explain how Lisp was more a functional PL than e.g. In any classes I got in CS, it was taught as a functional > Saying that Lisp is more similar to Java than to ML is specious, for Or like saying Smalltalk is a functional language, just an impure one. Saying that Lisp is a functional programming language, just an impure one, is like saying that you’re still a vegetarian if you eat steaks, just an impure one. Java is indeed lacking some features, but those have nothing to do with functional programming. Maybe I should have used Smalltalk as an example instead of Java and said: Lisp is no more a functional programming language than Smalltalk – because I really cannot find any essential differences between those two languages. The distinction between FP and ‘pure’ FP is useless, since ‘non-pure’ languages lose all advantages of functional programming. > requirement for a functional programming language. > programming languages as you said earlier, but it certainly not a > forbidding non mutable state is a feature of pure functional Misunderstanding: I was talking about first-class functions, anonymous functions, and lexical closures. > calculus, or that it tries to avoid non mutable state… > It is the first time I am hearing that smalltalk is derived from lambda They work analogous in functional and imperative languages and have a lot more to do with Lisp’s strong support for list processing than with functional programming. Map/filter/reduce are specialized functions for *list* processing, but also an application of higher-order-functions/procedures. Lexical closures exist in many other languages too, especially Smalltalk, but to a lesser extent even Java. If you want to bring historic arguments about what Lisp originally was: The first Lisp version, IIRC, did not have lexical closures but did dynamic name binding instead. The term functional means “like a mathematical function”. The same applies to Java, Smalltalk, … I have used Java as an example here and not to claim it is the one and only true language. You can still do pure FP in it, but you aren’t forced to, and thus lose the advantages (you cannot assume anymore that some anynomous function passed to your code is purely functional). ![]() They violate one of the most fundamental principles of FP by this. Scheme simply *doesn’t* avoid mutable state, nor does Common Lisp. > suddenly become imperative languages as a result! > the mainstream of the FP community, adding the distinction that > until much later that the class of “pure” functional languages entered > functional programming community, and are the archetypal > Scheme fits all of these criteria, as does ML, which was its European > 4) The avoidance of mutable state as a general rule. > 3) The use of map/filter/reduce as a general rule. > 1) Semantics based directly on the lambda calculus. If you disagree with this, you simply have a different understanding of functional programming than most of the world and we just have to agreee to disagree. Thus, the features you mentioned do not make a language a functional language. In fact, many call it the godfather of OOP languages. The features you mentioned can be found in Smalltalk, which few people would call a functional language. I admit I should have been a bit more precise in my reply. > functional programming is, it makes me wonder if I should reply or just But if you compare Java to Lisp and defend it saying I don’t know what ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |