5,792 reputation
12240
bio website github.com/DanielWaterworth
location United Kingdom
age 23
visits member for 3 years, 10 months
seen Oct 14 at 16:06

Apr
25
reviewed Reject suggested edit on Recursion or while loops
Apr
19
comment Why does Java use so many middlemen?
How can you possibly hope to think about any concept that doesn't have an object for every insignificant detail?
Mar
28
awarded  Nice Answer
Mar
4
answered What is the functional-programming alternative to an interface?
Feb
27
comment Real performance of node.js
@ErikReppen, There are two different types of state that you have in a callback. The state that associated with the event that triggered and state associated with the reason the callback was set at all. The second type is almost always necessary and unless it is stored in a global, it gets accessed via the closure's environment. I don't understand why you say that using closures causes over-reliance on globals when it does the opposite. The example I gave was just to show how much slower it is. I wouldn't expect people to write fibonacci like that, but they might write parsers in the same way.
Feb
24
comment Real performance of node.js
@ErikReppen, that's not quite what I'm saying. I'm saying CPS JS isn't as fast as direct style JS. To back this up, I've written a simple benchmark that calculates Fibonacci numbers inefficiently. The CPS version took 12 times longer that the one written in direct style, (full disclosure: I ended up using a trampolining style instead of standard CPS because JS lacks tail calls). It is common practice to write code that causes not empty closures to be created, look at the jQuery source for example. Every other line is obviously an exaggeration, but you can't deny that closures aren't common.
Feb
23
comment Real performance of node.js
@ErikReppen, having thought about this some more, you're right, a js function call is fast. In a tracing JIT, calls are even likely to be optimized away entirely. What is slow though, is heap allocating a closure for every other line of code and then garbage collecting these closures.
Feb
22
comment Interview puzzle on traveling on a line segment
To back this statement up, presumably you have a have a method of transforming every asymmetric travelling salesman problem into an equivalent problem of this description?
Feb
13
answered Why Was Python Written with the GIL?
Feb
7
comment Good serialization solution for communication between Python AND Haskell programs?
I'd recommend msgpack if you want performance or JSON otherwise. I haven't used protocol buffers with Haskell, but I would imagine it would work quite nicely, being typed. It has a space advantage, but be sure to benchmark it: I've come across protocol buffers implementations that are slower than JSON.
Feb
1
comment What is the current state of SECD and SKI machine use and research?
You might find this interesting, although it was created for lazy languages.
Jan
31
comment What is the current state of SECD and SKI machine use and research?
Are you specifically looking for research on call-by-value languages?
Jan
28
comment Programming interview question on Trees
-1, This is wrong. Levels won't be filled uniformly.
Jan
15
awarded  Nice Answer
Jan
11
comment Recursion or while loops
Essentially, it's not about what a function does, it's about what it means.
Jan
11
comment Recursion or while loops
@SF, map is not a keyword, it's a regular function, but that's a little irrelevant. When functional programmers use recursion, it's usually not because they want to perform a sequence of actions, it's because the problem being solved can be expressed as a function and a list of arguments. The problem can then reduced to another function and another list of arguments. Eventually, you have a problem that can be solved trivially.
Jan
11
comment Recursion or while loops
On the subject of recursion, this looks quite interesting.
Jan
11
comment Recursion or while loops
+1, for a very well thought out and coherent answer.
Jan
11
comment Recursion or while loops
@MaciejPiechotka, I think we agree. I didn't know whether you meant 'abstract' as in least specific or 'abstract' as in least tangible.
Jan
11
comment Recursion or while loops
@MaciejPiechotka, I mean, if you have a choice between using a powerful construct and a less powerful construct, you should always go for the less powerful option. You shouldn't use continuations when you only need exceptions, for example.