Functional programming is a programming paradigm which primarily uses functions as means for building abstractions and expressing computations that comprise a computer program.
0
votes
0answers
42 views
Why learn Scala if Java can be extended with FunctionalJava and Lambdas [on hold]
I would categorize this question as "opinion-based" with no offense to Scala/Clojure community.
Scala is Object oriented, so is Java. Scala is functional but Java is not. But there are frameworks ...
2
votes
2answers
53 views
Pipelining vs. partial application for API design
In F#, many functions that take sequences have the sequence as the last parameter to support pipelining.
When designing an API, I can follow that trend, as in this simple state machine example:
type ...
4
votes
3answers
75 views
In FP how do you set a reciprocal relationship?
In FP where there is no mutable state and every operation returns a new state of the world. Given: I have a contact list and an individual contact.
I add Dirk to my address book. Dirk is a child of ...
1
vote
2answers
48 views
Smart Calculator
A Python program that, when run, carries out the four basic mathematical operations
(addition, subtraction, multiplication, and division) and prints out the result of that operation based on a simple ...
0
votes
0answers
17 views
Lazy evaluation / Stream / FRP code for node.js fs.readdir Async recursive directory search
I try to implement a list structure reading FileSystem Directory tree using node.js
DIR/file structure:
DIR1
DIR2R
file1
file2
file3
…
-> list structure:
("DIR1" ...
2
votes
3answers
42 views
Functionally find mapping of first value that passes a test
In Ruby, I have an array of simple values (possible encodings):
encodings = %w[ utf-8 iso-8859-1 macroman ]
I want to keep reading a file from disk until the results are valid. I could do this:
...
2
votes
5answers
40 views
correct style for element-wise operations on lists without numpy (python)
I would like to operate on lists element by element without using numpy, for example, i want add([1,2,3], [2,3,4]) = [3,5,7] and mult([1,1,1],[9,9,9]) = [9,9,9], but i'm not sure which way of doing is ...
0
votes
0answers
62 views
Stack_overflow with tree traversal
My tree is defined as below: (It's just for better understanding, my data type is much more complicated.)
type tree = {
mutable value : int;
mutable nodes : tree list
}
I need to find a ...
9
votes
4answers
236 views
What programming languages have something like Haskell’s `newtype`
The Haskell programming language has a concept of newtypes: If I write newtype Foo = Foo (Bar), then a new type Foo is created that is isomorphic to Bar, i.e. there are bijective conversions between ...
1
vote
3answers
60 views
Can someone explain to me the difference between a Function Object and a Closure
By "Function Object", I mean an object of a class that is in some sense callable and can be treated in the language as a function. For example, in python:
class FunctionFactory:
def __init__ ...
2
votes
2answers
43 views
Trying to get higher order functions to work in powershell
I can't get this example to work
{ $_ + $_ }, { $_ + 1}, {$_ - 1} | % { $_ 1 }
I want it to construct a list/array/collection/whatever of functions (this part is fine), and then pipe that list to ...
0
votes
1answer
21 views
Getting respective *args, **kwargs from collection of functions, then filling in the irregular 2d structure with provided 1d arguments
I have data like this:
args, kwargs = (('foo', 'bar', 'baz'), {'goo': 1})
And I have functions, inside an object, which want these data as arguments. They are to be provided via a method which has ...
0
votes
2answers
68 views
The API design philosophy in OCaml
After learning OCaml for like half year, I am still struggling at the functional programming and imperative programming bits.
It is not about using list or array, but about API design.
For example, ...
-1
votes
1answer
39 views
Functional programming in Java on google app engine [on hold]
Does google app engine support any functional programming libraries ?
For example functionaljava : http://functionaljava.org/
-1
votes
0answers
40 views
Is there a java library that lets me modify JSON in a functional way? [on hold]
I've got some JSON that looks similar to this:
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
You can consider those numbers to be objects. I want to process this JSON so it gets converted into ...