# Functional Programming with the aid of AI - Venkat Subramaniam - NDC Oslo 2026

## Executive summary

This technical talk explores Functional Programming (FP), arguing that FP is a powerful subset of declarative programming that emphasizes functional composition and immutability. The presentation shifts focus to the role of AI in generating functional code, warning that while AI can accelerate development, it is an 'amplifier' of existing knowledge. The speaker emphasizes that human expertise is crucial for validating, refining, and correcting AI-generated code, as relying solely on AI without fundamental knowledge can lead to significant errors.

## Key takeaways

- Functional Programming (FP) vs. Imperative Style: Imperative style requires specifying *how* to achieve a result (e.g., detailing every loop step and condition). Declarative style, conversely, specifies *what* is desired, delegating the 'how' to underlying libraries (e.g., using `names.contains` instead of manual looping). FP is a subset of declarative style, adding the power of higher-order functions and functional composition.
- Functional Composition and Core Principles: The power of FP comes from functional composition—building complex functions from smaller ones. Key concepts include: 1) **Higher-Order Functions (HOFs):** Functions that can accept or return other functions. 2) **Functional Composition:** Combining functions using patterns like `filter`, `map`, and `reduce`. 3) **Immutability and Lazy Evaluation:** These are essential for correctness and performance in FP, as they prevent unnecessary computation and side effects.
- AI as an Amplifier, Not a Replacement: The speaker argues that AI is an 'amplifier' that amplifies both positive and negative knowledge. While AI can generate complex code quickly, its output is based on inference from its training data (which is largely human-written, and thus, imperfect). The onus remains on the experienced programmer to validate, critique, and refine the code, or risk accepting incorrect or overly complex solutions.
- The Danger of Ignorance with AI: The primary warning is that AI will not cover a lack of fundamentals. If a developer is unfamiliar with the underlying principles (like FP), they may accept AI-generated code without realizing its flaws, leading to a greater risk than writing the code manually.

## Technical details

- Programming Paradigms: The talk distinguishes between: **Imperative:** Telling the computer *how* to do something (requires detailing every step). **Declarative:** Telling the computer *what* is desired, delegating the 'how' (e.g., CSS, Angular). **Functional:** A declarative style that specifically leverages higher-order functions and functional composition.
- Functional Programming Concepts: Functional style code emphasizes: 1) **Pure Functions:** Functions that have no side effects and are idempotent (same input yields same output). 2) **Functional Composition:** Combining smaller functions to create larger, more capable ones. 3) **Core Functions:** Common functions include `filter`, `map`, and `reduce` (or equivalents like `selectMany` in C#).
- AI Limitations and Inference: AI is described as an 'accelerated inference engine' and 'agonizingly inconsistent.' It generates code based on patterns found in its training data. This means AI can sometimes generate unnecessarily complex code or fail to capture the precise business logic required, requiring manual refinement.

## Practical implications

- Developers must maintain a deep understanding of core programming principles (like FP) to effectively use AI tools.
- AI should be viewed as a productivity tool to minimize effort, not a substitute for knowledge. The human role shifts from writing boilerplate code to validating and refining AI output.
- When integrating AI-generated code, rigorous unit testing and code review are essential to ensure correctness and prevent unnecessary complexity.

## Topics

Functional Programming, Declarative Programming, Artificial Intelligence (AI), Code Quality, Functional Composition, Immutability, NDC Oslo 2026

Source: https://www.youtube.com/watch?v=UuhTm8Ie1RA
