Why Function Programming is Important to Financial Modeling?

xiaoxiao2021-03-01  3

(Quoted from LexiFi)LexiFi found that a functional programming language was the most effective tool for developing compositional contract and scenario algebras.

LexiFi users derive important benefits from a functional programming approach, including:

Lists.   Functional programming languages offer powerful support for useful pre-defined types such as lists. Lists play a central role in finance where they are used extensively to define schedules. For example, a swap schedule or a Bermuda option exercise schedule may be defined recursively using a list. Specification.   The declarative formalism of functional programming languages is well suited for specifying complex data structures and algorithms, and the interactions between complex data structures and algorithms. In contrast, imperative programming languages tend to reflect the actual behavior of computers: complex types may be extremely difficult to design and maintain. Object-oriented languages are better candidates than imperative languages for implementing a contract algebra. However, they suffer from certain limitations, especially with respect to pattern matching (see " What are the limitations of data-oriented and object-oriented approaches for modeling financial instruments?").Functions.   Functions are "first-class citizens" in functional programming languages: they can be used as arguments of other functions. For example, a "sliding contract" used in a LexiFi simulation is a function that takes a date and a scenario argument and returns a contract. A list of sliding contracts—i.e., a list of functions—is passed to LexiFi's simulator function to run a simulation...

More generally, quoting Don Syme of Microsoft Research:

"Mixed functional/imperative programming is a fantastic paradigm for many programming tasks. Languages such as OCaml and Standard ML provide excellent general purpose programming languages suited to medium-advanced programmers who want simple yet highly expressive tools that boost their productivity, primarily by reducing the error rate, increasing their productivity through type inference, and basically letting them focus on the difficult parts of their applications. ...

Purely functional languages like Haskell are excellent within certain niches, but while laziness and Haskell's very strict control of effects do offer substantial benefits they also pose real problems for interoperability between lazy and strict languages. Purely imperative programming languages like C or Pascal do not provide satisfying mechanisms for abstraction or data manipulation. Purely object oriented languages like Smalltalk are excellent for some dynamic applications but do not provide static guarantees. Typed class-based languages like C# and Java contain a very large number of constructs, and it can sometimes be difficult for programmers to choose how to model their problem, and sometimes result in very large amounts of code just to solve quite simple problems. In contrast, the core constructs of the ML family of languages provide a smaller number of simple, orthogonal constructs which work together to allow for succinct yet efficient solutions to programming problems, and in particular permit common patterns of coding to be abstracted very easily." 

转载请注明原文地址: https://www.6miu.com/read-3200152.html