After 40 years of inventing new programming languages, most people have realised that inventing yet another language doesn't solve anything.
After 40 years of inventing new programming languages, most people have realised that inventing yet another language doesn't solve anything.
Be careful - neither Lisp nor Scheme are really about functional programming.
After 40 years of inventing new programming languages, most people have realised that inventing yet another language doesn't solve anything.
After 40 years of inventing new programming languages, most people have realised that inventing yet another language doesn't solve anything.
That doesn't sound right. Which language is the one that existed before the "new" later ones added nothing more?
Be careful - neither Lisp nor Scheme are really about functional programming.
Agreed.
Be careful - neither Lisp nor Scheme are really about functional programming.
Agreed.
I'm sorry, but there are thousands of sites/refs that state that it IS a 'Functional' language. Eg...
https://cs.uwaterloo.ca/~plragde/flaneries/TYR/
https://www.bootstrapworld.org/blog/software/FunctionalLanguages.shtml
etc. etc. etc.
Maybe you have a different interpretation of what 'functions' mean ?
Virtually everything in 'Racket' involves Functions, & Functions within Functions??
There are no loose ends, with anything not declared/used within Functions.
And Statements/Loops within Functions, add infinitum... fully structured/accounted.
Be careful - neither Lisp nor Scheme are really about functional programming.
Agreed.
I'm sorry, but there are thousands of sites/refs that state that it IS a 'Functional' language. Eg...
https://cs.uwaterloo.ca/~plragde/flaneries/TYR/
https://www.bootstrapworld.org/blog/software/FunctionalLanguages.shtml
etc. etc. etc.
Maybe you have a different interpretation of what 'functions' mean ?
Virtually everything in 'Racket' involves Functions, & Functions within Functions??
There are no loose ends, with anything not declared/used within Functions.
And Statements/Loops within Functions, add infinitum... fully structured/accounted.
There is no need for interpretation of what "functional programming" means.
It does NOT mean programming using functions.
It means programming without using assignment. You create a name with an initial value and it keeps that same value forever. You can't change it.
Scheme *can* easily be used for functional programming, but it doesn't force you to.
Yup. Programming languages that allow some form of "functional programming" but don't enforce it are often called "impure functional languages".
Of course those are just words... IMO, using the functional programming paradigm in an "impure" way does not really provide the benefits of functional programming, and I don't see the point. Just my opinion.
Tail recursion in C is not guaranteed so by Murphy's law you will hit a case where some peculiar compiler or some peculiar compiler flags end up causing unexpected stack overflows.
At least that's what people say. I never rely on tail recursion optimization in production code to avoid tempting fate.
You are welcome and enjoy your learning experience. Lisp and (Racket specifically) are well known for the ability to define your own languages in them, thanks to the extremely powerful macro system. That's what you are seeing in DrRacket.
Even if you never use functional programming or Lisp "in anger" to solve a real problem, it is always beneficial to learn a different approach to solving problems. It will make you a better programmer/engineer because it adds another set of tools to your professional toolbox.
Btw, that (define x ...) doesn't work for redefining variables is normal. It is not meant to. Redefining variables is a bad practice that leads to buggy code - by redefining a variable you would be essentially saying that: "this train is a bicycle now".
Define binds a symbol to a value (think declaring variable and assigning it an initial value) - i.e. declares a variable. If you try to declare the same variable again, it is an error ("identifier already defined ..."). If you want to perform an assignment (to mutate a value), there is set! instead, which works only on previously defined variables (but then see the part on mutating state and functional programming - it is a poor practice to mutate state unless there is no other way).
In reality, the practical features of all lambda languages and functional programming have already been implemented in one way or another by other larger, more commercially pervasive languages.
That's not to say that Lisp / Scheme / Racket are not good languages. However, it's because of the reason above that these languages are nowadays used almost exclusively for teaching purposes.