Tag: functional

C# 9.0 Immutable Records – Yes!

Mads Torgersen, C# Lead Designer recently posted about development for upcoming C# 9.0. There’s a whole bunch of features that made me say Yes, Do It, When Can I Get It, Just Yes! But first a story to explain why I’m so enthusiastic. F# What? I thought this was about C#! Patience, grasshopper… Project Last year I was lucky enough to build a small system in F#. I work for a large company with development mostly in C# and TypeScript. We’re in the middle of a major shift into the cloud so there’s a lot of learning going on for…

Read More »

C++ Boost::Range vs .NET LINQ vs Scala

In my day-job most of my development is in C++ so I’m always comparing ideas from other languages against what’s available in C++. I’ve been experimenting with boost::range, a C++ library that makes it easier to compose algorithms in a functional style. I’m comparing it to .NET LINQ and to for-comprehensions in Scala. My example: List of orders, each order has a discount and list of order-items. We want the total cost of all Bread items with discounts applied. Scala for-comprehension def orders: List[Order] = List( new Order( 25, List( new OrderItem("Eggs", 12, 0.50), new OrderItem("Bread", 4, 1.25) ) ),…

Read More »

Functional Programming in C++

This is not a new topic, and there have been plenty of comments recently from various C++ developers. But most comments are only about lambdas and using them as higher-order functions.  While I can’t claim any deep knowledge of functional programming (some experience with functional techniques in Scala, F# and C#) I can’t help think the real functional programmers are laughing at us for missing the point. Yes it’s called function-al programming, functions are in the name, but that doesn’t mean functions are the only important feature to consider before we can make use of functional techniques in C++. Possibly…

Read More »