tagged [functional-programming]

C# - IEnumerable to delimited string

C# - IEnumerable to delimited string What is the functional programming approach to convert an `IEnumerable` to a delimited string? I know I can use a loop, but I'm trying to wrap my head around funct...

23 Dec at 17:12

Does JavaScript have a method like "range()" to generate a range within the supplied bounds?

Does JavaScript have a method like "range()" to generate a range within the supplied bounds? In PHP, you can do... That is, there is a function that lets you get a range of numbers or characters by pa...

Use attributes for value tuples

Use attributes for value tuples In C# 7.0, .NET introduces a new return value tuple types (functional programming), so instead of: I'd like to use value tuples: And I want to use attributes for these ...

Function point to kloc ratio as a software metric... the "Name That Tune" metric?

Function point to kloc ratio as a software metric... the "Name That Tune" metric? What do you think of using a metric of function point to lines of code as a metric? It makes me think of the old game ...

28 Oct at 17:48

When to use closure?

When to use closure? I have seen samples of closure from - [What is a 'Closure'?](https://stackoverflow.com/questions/36636/what-is-a-closure) Can anyone provide simple example of when to use closure?...

23 May at 11:46

List of strings to one string

List of strings to one string Lets say you have a: In this crazy functional world we live in these days which one of these would be best for creating one string by concatenating these: ``` String.Join...

What is difference between functional and imperative programming languages?

What is difference between functional and imperative programming languages? Most of the mainstream languages, including object-oriented programming (OOP) languages such as C#, Visual Basic, C++, and J...

22 Aug at 12:37

C# operators as functions

C# operators as functions Is there a way to use operators as functions without declaring them manually? Similar to `(+)`/`(-)` in Haskell. Would be handy in various LINQ scenarios involving conditiona...

16 Dec at 23:25

How safe would it be to use functional-java to add closures to a Java production project?

How safe would it be to use functional-java to add closures to a Java production project? 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-so...

How would you implement LINQ methods with SelectMany?

How would you implement LINQ methods with SelectMany? > Erik Meijer is fond of pointing out that every LINQ function could actually be implemented by SelectMany; everything else is just a convenience....

Can Nullable be used as a functor in C#?

Can Nullable be used as a functor in C#? Consider the following code in C#. The last line will return a compilation error `cannot convert from 'int?' to 'int'` which is fair enough. However, for examp...

Examples of useful or non-trival dual interfaces

Examples of useful or non-trival dual interfaces Recently Erik Meijer and others have show how `IObservable/IObserver` is the [dual](http://en.wikipedia.org/wiki/Dual_(category_theory)) of `IEnumerabl...

Wrapping my head around OCaml

Wrapping my head around OCaml 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 ...

14 Apr at 14:10

Converting Func<> types

Converting Func types Trying to cast f2 to f1: Tried map function to solve but, this time i get exception. on tranform(a) function ``` Func

30 Jan at 08:40

What are the kinds of covariance in C#? (Or, covariance: by example)

What are the kinds of covariance in C#? (Or, covariance: by example) Covariance is (roughly) the ability to of "simple" types in complex types that use them. E.g. We can always treat an instance of `C...

Removing elements with Array.map in JavaScript

Removing elements with Array.map in JavaScript I would like to filter an array of items by using the `map()` function. Here is a code snippet: The problem is that filtered out items still uses space i...

What is the difference between Scala's case class and class?

What is the difference between Scala's case class and class? I searched in Google to find the differences between a `case class` and a `class`. Everyone mentions that when you want to do pattern match...

How to use underscore.js as a template engine?

How to use underscore.js as a template engine? I'm trying to learn about new usages of javascript as a serverside language and as a functional language. Few days ago I heard about node.js and express ...

Is there a way to make this slideshow move automatically?

Is there a way to make this slideshow move automatically? This is the slideshow that we used: [http://www.littlewebthings.com/projects/blinds/](http://www.littlewebthings.com/projects/blinds/) and thi...

What are the advantages of built-in immutability of F# over C#?

What are the advantages of built-in immutability of F# over C#? 1. I heard F# has native support for immutability but what about it that can not be replicated in C#? What do you get by an F# immutable...

How much is there to LINQ?

How much is there to LINQ? I'm looking into LINQ and the query language appears (at least on the surface) to be nothing more than an implementation of map and/or list comprehensions as found in Haskel...

13 Sep at 17:0

In what areas does F# make "absolute no sense in using"?

In what areas does F# make "absolute no sense in using"? Don Syme in his SPLASH talk says that F# is NOT intended to be a replacement for C# even though it has the general capabilities. He goes on to ...

20 Jun at 09:12

How do I use the includes method in lodash to check if an object is in the collection?

How do I use the includes method in lodash to check if an object is in the collection? lodash lets me check for membership of basic data types with `includes`: But the following doesn't work: This con...

Generic Map/Reduce List Extensions in C#

Generic Map/Reduce List Extensions in C# I am writing a few extensions to mimic the map and reduce functions in Lisp. ``` public delegate R ReduceFunction(T t, R previous); public delegate void Transf...

What is a catamorphism and can it be implemented in C# 3.0?

What is a catamorphism and can it be implemented in C# 3.0? I'm trying to learn about catamorphisms and I've read [the Wikipedia article](http://en.wikipedia.org/wiki/Catamorphism) and the first coupl...