The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘Functional Programming’ Category

Excel: sorting an array on 3 different columns using functions

Posted by jpluimers on 2025/09/09

Given Excel is the most popular functional language (see the video under my post “Everybody should have an obsession with Lisp-like language at least once in their life” @KevlinHenney), this post is on sorting with Excel functions.

I had an array in Excel starting at row 2 (to exclude the headings) where I had to sort on 3 different columns: C, A, B (or numerically 3, 1, 2) so [Wayback/Archive] sorting – How to multi level sort an array in excel, using formulas? I am aware about the way, using SORT button on DATA tab – Stack Overflow (thanks [Wayback/Archive] Armaan Gohil and [Wayback/Archive] Jos Woolley) didn’t fully apply but did put me on the right track as I wasn’t aware that the SORT function allows to specify multiple columns using an embedded array argument.

The functions that worked:

Read the rest of this entry »

Posted in Development, Excel, Functional Programming, Office, Power User, Reddit, SocialMedia, Software Development | Tagged: | Leave a Comment »

Alan Turing Wrote Object-Oriented Code In C And Ran It On BEAM – De Programmatica Ipsum

Posted by jpluimers on 2025/07/16

I originally missed this as back then I was in the midst of managing trouble in my parental family, unaware I was already having rectum cancer. Then things went fast, not even including the Covid-19 years, so I was glad last year I got reminded of this mid-2019 article:

[Wayback/Archive] Alan Turing Wrote Object-Oriented Code In C And Ran It On BEAM – De Programmatica Ipsum writes a lot of interesting things on programming paradigms, starting with

In his rare 1994 book “Object-Oriented Programming In C” Axel Tobias Schreiner explains how to do inheritance, class methods, class hierarchies, and even how to raise exceptions using nothing else than pure, simple, pointer arithmetic-filled, ANSI C.

then arguing basically most of not all modern languages share the majority of programming paradigms and all these paradigms are repeats of the past:

These days, we are using the offsprings of multiple programming paradigms having unprotected sex with one another in a thoughtful orgy. PHP, C#, Perl, C++ and even Visual Basic have all closures, lambdas or anonymous functions now. F# and Scala can instantiate any class included in their corresponding vendor-provided frameworks. JavaScript implements functions as objects with a single method .call(). Haskell comonads are actually objects. Swift 1.0 implemented instance methods as curried functions.
But none of this is new. Smalltalk, arguably the precursor of object orientation, had collect and select methods which were the grandparents of our more common map and filter functional friends.

What sets modern languages apart is that they the majority covers all the paradigms you might need, just differing in how well they support the paradigm-du-jour.

It means programming language wars should have been a thing of the past for about two decades now.

Please let that sink in.

 

Oh: if you look for that ANSI C book, here it is: [Wayback/Archive] https://www.cs.rit.edu/~ats/books/ooc.pdf [Wayback PDF View/PDF View]

 

Via: [Wayback/Archive] De Programmatica Ipsum: “”In his rare 1994 book “Object…” – mas.to

--jeroen

Posted in .NET, C, C#, C++, Cloud, COBOL, Containers, Design Patterns, Development, Docker, Erlang, F#, Go (golang), Haskell, Infrastructure, Java, Java Platform, Kotlin, Kubernetes (k8n), ObjectiveC, OOP (Object Oriented Programming), Perl, Scala, Scripting, Software Development, Swift, VB.NET | Leave a Comment »

Henk van Ess on the Google indexing and search algorithms

Posted by jpluimers on 2024/06/11

Many articles have been published on the Google Leaks earlier this year including a Twitter Thread by Henk van Ess. I will mention his and the original starting article which should give anyone hand and feet to dig deeper and assess for themselves how fast Google might be able to change this and get a feeling on much of it is still relevant over time.

A final note: I wasn’t aware that Google search used the Elixir (programming language) – Wikipedia. Cool!

--jeroen

Posted in Development, Elixir, Erlang, Functional Programming, Google, GoogleSearch, Power User, Software Development | Leave a Comment »

Kevlin Henney on Twitter: “#FizzBuzzFriday… ” Python table lookup versus C# functional programming

Posted by jpluimers on 2022/12/27

[Archive.is] Kevlin Henney on Twitter: “#FizzBuzzFriday… “.

Related: [Wayback] Your C# is already functional, but only if you let it | In Absentia:

A few days ago I tweeted a C# code snippet, showing a FizzBuzz implementation using some of the new features in C# 8.0. The tweet “went viral”, as the kids say, with several people admiring the terse

–jeroen

Read the rest of this entry »

Posted in .NET, C#, Development, Functional Programming, Python, Software Development | Leave a Comment »

A series of Medium posts introducing functional programming in manageable bits and pieces

Posted by jpluimers on 2020/09/30

