Writing pure functions but have a chain I'm trying to play around with Godot to learn C# and I was trying to creating pure functions to do the velocity, but I found I was repeating myself.

    public override void _PhysicsProcess(float delta)
    {
        base._PhysicsProcess(delta);
        Vector2 moveVelocity = velocity;

        moveVelocity = Run(moveVelocity);
        moveVelocity = Jump(moveVelocity);
        moveVelocity = Dash(moveVelocity);
        moveVelocity = Friction(moveVelocity);
        moveVelocity = Gravity(moveVelocity);

        Animate();

        velocity = MoveAndSlide(moveVelocity, Vector2.Up);

    }


Is there a nicer way of doing the above method so I don't copy moveVelocity over and over but not change velocity or create a new class property?

Something like

velocity = Apply(velocity,
  Run,
  Jump,
  Dash,
  Friction,
  Gravity);
Not sure about your full implementation, but from what I see, you could do a fluent API
something like : 

public class PhysicsProcess
{
    private readonly float _delta; 
    private readonly Vector2 _velocity;

    public PhysicsProcess(Vector2 velocity)
    {
        _velocity = velocity;
    }

    public PhysicsProcess Run()
    {
        // Run logic which would be saved on the global variable 
        return this;
    }

    public PhysicsProcess Jump() { ... }

    public PhysicsProcess Dash() { ... }

    public PhysicsProcess Friction() { ... }

    public PhysicsProcess Gravity() { ... }

    public void Apply()
    {
        // Your final logic which would take all arguments, and do the process you need.        
    }

}


then your usage would be something like : 

var process = new PhysicsProcess(velocity)
.Run()
.Jump()
.Dash()
.Friction()
.Gravity()
.Apply();


You can then extend or customize each process as fits your needs. You can also make PhysicsProcess as nested class and call it from a method from the parent class. There are many approaches and customization can be done with fluent APIs, just choose the approach that you see it would be more reasonable to the existing logic (technically, and business-wise).

UPDATE

As I mentioned, fluent API is an easy interface to use and customize. For that, you can also make it an extension like this : 

public static class Vector2Extensions
{
    public static PhysicsProcess Apply(this Vector2 velocity)
    {
        return new PhysicsProcess(velocity);
    }
}


now you can for instance add new method to your fluent API class say Save() for instance, which would return Vector2, then you could do something like this : 

moveVelocity.Apply()
    .Run()
    .Jump()
    .Dash()
    .Friction()
    .Gravity()
    .Save();


When you use this approach, it would make it more maintainable and easy to extend. 

I hope this would make it more useful answer.