Based on some advice I found on StackOverflow, I'm digging into Haskell. I was pleased to see that Haskell's parameterized types behave very much like C# generics. Both languages advise a single letter for the type parameter (usually), and both languages seem to follow a similiar process for substituting an actual type for the type param...
Hey guys, I'm trying to get my head around LINQ and FP, so forgive me if this is naive. I'm trying to do some string parsing using LINQ and mapping onto a function, so I need to split my string up into smaller strings.
I want to split the array up into smaller lists of two. Can I use a reduce (.Aggregate()) to do this? I was trying t...
I have a discriminated union that I want to use as an argument for a function I'm exposing in a signature file. Currently I have the code defined as such:
Signature.fsi:
type Union =
| Part of string
| Part2 of int
val Func: Union -> unit
With Func being defined in a seperate fs file.
The problem is when I do this the fs file can't...
I would like to create a delegate and a method that can be used to call any number of Web services that my application requires:
Example:
public DateCheckResponseGetDate(DateCheckRequest requestParameters)
{
delegate object WebMethodToCall(object methodObject);
WebMethodToCall getTheDate = new WebMethodToCall(WebServices.GetTh...
NOTE : i don't agree btw this is a double question. Please read carefully.
I want to know more than just production/studying. Maybe I should lay another accent then and rephrase it? One of my questions is :
for GUI
for diff. OS ? Windows?
for anything you can come up with: a general positioning of functional languages thus.
I know t...
I'm only a novice programmer (I do it for fun) and I'm coming from the world of Python/C++/other procedural languages, and procedural style of problem solving. I fell in love with OCaml's simplicity after being boggled by its functional style for about a week. Since I'm not an engineer or mathematician, what are some helpful books or res...
I get confused when I see examples of self invoked anonymous functions in Javascript such as this:
(function () { return val;}) ();
Is there a difference between this syntax and the following:
function() { return val;} ();
If someone can give me a concrete difference, it would help put to rest a question that's been bugging me for ag...
I was playing with recursive lambdas in C# and have found two approaches to do this on the web. One approach uses fixed point combinator and the other does not. In the code below f1 is built using combinator, and f2 is defined directly. My question is, do we need fixed point combinators in C# or the language already provides all we need,...
I feel the term rather pejorative. Hence, I am flabbergasted by the two sentences in Wikipedia:
Imperative programming is known for
employing side effects to make
programs function. Functional
programming in turn is known for its
minimization of side effects. [1]
Since I am somewhat Math-biased, the latter sounds excellen...
I recently discovered Ruby's blocks and yielding features, and I was wondering: where does this fit in terms of computer science theory? Is it a functional programming technique, or something more specific?
...
I would love to use closures in Java. I have read that they may or may not make it into Java 7. But an open-source project called functional-java has implemented functional features including closures.
How safe would it be to use such a library in an enterprise production app?
Is there a better way to add closures to Java currently?
...
I was reading the following question - How safe would it be to use functional-java to add closures to a Java production project? and I had been thinking of using the Functional Java project as well in my current project. I was wondering what are Stack Overflow's users experiences with using the Functional Java project? In particular, I'm...
Given a list of objects i need to return a list consisting of the objects and the sum of a property of the objects for all objects in the list seen so far.
More generally given
var input = new int[] {1,2,3}
I would like to have the output of
// does not compile but did not want to include extra classes.
var output = { (1,1), (2,3)...
I know a few programmers who keep talking about Haskell when they are among themselves, and here on SO everyone seems to love that language. Being good at Haskell seems somewhat like the hallmark of a genius programmer.
Can someone give a few Haskell examples that show why it is so elegant / superior?
...
It seems to me that functional programming is a great thing. It eliminates state and makes it much easier to automatically make code run in parallel.
Many programmers who were first taught imperative programming styles find it very difficult to learn functional programming, because it is so different. I began to wonder if programmers wh...
I am trying to learn Haskell, and I really like it, but I can't wrap my head around most of it. Would Lisp, OCaml, etc. be a gentler introduction to functional programming?
...
I would like to write a bit of code that calls a function specified by a given argument. EG:
def caller(func):
return func()
However what I would also like to do is specify optional arguments to the 'caller' function so that 'caller' calls 'func' with the arguments specified (if any).
def caller(func, args):
# calls func with th...
I'm working through Real World Haskell, and at the moment doing the exercises at the end of Chapter 3.
I'm taking an unusual approach: even though I know there are some language features they haven't covered yet that would help me, I am trying to do these exercises using only things they have explicitly covered. Why? Just kind of for fu...
In purely functional languages, data is immutable. With reference counting, creating a reference cycle requires changing already created data. It seems like purely functional languages could use reference counting without worrying about the possibility of cycles. Am is right? If so, why don't they?
I understand that reference counting i...
I am really new to Haskell (Actually I saw "Real World Haskell" from O'Reilly and thought "hmm, I think I'll learn functional programming" yesterday) and I am wondering: I can use the construct operator to add an item to the beginning of a list:
1 : [2,3]
[1,2,3]
I tried making an example data type I found in the book and then playing...