# Questions tagged [functional-style]

Questions about Mathematica's functional programming style, including the use of pure functions (Function[], #, &) and functions such as Map, Apply, Nest, and Through.

422 questions
Filter by
Sorted by
Tagged with
1 vote
60 views

• 1,045
461 views

### Breaking "Functional Loops" and Doing Lazy Evaluation In Mathematica

Alright, so this is a question about the functional way to break a for/while loop. Since we're on the Mathematica SE, I'm interested in the ways a Mathematica vet would handle this, however the ...
• 391
194 views

### Why Does Parallelization Not Speed Up these Seemingly Well-Parallelizable, Simple Functions?

Original Example Consider function f, a parallelized version fPar, and a coarsest-grained parallelized version ...
• 1,547
479 views

### Creating a list with Thread

I have a list like this one: aaah= {{11, 21, 31}, {12, 22, 32}, {13, 23, 33}} and I finally want to get a list which looks like this one: ...
• 73
83 views

### How do I correctly use OperatorApplied?

Starting with ClearAll[f, list] list = {"a", "the"} f[s_, n1_, n2_] := {s, n1, n2} Then f[list, 20, 10] ...
• 1,412
1k views

### How can I replace a set of Nested For Loops with a Functional Code Alternative?

Despite having looked over various posts concerning optimizing nested For loop expressions into a functional programming equivalent I still can not figure out how to actually to do this. Such ...
• 1,496
1 vote
36 views

### Style function not working inside Print Row functions

About Watch[...] is a helper function for watching a list of variables or other functions inside a Module[...] during ...
• 1,787
97 views

### Using Fold[ or Map[ Better?

I'm working through MMA Cookbook by Mangano, page 54. He shows Map is a compact form of Fold function. Is using ...
• 590
24 views

### How to style a row of lists of lists created with a Table and return all lists?

I want to return a list of all lists with elements in a single first list styled if it meets a condition so that it stands out from other lists. My attempt at this only returns all data with no row ...
• 1,787
234 views

### Fold a list but alternate used functions

Is there a clean way to fold a list but alternate functions used? Say we call such function FoldAlternating. Then for example, The ...
• 612
45 views

### Results of recursion grouped in list [closed]

I made a recursion where I should plot resulting points. When I do Print[point1], it just gives me result: ...
• 83
1 vote
62 views

### Implements the binary-searching style code in functional way

Given that I have a code snippet written in binary-searching way: ...
• 63
75 views

### What is the most efficient way to implement NestPairWhileList[f,expr,test,g]

Question NestWhileList[f,x,test] lets you iterate a function until a condition is satisfied, outputting the list of iterated values ...
1 vote
I'm trying to find a simple way to define a bilinear and Leibniz functional/map "$B(\cdot,\cdot)$", that eats two functions $f(x),f(y)$ or products theirof and produces the following,  B(f(...