7 ms·
So Lisp is not a functional language...
by jerven 10y ago
So Lisp is not a functional language...
- catnaroek 10y agoMost things in Lisp have an object identity that can be directly manipulated by programmers, so it is indeed not a functional language.
- baldfat 10y agoTechnically you are defining a purely functional language and not functional programming. John McCarthy might disagree with you if he was still with us saying LISP is not a functional language. Here is a great summary of his "Recursive Functions of Symbolic Expressions and Their Computation by Machine" https://swizec.com/blog/the-birth-of-lisp-a-summary-of-john-mccarthys-original-paper/swizec/5075 https://swizec.com/blog/the-birth-of-lisp-a-summary-of-john-... I really think we need a definition of functional programing language. I feel that many just see Haskell and other "pure" functional languages as the only functional programming language when I really don't see that is the point (Also Haskell isn't very pure looking at Monads) Personal Definition. If you can program in a functional manner and it looks and feel good then it is. R - More then just this reason but yes JavaScript - Sort of but I would say no if my arm was twisted behind my arm Racket / LISP - Absolutely Python - NO WAY First Class Functions alone don't make a functional language
- catnaroek 10y ago> Technically you are defining a purely functional language and not functional programming. No, I'm not defining a purely functional language. ML-family languages (Standard ML, OCaml) aren't purely functional, but they have arbitrary compound values, the physical identity of whose in-memory representation is inaccessible - not a part of the abstraction the programmer is shown. And, FWIW, I only call Haskell “almost purely functional”, because divergence is a kind of effect that its type system doesn't track. In any case, a function is a mapping from values to values, so a decent treatment of a rich collection of values (including compound values) is a prerequisite for a language to be considered “functional”. > I really think we need a definition of functional programing language. Here's a very simple definition: A functional language is a value-oriented language with an abstract type of functions, which can only be distinguished from one another up to extensional equality. > (Also Haskell isn't very pure looking at Monads) Monads (resp. monad transformers) can be used to embed the abstract syntax of an effectful language into a pure (resp. less effectful) language. That isn't news to anyone. > Personal Definition. If you can program in a functional manner and it looks and feel good then it is. I have no idea what you mean by “program in a functional manner”, but, when I do functional programming, I expect to be able to formally reason about my programs without reaching for Hoare logic, which is an insanely complex beast.
- bad_user 10y ago> I really think we need a definition of functional programing language. I feel that many just see Haskell and other "pure" functional languages as the only functional programming language when I really don't see that is the point (Also Haskell isn't very pure looking at Monads) I consider FP languages to be those that actively encourage an FP style. We live in a pragmatic world with limits, many times we need to work around those limits and working with totally pure code where side effects are modeled by means of monads is sometimes limiting. However, in FP languages the FP style should be considered the default and breaking out of that style should be done for optimization reasons. The set of features required is not that big. Of course, for static languages, it would be nice if the language had some form of type classes and higher-kinded types, because that goes well with parametric polymorphism, which blends well with FP. But actually, you can't name a certain feature, other than having first class functions maybe. But the community and the available libraries need to encourage a preponderantly FP style. I can't say exactly what languages are like this, but I can say that Java does not and it never will.
- baldfat 10y agoI can say that surpisingly R (The fastest growing language with a TON of hate for its warts) is the closest I have seen for your description. Though it really is not a general purpose language. The closest general purpose language I have been exposed to that fits your description is Racket. Based off of Scheme and has the ability to really make your own language from it, but also has pragmatic pieces to get things done. Love your definition: However, in FP languages the FP style should be considered the default and breaking out of that style should be done for optimization reasons.
- catnaroek 10y agoHigher-kinded types aren't an absolute necessity, and, in fact, they force you to pick between modularity (abstract types) and type inference: https://news.ycombinator.com/item?id=12331926 https://news.ycombinator.com/item?id=12331926 . Not a very pleasant choice, a programmer normally wants both.
- bad_user 10y ago
- deleted 10y ago[deleted]
- willtim 10y agoProgramming with Monads, e.g. the IO Monad, is pure functional programming. It is a common misconception that it isn't. You have full referential transparency and sound composition, since no effects are actually performed until the computation is run/interpreted.
- baldfat 10y agoSo R isn't a functional language... To be fair the vast majority of people would say that it isn't BUT hidden inside is a very Scheme inspired system that can make pretty functional programs. http://link.springer.com/chapter/10.1007%2F978-3-642-40447-4_12#page-1 http://link.springer.com/chapter/10.1007%2F978-3-642-40447-4...
- catnaroek 10y agoScheme isn't a very good functional programming language either. Even cons cells are mutable objects with identity: just use eq? everywhere instead of equal?, and use set-car! and set-cdr! instead of creating new cons cells, and you're back to JavaScript. --- Sorry, can't reply properly, I'm “submitting too fast”. <ignore>I understand neither the form nor the content of your objection. Is Scheme a programming language? Yes. What does this have to do with whether it supports functional programming reasonably well?</ignore> Scheme is a higher-order programming language: procedures are first-class objects whose identities can be bound to variables just like any other value. I'm not sure about calling it “functional”, though: the type of procedures isn't fully abstract, because you can query the physical distinction between two procedures that have the same behavior when called. In other words, in Scheme, procedures are objects, but they are not values.
- baldfat 10y agoScheme is a functional programming language yes? Sorry but I am an old timer and seeing people blast the paths that led us to where we are is very frustrating to me. Edit added is a functional
- bad_user 10y agoTechnically speaking, Common Lisp isn't a functional language, yes. Common Lisp is a multi paradigm language and you can do FP with it if you want. But from my very limited experience with it, it's not the norm. However Lisp, the original, is based on the lambda calculus and that is very much about functional programming. So surely you can do FP with most Lisps, but whether that's the norm or not is another question.