functional-programming

Applicative functors other than monads and ZipList?

Two well-known examples of applicatives are monads and ziplists. Are there any other examples? ...

The difference between MapReduce and the map-reduce combination in functional programming.

I read the mapreduce at http://en.wikipedia.org/wiki/MapReduce ,understood the example of how to get the count of a "word" in many "documents". However I did not understand the following line: Thus the MapReduce framework transforms a list of (key, value) pairs into a list of values. This behavior is different from the functional pro...

Functional Programming Documentation

Is there any standard documentation (like UML for OO) for functional languages? After downloading couch db which is written in erlang and looking at the source code I was shocked, there is hardly a line of documentation. Is there no need to document how all these functions depend on each other? Are there better documented medium size pro...

Help with Predicate<T> delegate

Hello, I am trying to create an overloaded Add method as an extension to the OrderedDictionary class and would like to add the key/value based on some curried predicate. The calling code would look like this: OrderedDictionary dict = new OrderedDictionary(); Predicate<int> lessThan5 = i=>; i < 5; Predicate<string> lenOf2 = s=> s.le...

Examples of useful or non-trival dual interfaces

Recently Erik Meijer and others have show how IObservable/IObserver is the dual of IEnumerable/IEnumerator. The fact that they are dual means that any operation on one interface is valid on the other, thus providing a theoretical foundation for the Reactive Extentions for .Net Do other dual interfaces exist? I'm interested in any exampl...

Difference between Seq.map and Seq.collect in F#

In F#, what is the difference between functions "Seq.collect" and "Seq.map"? They seem equivalent from the description on MSDN. ...

Is there a typical name for a function like 'map' that operates on a list of argument lists instead of multiple lists of arguments?

(I finally posted and accepted an answer to the effect of "no, there isn't, and the question isn't actually that general".) Consider the Common Lisp function 'mapcar'. It takes a function and some lists as arguments, and calls the function with arguments pulled from the same position in each list. Do standard libraries typically have a...

What is an FFP machine?

In R. Kent Dybvig's paper "Three Implementation Models for Scheme" he speaks of "FFP languages" and "FFP machines". Apparently there is some correlation between FFP machines, and string-reduction on multiple processors. Googling doesn't really uncover much in terms of explanations or examples. Can anyone shed some light on this topic? ...

Haskell sort funtion

Why does Haskell's sort of Data.List ignore the third digit? Prelude>sort ["1","200","234","30"] ["1","200","234","30"] EDIT: Sorry, I did not realized that were string. My fault. ...

What are the alternative of monads to use IO in pure functional programming?

monads are described as the haskell solution to deal with IO. I was wondering if there were other ways to deal with IO in pure functional language. ...

How would you approach mentally wise in learning F#

I would like to learn F#, mentally wise, it is a different way of programming, how would you shift away from the OOP paradigm in learning the functional aspects of the language itself? I know I run the risk of getting this closed as it is subjective... Any tips/advice would be appreciated. Best regards, Tom. ...

boost::function and boost::bind are cool, but what is really cool about boost::lambda ?

On Page 175 Paragraph 1 of Effective C++ Meyers has this to say about generalized functors and binding: I find what tr1::function lets you do so amazing, it makes me tingle all over. If you're not tingling , it may be because you're staring at the definition of ... and wondering what's going on with the .... And I agree w...

What is F# ? Which problem it solves that C# can't ?

I recently heard about F# in coming. I wonder why .NET world need another programming language ? What the deal? Is there a problem that C# cant solve and F# can? Is F# a dynamic language? [Update :Be careful not to confuse type inference with dynamic typing. Although F# allows you to omit types when writing code, that doesn’t mean...

Multithreading in... functional languages? (Prolog)

When my friend started learning Prolog in school, I made fun of him for learning a useless language. However, he's showed me some stuff I never even knew possible; I want to know where this technique comes from. The technique is this: permutation(List) :- isAMember(X, List), deleteFirstElement(X, List, Substring), % and so...

"int -> int -> int" What does this mean in F# ?

I wonder what this means in F#. “a function taking an integer, which returns a function which takes an integer and returns an integer.” But I don't understand this well. Can anyone explain this so clear ? [Update]: > let f1 x y = x+y ;; val f1 : int -> int -> int What this mean ? ...

In F#, what does pipelining mean?

I was reading this article by Tomas Petricek, and it mentioned the pipelining |> as in the example given: > let nums = [1; 2; 3; 4; 5];; val nums : list<int> > let odds_plus_ten = nums |> List.filter (fun n-> n%2 <> 0) |> List.map (add 10) val odds_plus_ten : list<int> = [11; 13; 15];; What does pipelining m...

Which functional programming language should I choose as first functional programming language?

I would like to learn a functional programming language to see a different programming paradigm. My background in programming: Java (I have just passed the SCJP exam), some ruby and very limited Rails. I use bash for basic sysadmin tasks. I use Ubuntu 9.04. As a second goal I would like to use fp to show kids (14-18 years olds) how mat...

Domain Driven Design in Functional Programming?

It may sound like a stupid idea but I was just wondering if there is an equivalent of DDD in FP? It seems to me that DDD is only valid in OOP paradigm. Thanks. ...

Non-deterministic programming languages

I know in Prolog you can do something like someFunction(List) :- someOtherFunction(X, List) doSomethingWith(X) % and so on This will not iterate over every element in List; instead, it will branch off into different "machines" (by using multiple threads, backtracking on a single thread, creating parallel universes or what...

convert string to list in Standard ML

Possible Duplicate: Open file in ML(SMLNJ) I have a string value which has value like this: "[(1,2,3),(2,3),(6,8)]" -> string but I want to have these values in int type like this: [(1,2,3),(2,3),(6,8)] -> (int list) list what should I do?is there any function which can help me? or I have to do it myself? ...