I have summarised the main topics of each part in this table of contents, and indicated at the time of writing which parts I did not get yet:

  1. [WayBack] So You Want to be a Functional Programmer (Part 1) – Charles Scalfani – Medium
    • pure functions (only operate on input parameters: without side effects)
    • immutability (no variables! loops through recursion)
  2. [WayBack] So You Want to be a Functional Programmer (Part 2) – Charles Scalfani – Medium
    • refactoring leads to the need of higher-order functions
    • higher-order functions: passing a function as a parameter, or returning functions as a result
    • closure: when a returned function has access to the captured parameter(s) of the function creating the returned function
  3. [WayBack] So You Want to be a Functional Programmer (Part 3) – Charles Scalfani – Medium
    • functional decomposition (I still need to wrap my head around this)
    • point-free notation (same)
    • both lead to currying (which I also need to wrap my head around)
  4. [WayBack] So You Want to be a Functional Programmer (Part 4) – Charles Scalfani – Medium
    • currying: when you want to combine functions having different parameter counts
    • refactoring based on currying (I still need to wrap my head around this)
    • map/filter/reduce functional building blocks (I still need to wrap my head around this)
  5. [WayBack] So You Want to be a Functional Programmer (Part 5) – Charles Scalfani – Medium
    • referential transparency (I still need to wrap my head around this)
    • execution order: in a pure functional language the compiler can determine the order when functions are completely independent
    • type annotation: I do not yet get why you would do without this
  6. [WayBack] So You Want to be a Functional Programmer (Part 6) – Charles Scalfani – Medium
    • Functional JavaScript and ELM: two functional languages, of which Ramba can help make better JavaScript code

Via: [WayBack] So You Want to be a Functional Programmer (Part 1) Link to part 2 in the article. https://medium.com/@cscalfani/so-you-want-to-be-a-functional-programm… – Lars Fosdal – Google+

–jeroen

Posted in Conference Topics, Conferences, Development, Event, Functional Programming, Software Development | Leave a Comment »

Great video “Why Functional Programming Matters”, by Ted Neward on getting started with Functional Programming

Posted by jpluimers on 2019/10/10

Great introduction into functional programming by a step by step: “Why Functional Programming Matters”, by Ted Neward on Devoxx Poland 2016.

It uses Java, but translates very well into C#, C++, Delphi and many other programming languages because the underlying support structures are very easy (a ~50 line Lists class, a few Function# prototypes, etc).

Two great observations here:

  • most variables don’t vary
  • collections are the gateway drug to becoming functional programmers

Summary

Coding Tech

In the latter half of the 2000s, a new kind of programming language seemed poised to take the steam out of the dominancen of object-oriented programming languages and their hold over “mainstream” development. But these new languages, collectively referred to as “functional” languages, were nothing new. In fact, they’ve been a part of the language landscape since the late 80s, and arguably even longer than that. What makes a functional language, and what makes a functional language interesting? Most importantly, why do we care now, thirty years after their introduction?

https://www.youtube.com/watch?v=oB8jN68KGcU

–jeroen

Read the rest of this entry »

Posted in Conference Topics, Conferences, Development, Event, Functional Programming, Software Development | Leave a Comment »

“Functional programmer: (noun) One who names variables ‘x’, names functions ‘f’, and names code patterns ‘zygohistomorphic prepromorphism.'” — James Iry on Twitter

Posted by jpluimers on 2019/09/04

“Functional programmer: (noun) One who names variables ‘x’, names functions ‘f’, and names code patterns ‘zygohistomorphic prepromorphism.'” — James Iry

–jeroen

Read the rest of this entry »

Posted in Development, Fun, Functional Programming, Quotes, Software Development, T-Shirt quotes | Leave a Comment »

Functional programming in C# – CodeProject

Posted by jpluimers on 2018/04/04

Interesting stuff:

This article discusses functional programming in C# through algebra, numbers, euclidean plane and fractals.

[WayBackFunctional programming in C# – CodeProject

Not the least because of images like below.

–jeroen

.

Posted in Development, Functional Programming, Software Development | Leave a Comment »

Robert C Martin – Functional Programming; What? Why? When? – YouTube

Posted by jpluimers on 2016/12/26

Great after X-mas watch: Robert C Martin – Functional Programming; What? Why? When? – YouTube subtitled “the failure of state”.

Thanks [WayBackAndrew Rohn – YouTube for the timestamp list:

  • 4:07 “Functional Programming: What? When? Why?” or “The Failure of State”
  • 5:10 Rich Hickey is the author of Clojure. Listen to his talks. 5:40 What is state? Variables.
  • 11:15 Structure and Interpretation of Computer Programs. This is a fascinating book. For the first 250 pages, the book uses no assignment statements.
  • 14:15 Here’s how SICP’s model of computing worked before they introduced an assignment statement. Simply replace a function call with its implementation.
  • 15:58 Once you introduce assignment. You can no longer replace a function call with its implementation. Why? Because the state of the system may have changed. An assignment statement introduces the concept of time.
  • 18:04 Side effect: an assignment statement. If there’s no assignment, there’s no side effect.
  • 20:22 What “hack” have we done to protect us from memory leaks? Garbage collection.
  • 31:46 Functional programming was invented in 1957 before OO and structured. But memory was too expensive to make it practical. But memory is cheap now.
  • 32:53 Should we change how we program? We should because: 1) Functional programs are simpler – which makes them easier to write and maintain 2) There’s no temporal coupling – no worrying if some function was called before another function. 3) Fewer concurrency issues. In a purely functional program, there’s no concurrency because there is no state. 4) No asking, “What’s the state?”
  • 38:38 We’re using multicore CPU’s now because we can’t increase clock rate anymore. And hardware makers are doing bizarre tradeoffs. They’re making individual processors slower but putting more processors in. So individual cores slow down but the chip throughput goes up if you can take advantage of all the cores.
  • 42:00 How are you going to work with an abundance of cores? Maybe we need to walk away from the assignment statement.
  • 49:49 OO = procedure + state. OO is exposed procedure but hidden state (encapsulation). It’s possible to write functional programs using an OO style. All of the objects become immutable.

–jeroen

Posted in Design Patterns, Development, Functional Programming, Software Development | Leave a Comment »