Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pyrtsa
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
by
pyrtsa
12y ago
Nope, that's the funny feature of transducers. Like lenses in Haskell, transducers compose in reversed order. (sequence (comp (map inc) (filter even?)) (range 10)) ;;=> (2 4 6 8 10) (->> (range 10) (map inc) (fil
2.
▲
by
pyrtsa
13y ago
But you'll need to document it very visibly that "Thou shalt call resource.close() whatever happened." C++ makes it possible for the library writer to take care of freeing the resources automatically.
3.
▲
by
pyrtsa
13y ago
Nitpick: if (x < 100) throw new Exception("Weird!); // LEAK! You shouldn't use `new` either when throwing exceptions. Just: if (x < 100) throw Exception("Weird!); // no leak.
4.
▲
by
pyrtsa
13y ago
Bjarne's advice also applies to pointers wrapped as class members. There are just too many ways you can mess things up inside the class when dealing with raw pointers, examples including: - partial construction: having to deal with alr
5.
▲
by
pyrtsa
13y ago
> This is neat, but really disappointing that there is no feedback when… Here's how you can say the same in a more positive manner: > This is neat, and it would be even better if there was feedback when… To keep up the hacker spi
6.
▲
by
pyrtsa
13y ago
I asked the same question in Twitter. Turns out James was actually augmenting (i.e. modifying) the array object `promises` to behave as a promise itself. I don't think this was a particularly beautiful way of doing it but it seems to work n
7.
▲
by
pyrtsa
14y ago
Correct. The key difference is that the enable_if version can be overloaded with mutually exclusive requirements: template <size_t N> typename enable_if<(1 < N && N < 10), void>::type foo(int (&
8.
▲
by
pyrtsa
14y ago
And, by extending your second example, we can enforce the minimum array size with std::enable_if (C++11; boost::enable_if_c with C++03): template <size_t N> typename enable_if<(N >= 10), void>::type foo(int
9.
▲
by
pyrtsa
14y ago
In my view it's exactly the opposite: (-> (california) bay-in city-on) ; "The Californian bay's city" vs. (city-on (bay-in (california))) ; "The city on the bay in California" The former ("->") starts with what's f
10.
▲
Poly. Solving the Expression Problem in C++11
(github.com)
1 points
by
pyrtsa
14y ago
|
0 comments
11.
▲
Imperative mood improves API documentation
(pyrtsa.posterous.com)
1 points
by
pyrtsa
15y ago
|
0 comments
12.
▲
by
pyrtsa
15y ago
It might have been those UTF-8 ellipses: "…" Good to hear that you got it resolved, but are you sure that your character encoding settings are alright?
13.
▲
by
pyrtsa
15y ago
Oh, good to hear. It's how Posterous implements the embedding of Github Gists that probably is to blame here. I'm still thinking whether to switch my blog to another platform, maybe even an own server, as that's not the only problem I've ha
14.
▲
Aligning your Git logs
(pyrtsa.posterous.com)
56 points
by
pyrtsa
15y ago
|
8 comments
15.
▲
by
pyrtsa
15y ago
I think the lambdas are the more useful the more complicated the function is. Simple asynchronous tasks might be one such example. This one, however, still is a pretty common use case, so introducing a function object type for it wouldn't h
16.
▲
by
pyrtsa
15y ago
I don't think introducing more syntax to the language for a feature that ultimately is a library solution, is a sustainable way to go. But if you really need a compact notation for smart pointers, you'll get pretty close by using template a
17.
▲
by
pyrtsa
15y ago
Interesting. Previously, the same company has been behind the 3D view of Nokia's map service http://maps.nokia.com/3D/ — more info e.g. here http://www.ubergizmo.com/2011/04/c3-technologies-behind-noki...
18.
▲
by
pyrtsa
15y ago
Oh true, missed that. Finally pulled out the phone to realize this. And then the other option 16+20+20+20+16 / 32+40+40+40+32 already has too big a difference between the margins on the edges compared to the ones between the icons. Makes pe
19.
▲
by
pyrtsa
15y ago
It's not impossible to make it symmetric for both, though. With consistent spacings. E.g. 19+18+18+18+19 (iPhone 3GS) 38+36+36+36+38 (iPhone 4)
20.
▲
by
pyrtsa
15y ago
Anybody noticed how closely this, being from the programmer's point of view, is related to what Bret Victor [1] has been talking about from the UI perspective? Take http://worrydream.com/#!/ScrubbingCalculator , or any of the "Kill Math" o
21.
▲
Playing with list slicing in Python
(pyrtsa.posterous.com)
1 points
by
pyrtsa
15y ago
|
0 comments
22.
▲
by
pyrtsa
15y ago
Hmm, I think the months menu [1] that opens when you take the mouse to the bottom right corner should have months listed in the opposite order. It feels more logical to get the most recent months down, closest to the mouse cursor, and the l
23.
▲
by
pyrtsa
15y ago
Also, the Updates link on the bottom of the home page is broken, points to /update.php, not /updates.php like it should. ;)
24.
▲
by
pyrtsa
15y ago
Seven years ago, maybe. But today's GPUs do it easily in their programmable pipeline (shaders). And where conditionals are costly, you can use tricks like: float temp = min(x, y); x = max(x, y); y = temp; instead of the con
25.
▲
by
pyrtsa
15y ago
Yeah, the hotel room analogy breaks as soon as you realize that visiting some completely other hotel room will already overwrite that variable in the first one. But it was a fun story, though.
26.
▲
by
pyrtsa
15y ago
Reminds me of that multi-lens camera Adobe was playing with some years ago. http://visualnary.com/2008/04/13/lens-that-takes-multiple-pi... http://visualnary.com/2008/04/13/nab-predictions.html
27.
▲
by
pyrtsa
16y ago
It was originally many things, but before going into the rubber goods business it started out as a paper mill. http://www.nokia.com/about-nokia/company/story-of-nokia/noki...
28.
▲
by
pyrtsa
16y ago
I actually disagree with that logic as well. If you just knew that e^(i * pi) = -1, then how would you know, whether halving that exponent would yield +i or -i? Considering that, we'd need to state Euler's identity as: e^(i * pi/2) = i, but
29.
▲
by
pyrtsa
16y ago
Only there is no year zero, by (that) definition. http://en.wikipedia.org/wiki/0_(year)