Functional programming is a way to organize code around functions that transform inputs into outputs. In Julia, this often means avoiding changes to input data so the path from one value to the next is easier to follow. “Stateless” describes a preference, not a rule that every function must obey. section 15.2
Writing functions alone does not make a program functional. Common practices include:
- Passing and storing functions as values, including passing them to higher-order functions. section 15.1
- Using map, filter, and reduce for collection transformations, and combining functions through chaining or composition. section 15.1 section 15.0
- Using closures or lambdas where an object with methods might otherwise manage state. section 15.1
Listing 15.1 Converting snake case to camel case
"Turns hello_to_you into HelloToYou" function camel_case(input::AbstractString) join(map(uppercasefirst, split(input, '_'))) end
The `camel_case` function turns `hello_to_you` into `HelloToYou`. Read its nested calls from the inside out: `split` produces pieces, `map` transforms each piece, and `join` assembles the result. Each output becomes the next function’s input. section 15.2
This differs from organizing a solution around objects whose methods change their state. An encryption service can be designed either around cipher objects and their methods or around higher-order functions and closures. Neither style is automatically best for every problem; comparing both makes the design trade-off visible. section 15.7 section 15.0


















