Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jules
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
46 ms
·
331.
▲
by
jules
8y ago
Can't you stop the car if the key is not present in the car? I guess the thieves could fake it with long distance transmission of the signal, but that would be more difficult and the further the car drives away from the actual key, the
332.
▲
by
jules
8y ago
If your country has "democratic" in the name it's probably not democratic. If your major has "science" in the name it's probably not science. If your company has "don't be evil" in its motto...
333.
▲
by
jules
8y ago
Another standard trick to reduce memory is to store a bitfield telling you which pointers are not null, and then store an array of only the pointers that are non null. For example for a Node64 you store a 64 bits bitfield plus only the poin
334.
▲
by
jules
8y ago
That's what I said.
335.
▲
by
jules
8y ago
Red-Black trees are isomorphic to B-trees of node size 4. If you take a Red-Black tree and put each black node together with all its red children into a single node then you get a B-tree of node size 4. An insertion/deletion algorithm
336.
▲
by
jules
8y ago
That's easy to say if you are rich because your food is only a small fraction of your income.
337.
▲
by
jules
8y ago
Have you tried FAF?
338.
▲
by
jules
8y ago
As long as you write code that's type stable, yea. Type stable means that the compiler can deduce the types of the variables used in a function given the types of the arguments passed to the function. An example of code that's not
339.
▲
by
jules
8y ago
This argument is a bit self defeating. You can easily replace the information a personal trainer gives with a standard training program and YouTube videos that show proper exercise form. You cannot easily replace its willpower function with
340.
▲
by
jules
8y ago
The primary function of a personal trainer / nutritionist is not the advice they give, but that they force you to show up at the gym and keep track of what you're eating. It's 90% outsourcing of willpower and 10% knowledge.
341.
▲
by
jules
8y ago
> I think this is because nothing stops `high` from actually being lower than `low`. Ahh, right. I guess that's exactly the type of oversight that a checker is for :) We could return the pair (!cur_low, !cur_high) and have the postc
342.
▲
by
jules
8y ago
That would be nice, then the run time predicate can be fast while the logical version remains elegant. What happens if you remove requires { forall i j. (i <= j) -> (pred i -> pred j)}? I think it should still check, actually. That
343.
▲
by
jules
8y ago
Very nice. I don't quite understand why you need the option in GenericBinarySearch. Doesn't the function always return Some? I had something like this in mind: let binary_search (pred: int -> bool) (low: int) (high: int):
344.
▲
by
jules
8y ago
List::map vs List_map is merely a syntactic difference. That's not the issue. Mutable collections are invariant, immutable collections are covariant. Mutable collections do not support map in the mathematical sense, immutable collectio
345.
▲
by
jules
8y ago
Covariance and contravariance is often discussed in terms of subtyping, but it goes deeper than this. Generic types can be covariant or contravariant in languages without subtyping too. The List<T> type is covariant because it support
346.
▲
by
jules
8y ago
Awesome! Interesting that it can prove that given only the loop invariant. The inner loop could be factored to a subroutine with the following contract: let P be a predicate on the integers such that (i <= j) => (P(i) => P(j)), and
347.
▲
by
jules
8y ago
This implementation: mid = ((unsigned int)low + (unsigned int)high)) >> 1; essentially extends the bit width from 31 bit to 32 bit by going from signed to unsigned, and is thus correct up to array lengths of order 2^31 rather
348.
▲
by
jules
8y ago
Perhaps instead of being mean, you could be helpful and post a link to said answer.
349.
▲
by
jules
8y ago
Apparently I also answered my own question a year ago as a comment on the associated blog post: Reagents do generalise CML. The main difference is that CML only allows you to combine operations with select (op1 OR op2) while Reagents also a
350.
▲
by
jules
8y ago
Interestingly, with floats you can also binary search on the binary representation. That narrows down the answer to the most precise answer representable in floating point in at most 64 steps for 64 bit floats. If you bisect the interval in
351.
▲
by
jules
8y ago
How so? Are you talking about (high + low)/2? Whether that is correct depends on the language. With 64 bit arithmetic it's correct in practice, and with arbitrary size arithmetic it's correct in practice and in theory. It onl
352.
▲
by
jules
8y ago
I like this version: low = -1 high = arr.length while(high - low > 1){ mid = (high + low)/2 if(arr[mid] <= x) low = mid else high = mid } This eliminates all branches from the body of the loop (gets compiled
353.
▲
by
jules
8y ago
How does this compare to Reagents? If I understand correctly, Reagents are the successor of Concurrent ML. http://kcsrk.info/ocaml/multicore/2016/06/11/lock-free/
354.
▲
by
jules
8y ago
https://en.wikipedia.org/wiki/Israfil_Yilmaz https://www.bndestem.nl/oosterhout/naar-is-overgelopen-serge...
355.
▲
by
jules
8y ago
Sabotage is possible. Several people in EU militaries have joined ISIS.
356.
▲
by
jules
8y ago
That's a great talk, thanks!
357.
▲
by
jules
8y ago
Did you read further than the title though? "Whites are ever so slightly less likely than average to believe that political correctness is a problem in the country: 79 percent of them share this sentiment. Instead, it is Asians (82 per
358.
▲
by
jules
8y ago
Row polymorphism is a more principled approach that makes the type theorists happy. The point of row polymorphism is not just that you can say "I may or may not have other fields, but I definitely have a 'name' and 'emai
359.
▲
by
jules
8y ago
Dependently typed languages do use the same evaluation mechanism for the type level and value level. In Java you have List<Int> and that's different than foo(bar), but in dependently typed languages Int is just a value of type Ty
360.
▲
by
jules
8y ago
Here is the paper describing the lazy thread spawning implementation: https://ece.umd.edu/~barua/ppopp164.pdf
More ›