Years ago we wrote a simple article explaining differences between function composition in Elixir and Javascript.

Now it’s 2002 and the chat-GPT3 bot is out, so we decided to test it with the following task:

“what is the best functional language in terms of flexibility regarding as example function composition or currying. Explain differences between the mentioned languages with code examples”

The result is below… no edit from us. Really impressive…

It is difficult to determine which functional programming language is the “best” in terms of flexibility, as this can vary depending on the specific needs and requirements of a given project. However, some functional programming languages are known for their support for features such as function composition and currying, which can provide greater flexibility when writing functional code.

Function composition is the process of combining multiple functions to create a new function, and currying is the process of converting a function that takes multiple arguments into a series of functions that each take a single argument. Both of these features can make it easier to write modular, reusable code.

Some functional programming languages that are known for their support for function composition and currying include Haskell, Elixir, and F#. Here is an example of function composition and currying in each of these languages:

```-- Define some functions
addOne x = x + 1
multiplyByTwo x = x * 2
subtractThree x = x - 3

-- Create a new function by composing the above functions

-- Apply the new function to an input
-- Output: 5

```

Elixir:

```# Define some functions
x + 1
end

def multiply_by_two(x) do
x * 2
end

def subtract_three(x) do
x - 3
end

# Create a new function by composing the above functions
&multiply_by_two/1,
&subtract_three/1
)

# Apply the new function to an input
# Output: 5

```

F#:

```// Define some functions
let addOne x = x + 1
let multiplyByTwo x = x * 2
let subtractThree x = x - 3

// Create a new function by composing the above functions