This is just an encoding of a Turing-complete language into another, I don't see what's been demonstrated here.
Hey, C Is a Functional Language Too
21–30 of 78 posts
Re: Hey, C Is a Functional Language Too
#22This reminds me of how I used to mimic OO in C years ago. At a certain point you realize that you have to forgo certain things to help the person coming after you avoid making mistake -- often they do not see the ramifications of your conventions.
I see this in Ruby right now when I write in a functional style. The code is often terse yet easy to read, but the lack of lazy evaluation makes it far more memory consumptive than code written in a straightforward procedural style. If you know you are making the tradeoff, it is fine. For many people, it is too subtle.
Re: Hey, C Is a Functional Language Too
#23I would say the aspect that defines a functional programming language is the support of higher order functions. I.e. functions that can take functions as arguments and more importantly can return functions as return value.
I don't know why, but some years ago, "functional programmers" started to change and twist the definition of functional language step by step, until all those languages fell off and only Haskel remained as "functional enough".
Re: Hey, C Is a Functional Language Too
#24Earlier quoted context omitted.
Doesn't function pointers enable passing functions around in C?
Yes, but functions aren't truly first-class values; you cannot create new ones on-the-fly (proprietary extensions notwithstanding).
Re: Hey, C Is a Functional Language Too
#25Earlier quoted context omitted.
Yes, but functions aren't truly first-class values; you cannot create new ones on-the-fly (proprietary extensions notwithstanding).
What does proprietary mean in this context? I'm sure it can be copied/implemented by for example gcc if they were interested.
Re: Hey, C Is a Functional Language Too
#26Re: Hey, C Is a Functional Language Too
#27I would say the aspect that defines a functional programming language is the support of higher order functions. I.e. functions that can take functions as arguments and more importantly can return functions as return value.
I'm not that old but I remember that, back in the days, functional meant just that you are able to use plain functions (without objects) and pass them around. By that definition, C is functional language, as scheme or lisp or javascript and many others. I don't know why, but some years ago, "functional programmers" started to change and twist the definition of functional language step by step, until all those languag…
Re: Hey, C Is a Functional Language Too
#28 int main(int argc, char * argv[]) {
(void)argc;
(void)argv;
I've programmed C while in school, but I don't remember ever seeing this and I'm not sure how to google it.Re: Hey, C Is a Functional Language Too
#29...and pigs can fly, if you throw them fast enough. This is just an encoding of a Turing-complete language into another, I don't see what's been demonstrated here.
>The main limitation is that you need to know the size of the return value.
Re: Hey, C Is a Functional Language Too
#30Quick question: why does he do this? int main(int argc, char * argv[]) { (void)argc; (void)argv; I've programmed C while in school, but I don't remember ever seeing this and I'm not sure how to google it.
http://stackoverflow.com/questions/8052091/void-cast-of-argc...