functional-programming

Where can F# actually save time and money?

There is a lot of hype around the latest functional programming language F# from Microsoft. In real life - where (in what kind of scenarios) can F# most likely save time and money? ...

Generic List Extensions in C#

I am writing a few extensions to mimic the map and reduce functions in Lisp. public delegate R ReduceFunction<T,R>(T t, R previous); public delegate void TransformFunction<T>(T t, params object[] args); public static R Reduce<T,R>(this List<T> list, ReduceFunction<T,R> r, R initial) { var aggregate = initial; foreach(var t in...

I just don't get continuations!

What are they and what are they good for? I do not have a CS degree and my background is VB6 -> ASP -> ASP.NET/C#. Can anyone explain it in a clear and concise manner? ...

how do F# Units of Measure work

Has anyone had a chance to dig into how F# Units of Measure work? Is it just type-based chicanery, or are there CLR types hiding underneath that could (potentially) be used from other .net languages? Will it work for any numerical unit, or is it limited to floating point values (which is what all the examples use)? ...

Best (functional?) programming language to learn coming from Mathematica

As a mechanical engineering PhD student, I haven't had a great pedigree in programming as part of my “day job”. I started out in Matlab (having written some Hypercard and Applescript back in the day, and being introduced to Ada, of all things, in my 1st undergrad year), learned to program—if you can call it that—in (La)TeX; and finally d...

Pass functions in F#

Is it possible to pass a reference to a function to another function in F#? Specifically, I'd like to pass lambda functions like foo(fun x -> x ** 3) More specifically, I need to know how I would refer to the passed function in a function that I wrote myself. ...

What are the primary differences between Haskell and F#?

I've searched on the Internet for comparisons between F# and Haskell but haven't found anything really definitive. What are the primary differences and why would I want to choose one over the other? ...

What is a monad?

Having briefly looked at Haskell recently I wondered whether anybody could give a brief, succinct, practical explanation as to what a monad essentially is? I have found most explanations I've come across to be fairly inaccessible and lacking in practical detail, so could somebody here help me? ...

Can I Do This In Lisp?

I have been searching everywhere for this functionality in lisp, and have gotten nowhere. find the index of something in a list. example: (index-of item InThisList) replace something at a specific spot in a list. example: (replace item InThisList AtThisIndex) ;i think this can be done with 'setf'? return an item at a specific index. ...

Mapping collections with LINQ

I have a collection of objects to which I'd like to just add a new property. How do I do that with LINQ? ...

How can a simple tree algorithm be coded in a functional language?

Suppose I want to implement a reasonably efficient 'keyword recognition algorithm', that is first given a list of keyword, and must then answer if another given word was in the list. In an imperative language, I would store the keywords in a tree (one node per character). Then, when receiving a word to test, I would scan my tree to tes...

Favorite advanced F# tutorial

I am looking into F# and have read a few "Hello World!" intros that shows off the very basic syntax of the language. I am now ready to move on and try more advanced features, ie. functional programming styles. So my question is: What is your favorite advanced level tutorial on F#. I am not interested in basic introductions! ...

Haskell list difference operator in F#

Is there an equivalent operator to Haskell's list difference operator \\ in F#? ...

How to define and use static variables in F# class

Is there a way to have a mutable static variable in F# class that is identical to a static variable in C# class ? ...

Anyone got --standalone option to work in F# CTP?

I may have this completely wrong, but my understanding is that the --standalone compiler option tells the compiler to include the F# core and other dependencies in the exe, so that you can run it on another machine without installing any 'runtime'. However, I can't get this to work in the CTP - it doesn't even seem to change the size of...

What languages implement features from functional programming?

Lisp developed a set of interesting language features quite early on in the academic world, but most of them never caught on in production environments. Some languages, like JavaScript, adapted basic features like garbage collection and lexical closures, but all the stuff that might actually change how you write programs on a large scal...

Prototype's Enumerable#pluck in F#?

In JavaScript, using the Prototype library, the following functional construction is possible: var words = ["aqueous", "strength", "hated", "sesquicentennial", "area"]; words.pluck('length'); //-> [7, 8, 5, 16, 4] Note that this example code is equivalent to words.map( function(word) { return word.length; } ); I wondered if somethi...

Is there a Functional Programming library for C# .NET?

For example, in Java there is Functional Java and Higher-Order Java. Both essentially give a small API for manipulating higher-order, curried functions, and perhaps a few new data types (tuples, immutable lists). ...

macro support in F#

After reading Practical Common Lisp I finally understood what the big deal about macros was, and I have been looking for a language for the .NET platform that supports this. There are a few lisp dialects for .NET but from what I have been able to gather all are either very beta or abandoned. Recently my interest has been sparked by Cloju...

Functional Programming Architecture

I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but is there anything characteristic about a software architecture for a system written in a functional programming language? I know ...