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
9 views
most useful & instructive functional-logic language to learn?
I was pretty amazed by the power of prolog. It took some time to get the head around, but to me it seemed to be the coolest declarative language out there. That's why recently, after two years of some ...
1
vote
0answers
11 views
Eta expansion - name origin
Just wondering where the name come from, eta?
The only two things I know about eta are:
estimated time of arrival
seventh letter of Greek alphabet
7
votes
2answers
91 views
Can someone explain to me why the app function of ArrowApply makes them as powerful as monads?
So I'll break my question into 4 parts, but first some background:
I feel relatively comfortable with Monads, but not very comfortable with Arrows. I suppose the main problem I have with them is, I ...
1
vote
2answers
37 views
Python list of dictionaries projection, filter, or subset?
I'm trying to create what I think is a 'projection' from a larger dictionary space onto a smaller dimension space. So, if I have:
mine = [
{"name": "Al", "age": 10},
{"name": "Bert", "age": 15},
...
2
votes
1answer
28 views
Python multiprocessing map function error
I have a simple multiprocessing example that I'm trying to create. The ordinary map() function version works, but when changed to Pool.map, I'm getting a strange error:
from multiprocessing import ...
0
votes
1answer
56 views
Pass `out` parameter (as reference) in F#
I want to call System.Uri.TryCreate():
let uriResult: System.Uri = ref (* what's here? *);
System.Uri.TryCreate(uriName, UriKind.Absolute, uriResult)
As I've learned here, one has to pass a F# ...
0
votes
1answer
81 views
How to switch on generic-type-parameter in F#?
I have the following C# code:
public static T Attr<T>(this XElement x, string name)
{
var attr = x.Attribute(name);
if (typeof(T) == typeof(int))
return ...
0
votes
2answers
39 views
Sorting strings with integer values in python
I have some code that I find clumsy.
Given:
sample_lists = [(u'1', u'penguin'), (u'2', u'kelp'), (u'5', u'egg')],
[(u'3', u'otter'), (u'4', u'clam')]
I want the result: ['penguin', ...
0
votes
0answers
29 views
Zipping streams using JDK8 with lambda (java.util.stream.Streams.zip)
In JDK 8 with lambda b93 there was a class java.util.stream.Streams.zip in b93 which could be used to zip streams (this is illustrated in the tutorial Exploring Java8 Lambdas. Part 1 by Dhananjay ...
-1
votes
0answers
130 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 ...
5
votes
2answers
142 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
95 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 ...
0
votes
0answers
23 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
43 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 ...