The functional-programming tag has no usage guidance.
12
votes
6answers
480 views
Implement functional programming paradigms
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 ...
5
votes
6answers
333 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...
foldTree f:('a -> 'b -> 'c) -> g:('c -> ...
-3
votes
1answer
109 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 ...
5
votes
5answers
224 views
Write biSp in point-free form using as few terms as possible
The Haskell function biSp has type signature
biSp :: (a -> c) -> (b -> d) -> (c -> d -> e) -> a -> b -> e
and (for those who prefer combinator calculus) can be defined as
...
13
votes
3answers
1k views
Shortest a -> b -> (a -> b) function in Haskell
I got this question at a test:
Write a function f with the following type a -> b -> (a -> b). a and b should not be bound in any sense, the shorter the code, the better.
I came up with ...
6
votes
11answers
386 views
Write a function that reduces compositions of linear operators
You are given two functions g(x) and h(x), each of which takes an integer x and returns the number ax + b (where a and b are integers defined in the function).
Your task is to write a function f(g, ...
7
votes
4answers
327 views
Golfed fixed point combinator
Write a fixed point combinator in as few characters as possible, in the language of your choice.
free form (i.e., whatever's shortest): whole program, actual function, code snippet
you may not use ...