# Questions tagged [functional-programming]

This tag is for challenges related to the functional programming paradigm.

20 questions
5k views

### P Pr Pre Pref Prefi Prefix Prefixe Prefixes

Given some finite list, return a list of all its prefixes, including an empty list, in ascending order of their length. (Basically implementing the Haskell function ...
1k views

### Dirichlet Convolution

The Dirichlet convolution is a special kind of convolution that appears as a very useful tool in number theory. It operates on the set of arithmetic functions. Challenge Given two arithmetic ...
169 views

### Map an array of functions to their return values in point-free style

Introduction I have some JavaScript code that uses Array.prototype.map to map an array of functions fns to their return values: ...
2k views

### Make me some curry

Having a function f that takes arguments x1, x2, …, xn                         &...
902 views

### Find relevant digit groupings

Recently, my reputation was 25,121. I noticed that each digit grouping (i.e. the numbers separated by commas) was a perfect square. Your challenge is, given a non-...
2k views

### Generalized matrix trace

Inspiration. Given (by any means): A two-argument (or single argument consisting of a two-element list) black box function, f: ℤ+ × ℤ+ → ℤ+ (input and output are ...
561 views

What is the shortest way we can express the function f(a,b)(c,d)=(a+c,b+d) in point-free notation? pointfree.io gives us ...
2k views

### Find a Fixed Point

Given an integer x1 and some black box function f: ℤ → ℤ find a fixed point of f in the ...
615 views

### Are there any functional programming languages designed for code-golfing?

Are there any functional programming languages designed for code golfing? I know that golfscript and CJam fulfill the same category for stack based, but I couldn't find a functional code golfing ...
4k views

### Arbitrary-length currying

Write a function, f, that takes in a positive integer and returns a function. The new function returned should be identical to f...
586 views

### Convert λ-expressions to SK-expressions

The λ-calculus, or lambda calculus, is a logical system based on anonymous functions. For example, this a λ-expression: λf.(λx.xx)(λx.f(xx)) However, for the ...
1k views

### Make a long type signature

Challenge Find an expression, at most 100 bytes long, with the longest type signature. Rules Any statically typed language with type inference is allowed The type must be non-ambiguous, but ...
151 views

### Define map in the fewest tokens [closed]

map is a very basic yet important function in functional programming. All FP programming languages have it built-in but it is always fun to see how shortly you can ...
859 views

Your company is just getting started on a project, and for the first time you decided to go use a functional programming code-style. However your boss is really diffident and doesn't want to use built-...
698 views

### Most concise way to fold tree structures

Background (F#) Let there be trees: type Tree<'T> = Node of 'T * Tree<'T> list Now lets fold them nicely with a function called... ...
161 views

### Compare array of decimal sum of Integers and exact fractional part

Develop a program which takes two arrays of decimal numbers, and compare the sum of whole numbers only and the decimal part. If the sums of the whole numbers are the same, and the decimal parts of ...
295 views

### Write biSp in point-free form using as few terms as possible

The Haskell function biSp has type signature ...
2k views

### Shortest a -> b -> (a -> b) function in Haskell

I got the following question at a test: Write a function f with the following type a -> b -> (a -> b). ...