Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

18
  • 19
    Your functional example does use variables on the inside, but the language does all of it behind the scenes. You've effectively delegated the unpleasant parts to someone you believe has done it correctly. Commented Feb 15, 2013 at 13:47
  • 12
    @Blrfl: The "behind the scenes" argument kills all language-based debates, since every piece of code is ultimately translated to x86 machine code. x86 code is not object-oriented, not procedural, not functional, not anything, but these categories are valuable tags for programming languages. Look at the language, not the implementation. Commented Feb 15, 2013 at 14:52
  • 10
    @thiton Disagreed. What Blrfl is saying is that those functions probably use variables written in the same programming language. No need to go low-level here. The snippet is merely using library functions. You can easily write the same code in Java, see: squaresOf(integers()).take(25) (writing those functions is left as an exercise for the reader; the difficulty lies in the infinite set for integers(), but that's a problem for Java because of its eager evaluation, nothing to do with variables) Commented Feb 15, 2013 at 15:03
  • 6
    That quote is confusing and misleading, there's no magic there, just syntactic sugar. Commented Feb 15, 2013 at 15:04
  • 2
    @thiton I suggest you learn more about FP languages, but nevertheless, the code snippet doesn't support (or reject) the assertion that "variables" aren't needed (by which I assume you mean "mutable variables", because the other kind is common in FP). The snippet just shows library functions which could have been implemented in Java as well, barring lazy/eager problems which are offtopic here. Commented Feb 15, 2013 at 15:11