functional-programming

Javascript can implement OOP but Ruby can't implement functional programming?

Im new to "real" Javascript:ing and I know understand more of functional programming. It seems that in Javascript you get the best from both worlds: functional and object oriented programming. But in Ruby, you don't have first class functions (function as a datatype). Does this mean that Javascript embraces the best of the both worlds...

Rationale behind renaming of higher order list operations

What was the rationale behind renaming of higher order list operations in C#? (Examples: map -> Select, filter -> Where, fold -> Aggregate) ...

pure/const functions in C++0x

Hi, In C++98/C++03, there are no pure/const function keywords in the language. Has this changed in C++0x? If so, is it possible to set such a flag even on function objects (std::function)? So I can pass some function pointer or lambda functions and additional give the information that it is a pure/const function? The called function m...

Nesting Function Calls

Hey all, This has been driving me absolutely nuts. I have a substitute function like this: (define (mysub x bind body) ;; x, bind, body are lists ...) I need to call the function like this: ;;this is the explicit call for when length x = length bind = 2. ;;how do I generalize these nested calls? ;;in case it's not obvious, i'm ...

In Haskell, why non-exhaustive patterns are not compile-time errors?

This is a follow-up of http://stackoverflow.com/questions/3799359/why-am-i-getting-non-exhaustive-patterns-in-function-when-i-invoke-my-haskel I understand that using -Wall, GHC can warn against non-exhaustive patterns. I'm wondering what's the reason behind not making it a compile-time error by default given that it's always possible ...

Which Functional programming language offers best support in Eclipse?

As an exercise my team is looking at learning functional programming. One of the factors to choose a language is its support in Eclipse. Any language with Eclipse plug-in is fine but what language offers the best free plug-in? Bonus question: the best online/book tutorial for this language. ...

C++0x template function object inference

I'm a Scala/Java programmer looking to reintroduce myself to C++ and learn some of the exciting features in C++0x. I wanted to start by designing my own slightly functional collections library, based on Scala's collections, so that I could get a solid understanding of templates. The problem I'm running into is that the compiler doesn't s...

Recursion runtime implementation Java vs. other/functionals languages?

I like recursion, but at Java you meet an dead end at some point. E.g. I had a case where recursion with ~100K iterations wouldn't work (StackOverflowError). Badly I had to switch to annoying "imperative looping" for this runtime stack-limit reasons. I wonder how other (especially functional) languages bypass stack-overflowing during r...

What's the opposite of the term "closed over"?

Consider the following (C#) code. The lambda being passed to ConvolutedRand() is said to be "closed over" the variable named format. What term would you use to describe how the variable random is used within MyMethod()? void MyMethod { int random; string format = "The number {0} inside the lambda scope"; ConvolutedRand(x =>...

Are there any MVC web frameworks for Haskell?

Are there any MVC web frameworks for Haskell? ...

What are some uses of closures for OOP?

PHP and .Net have closures; I have been wondering what are some examples of using closures in OOP and design patterns, and what advantages they have over pure OOP programming. As a clarification, this is not a OOP vs. functional programming, but how to best use closures in a OOP design. How do closures fit in, say, factories or the obse...

Functional code examples in ruby

Hi, I'm looking for examples of functional code in ruby. Maybe you know some gems, where I can find such a code? ...

Functional/Immutable Data Structures for the JVM?

Does anyone know of a Java/JVM data structure library providing functional (a.k.a. immutable, or "persistent" in the functional sense) equivalents of the familiar Java data structures? By "functional" I mean that the objects themselves are immutable, while modifications to those objects return new objects sharing the same internals as t...

Is Scala for me? (C# developer with focus on functional / OOP style)

I want to learn a new programming language and develop for the Android platform. I'm a fulltime C# / F# - developer and I also use C# in the most functional way possible (because I like this paradigm far better than the old skool style "lets iterate and describe to the barkeeper how to make the cocktail", to quote Microsoft). However, ...

Two functions or boolean parameter?

Hi, Is there some rule when to use two functions or when to pass boolean parameter. Thanks ...

Advantages of subtyping over typeclasses

What are the advantages of OOP subtyping over typeclasses, if any? In other words, now that we have typeclasses, is there any reason to still use OOP subtyping? PS: I am a Scala programmer. ...

Understanding and using the Boost Phoenix Library with a focus on lazy evaluation

I just found out about the Boost Phoenix library (hidden in the Spirit project) and as a fan of the functional-programming style (but still an amateur; some small experience with haskell and scheme) i wanted to play around with this library to learn about reasonable applications of this library. Besides the increasement of expressivenes...

How do functional languages model side-effects?

Since side-effects break referential transparency, don't they go against the point of functional languages? ...

How does Java drag C++ coders "halfway to Lisp?"

Possible Duplicate: How is Java inspired by Lisp? From Paul Graham: "We were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp." Guy Steele, co-author of the Java spec I've thought about this, and it just doesn't make any sense. Out of all the "Lisp-ish" features on Graham'...

In functionally programmed javascript, is there any penalty to returning a callback rather than just calling a callback?

I do this out of habit: function process( fn ){ // Some process that builds data return fn( data ); } It is not always necessary to return the callback, and I would like to know if there is any performance hit in doing that over simply calling the callback: function process( fn ){ // Some process that builds data fn( dat...