Keep it Simple

// practice, the distance between dream and achievement

Tag: Linq (page 1 of 4)

F# Series ā€“ Tuple vs Anonymous Types

A tuple is a sequence of values. The values can be any type, a

nd they are indexed by integer, so tuples are not like lists. The most important difference is that tuples are immutable. Tuples are used whenever you want to return multiple results from a function.

It is good practice to enclose tuples in parentheses

t = (‘p’, ‘q’, ‘r’, ‘s’, ‘t’)

Tuple is not yet available in C#, however it shouldn’t be hard to create your own version.

Continue reading

F# Series – Functional programming in C#

Functional programming differs from the usual imperative and object oriented style in many ways, so Iā€™d like to talk about the basic concepts that are essential for functional programming. Functional programming is a paradigm which concentrates on computing results rather than on performing actions.

Let me give a quick example, I want to build a program that would support the following operations.

  1. It has to sum the numbers between the given range.
  2. It has to multiply the numbers between the given range.

Continue reading

What is Currying ?

Currying a method call breaks the single method into a chain of methods. Suppose that we have a simple function that takes two arguments and returns a value.

Continue reading

What is Closure?

In essence, a closure is a block of code which can be executed at a later time, but which maintains the environment in which it was first created – i.e. it can still use the local variables etc of the method which created it, even after that method has finished executing.

Continue reading

Older posts

© 2017 Keep it Simple

Theme by Anders NorenUp ↑