Earlier quoted context omitted.
Having lambda doesn’t mean to be FP. One of the core features missing in Java (JavaScript also) is TCO(tail call optimization)
First of all not all FP languages have TCO, Scheme is probably the only one that actually requires it on its language specification. Secondly stuff like LINQ was already available in Smalltalk. So all those map/filter/fold/.... constructs from lambda calculus, which Java now enjoys. Then if we apply the modern concept of only Haskell is FP, then there are a couple of FP languages that won't meet the classification. A…
Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
141–150 of 167 posts
Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#142Earlier quoted context omitted.
Having lambda doesn’t mean to be FP. One of the core features missing in Java (JavaScript also) is TCO(tail call optimization)
First of all not all FP languages have TCO, Scheme is probably the only one that actually requires it on its language specification. Secondly stuff like LINQ was already available in Smalltalk. So all those map/filter/fold/.... constructs from lambda calculus, which Java now enjoys. Then if we apply the modern concept of only Haskell is FP, then there are a couple of FP languages that won't meet the classification. A…
Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#143Earlier quoted context omitted.
Having lambda doesn’t mean to be FP. One of the core features missing in Java (JavaScript also) is TCO(tail call optimization)
Tail call optimization is more or less unimportant, because you can express any recursion with iteration and most of the time the explicitly iterative version is even safer and better. TCO only adds zero-cost for recursions based on tail calls, that's nice to have but recursion is a bit of a hobby-horse of CS professors anyway. It only makes sense in languages that have their own stack, i.e., have no hard stack limit…
Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#144Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#145Earlier quoted context omitted.
Having lambda doesn’t mean to be FP. One of the core features missing in Java (JavaScript also) is TCO(tail call optimization)
Tail call optimization is more or less unimportant, because you can express any recursion with iteration and most of the time the explicitly iterative version is even safer and better. TCO only adds zero-cost for recursions based on tail calls, that's nice to have but recursion is a bit of a hobby-horse of CS professors anyway. It only makes sense in languages that have their own stack, i.e., have no hard stack limit…
Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#146Earlier quoted context omitted.
First of all not all FP languages have TCO, Scheme is probably the only one that actually requires it on its language specification. Secondly stuff like LINQ was already available in Smalltalk. So all those map/filter/fold/.... constructs from lambda calculus, which Java now enjoys. Then if we apply the modern concept of only Haskell is FP, then there are a couple of FP languages that won't meet the classification. A…
It depends. As we know, FP is all about not having side effects. Having “for” loop requires to mutate the pointer of given iteration.
open Printf;;
printf "After all OCaml isn't a FP language\n";
for idx = 1 to 10 do
printf "%d\n" idx
done
Same goes to Common Lisp, F#, Scala, Clojure.Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#147Earlier quoted context omitted.
Tail call optimization is more or less unimportant, because you can express any recursion with iteration and most of the time the explicitly iterative version is even safer and better. TCO only adds zero-cost for recursions based on tail calls, that's nice to have but recursion is a bit of a hobby-horse of CS professors anyway. It only makes sense in languages that have their own stack, i.e., have no hard stack limit…
It depends. As we know, FP is all about not having side effects. Having “for” loop requires to mutate the pointer of given iteration.
Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#148Earlier quoted context omitted.
First of all not all FP languages have TCO, Scheme is probably the only one that actually requires it on its language specification. Secondly stuff like LINQ was already available in Smalltalk. So all those map/filter/fold/.... constructs from lambda calculus, which Java now enjoys. Then if we apply the modern concept of only Haskell is FP, then there are a couple of FP languages that won't meet the classification. A…
There are many definitions of FP. IMHO the “no side effects” is the best one. Even Clojure is functional, but partially IMHO, bc it is for JVM which has not been design for FP. And my definition is not an arbitrary one. This is the most broadly one I think. But when you use same word in different contexts, then the word might have different meaning.
Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#149Earlier quoted context omitted.
It depends. As we know, FP is all about not having side effects. Having “for” loop requires to mutate the pointer of given iteration.
As replied on another thread, you just killed a couple of FP languages with that definition.
The "function" in "functional programming" refers to mathematical functions, which are fixed mappings from inputs to results with no side effects. If your "functions" can have side-effects then they're not functions, they're procedures. Programs composed of effectful procedures are imperative, not functional.
Re: Programming Paradigms for Dummies: What Every Programmer Should Know (2009) [pdf]
#150Earlier quoted context omitted.
What are you going to do with the errors once you have collected them? What is the point of sorting or grouping them?
A simple example from the compiler I'm working on right now: I output type errors of expressions sorted by their location in the source file, instead of in the order they are detected. I also don't error out on the first one, but find all at once. I could also group warnings and errors together, output only the first N errors, or... whatever I fancy. Errors are just data.
Any chance you have another example?