HNHacker News
TopNewBestAskShowJobs

a1369209993

3,448 karma · joined May 22, 2013

submissionscomments
a1369209993··on Adding row polymorphism to Damas-Hindley-Milner
> you cannot pass it a list of records where all contain the x field of int but some also contain an irrelevant y field and others contain an irrelevant z field.

Yes you can - that's just a existential type. I'm not sure what the syntax would be, but it could be somthing like:

  List (exists a : {x=int, ...'a})
(In practice (ie if your language doesn't support existential types) you might need to jump through hoops like:

  List ((forall a : {x=int, ...'a} -> b) -> b)
or whatever the language-appropriate equivalent is, but in that case your list will have been created with the same hoops, so it's a minor annoyance rather than a serious problem.)
a1369209993··on Intelsat 33e breaks up in geostationary orbit

  $ units
  You have: 25m2 / 2tau(700km)^2
  You want: /billion
    * 0.0040600751
    / 246.30086
a1369209993··on Lessons from Plain Text
> such that at least every sentence is on its own line

Yes, with the obvious possible exception of trivial/degenerate cases like "i++; j--;" in C or "This is a cat. That is a dog." in English.

> and every line break represents a semantic clause or sentence gap.

Specifically, it represents a maximally coarse semantic gap, drilling as shallowly down into subclauses as possible/practical.

> wrap/line break [can happen at ...] also a semantically valid intra-word line break.

Preferably only if that word would already be alone on its overly-long line. Eg:

  # bad, breaks subordinate clause before superordinate
  That sounds supercalifragilistic-
    expialidocious.
  
  # semantically valid, but ugly (a pathological case)
  That sounds
    supercalifragilisticexpialidocious.
  
  # vertically larger, but probably fine
  # (unless you're feeling incunabulum-y[0])
  That sounds
    supercalifragilistic-
    expialidocious.
> you end up running into the same difficulties that you do with conventional hard wrapping, at least in pathological cases.

I've yet to see any evidence that really pathological cases exist. (As opposed to "I'm lazy and can't be arsed" cases, which I'm fairly explicitly not disputing.)

0: http://code.jsoftware.com/wiki/Essays/Incunabulum

a1369209993··on C++ String Conversion: Exploring std:from_chars in C++17 to C++26
Yes, exactly. Which means that, while the speed gains are real, they only apply in cases where your libc is dangerously defective.
a1369209993··on Lessons from Plain Text
> given not-pathologically-short line length limits like 20 characters

Poor phrasing; 20 characters was meant as a example of a limit that is pathologically short.

a1369209993··on Lessons from Plain Text
> Instead, I would prefer a soft semantic wrap

So would I, but...

> if a single semantic unit (be that a word, a clause, or whatever else) extends beyond, say, 80 characters, we keep it on the same line and let the editor/file viewer handle wrapping.

...the editor can't do that because it doesn't understand the semantics.

> that wrapping based on semantics is an orthogonal concept to hard and soft wrapping

Yes, that's why I've been saying "hard and/or soft [but in either case nonsemantic] wrapping".

> > > With semantic wrapping you put each sentence (or similar) on a new line [...] But if that sentence runs over e.g. 80 characters, [then...]

... You don't need to fall back on non-semantic wrapping, you can just just keep breaking it up into smaller and smaller semantically-meaningful pieces.

(You have to do that 'hard'-ly because the editor doesn't understand the semantics, but that's not "decid[ing] whether you're going to hard wrap or soft wrap", it's being forced to hard wrap as a implementation detail because that's what results in correct wrapping.)

It might not be worth the effort to do that, but you're never forced not to (given not-pathologically-short line length limits like 20 characters).

a1369209993··on Lessons from Plain Text
> How should it be wrapped semantically?

I have no idea what the semantics of that word are, which is information that is required in order to properly semantically wrap it. (Inherently, since conveying such semantics is one of the major pointer of semantic wrapping.)

However, you included embedded control characters (C2 AD aka 'SOFT HYPHEN'; below replaced with '-') that encode less semantic information than is necessary for proper semantic wrapping, but not none:

Lopado-temacho-selacho-galeo-kranio-leipsano-drim-hypo-trimmato-silphio-karabo-melito-katakechy-meno-kichl-epi-kossypho-phatto-perister-alektryon-opte-kephallio-kigklo-peleio-lagoio-siraio-baphe-tragano-pterygon.

Web browsers use that information to do poor-quality semantic wrapping automatically - actual hard or soft[0] wrapping would produce something like:

  Lopadotemachoselachogaleokranioleipsanod-
  rimhypotrimmatosilphiokarabomelitokatake-
  chymenokichlepikossyphophattoperisterale-
  ktryonoptekephalliokigklopeleiolagoiosir-
  aiobaphetraganopterygon.
Which looks like the following from a partly-semanically-aware perspective:

Lopado-temacho-selacho-galeo-kranio-leipsano-d[BREAK]rim-hypo-trimmato-silphio-karabo-melito-katake[BREAK]chy-meno-kichl-epi-kossypho-phatto-perister-ale[BREAK]ktryon-opte-kephallio-kigklo-peleio-lagoio-sir[BREAK]aio-baphe-tragano-pterygon.

The fact that you included soft hyphens rather concedes the point that hard and soft[0] wrapping is incorrect[1].

0: Or rather, non-semantic, which is what we're actually arguing over. Technically, semantic wrapping is a subset of hard wrapping, but it's a specific subset that isn't what is expressed by just saying "hard wrapping". Kind of like how birds aren't what anyone means when they just say "dinosaurs".

1: Granted, to be fair, a lot of the time we just don't care. But (contra your original comment) we never need to resort to non-semantic wrapping; we just sometimes (often) decide to be lazy because it doesn't matter.

a1369209993··on Lessons from Plain Text

  > But if that sentence runs over e.g. 80 characters,
  >  you still need to decide
  >  whether you're going to hard wrap or soft wrap that sentence.
No I don't. Semantic wrapping all the way.
a1369209993··on Computer scientists combine two 'beautiful' proof methods
> vitalik didn't credit him in his article

You mean this article?

https://vitalik.eth.limo/general/2021/06/18/verkle.html

> Verkle trees are still a new idea; they were first introduced by John Kuszmaul in this paper from 2018[link to [0]],

0: https://math.mit.edu/research/highschool/primes/materials/20...

a1369209993··on NumPy QuadDType: Quadruple Precision for Everyone
Of course, you also need to use solid gold audio cables, or you're just throwing away the extra precision via poor signal fidelity.
a1369209993··on The Mathematics of Dobble (2018)
See also: https://blog.plover.com/math/finite-projective-planes.html.
a1369209993··on There is no antimimetics division V2
> There is no antimimetics division V2

"antimemetics".

Antimimetics is also a thing, and might be interesting to read about, but it's not the same thing.

a1369209993··on There Is No Antimemetics Division (2018)
I hope to write code that warrants a description at least twice as scathing as this one. But, you know, on purpose; when I'm intentionally fucking with someone. (I don't know of Martin ever trying to claim that Clean Code was actually a parody or practical joke, though I'll admit I can't rule it out.)
a1369209993··on Non-computability of solutions of certain equations on digital computers (2022)
Evidently I should have been more explicit:

> > A much simpler[-and-more-nitpickable] version

Myhill uses a parlor trick to make his version continuously differentiable. It's a pretty good parlor trick, but it doesn't have much to do with computability.

a1369209993··on Non-computability of solutions of certain equations on digital computers (2022)
> The key detail here is that the bumps grow exponentially smaller

Pedantically, it's that the bumps grow exponentially narrower.

IIUC, a simpler (but more nitpickable) version would be f'(n+1/y) = [the fraction of n-state Turing machines that halt within y steps] (for positive integers n, and 0 elsewhere); then f is the integral of f'. The value of f(x) can be approximated arbitrarily well by running every floor(x)-state Turing machine for a large finite number of steps[2], but f'(x) is equal to Chaitin's constant[0] for n-state Turing machines over a strictly-positive-length[1] subinterval of [n,n+1).

A much simpler version is f'(x) = {-1 if x<0; +1 if x>0; Chaitin's constant if x=0}. f(x) = abs(x).

Basically, this isn't even a parlor trick. It's a nothing burger, disguised as something by means of a parlor trick.

0: https://en.wikipedia.org/wiki/Chaitin%27s_constant

1: And so strictly-containing-rational-numbers, although predicting which rational numbers is nontrivial.

2: The rounding error from assuming all machines that halt after y steps actually run forever scales as O(1/y) in the worst case.

a1369209993··on The effect of CRTs on pixel art
You're thinking of "self-aggrandizing" (and I think doctorpangloss is too, although I'm less certain since they didn't mention Wolfram).
a1369209993··on A Visual Guide to LLM Quantization
> The number of floats between 0 and 1 is the same as the number of floats between 1 and 3

No, the number of floats between 0 and 1 is (approximately) the same as the number of floats between 1 and positive infinity. And this is the correct way for it work: 1/x has roughly the same range and precision as x, so you don't need (as many) stupid obfuscatory algebraic transforms in your formulas to keep your intermediate values from over- or under-flowing.

a1369209993··on The Lazy Bureaucrat Scheduling Problem
The real article appears to be https://arxiv.org/pdf/cs/0210024.
a1369209993··on Building a data compression utility in Haskell using Huffman codes
> It would be interesting to see a [not gratuitously inefficient] uniquely decodable code that is neither a prefix code nor one in reverse.

This can be done by composing a prefix code with a suffix code:

    A   0
    B  01
    C  11
  a A  0
  b BA 010
  c BB 0101
  d BC 0111
  e C  11
  {a=0,b=010,c=0101,d=0111,e=11}
This is trivially uniquely decodable by uniquely decoding 0->A/etc backward, then uniquely decoding A->a/etc foreward. It's equivalent in lengths to the optimal prefix code {a=0,b=110,c=1110,d=1111,e=10} so it's a (one of several) optimal code for the same probability distributions.

And it's neither prefix nor suffix itself, since a=0 and b=010. In fact, it can't in general be decoded incrementally at all, in either direction, since "cee...ee?" vs "bee...ee?" and "?cc...cca" vs "?cc...ccb" both depend on unbounded lookahead to distinguish a single symbol.

I'm not sure the optimality holds for any composition of a in-isolation-optimal prefix code with a in-isolation-optimal suffix code, but it did work for the most trivial cases (other than the degenerate 1-to-1 code) I could come up with.

a1369209993··on Architectural cross-section of Kowloon Walled City
> That link doesn't work at the present time.

Try:

  $ A='https://web.archive.org/web/20240701123410'
  $ B='https://staging.cohostcdn.org/attachment'
  $ C='11357255-b6b9-4a57-98eb-823776a4a828'
  $ D='KowloonWalledCityGrandPanorama.jpg'
  $ wget "$A/$B/$C/$D"
(or https://web.archive.org/web/20240701123410/https://staging.c...)
a1369209993··on Arbitrary shell command evaluation in Org Mode (GNU Emacs)
> I don't expect to see code evaluation on untrusted input as intended features in web browser

I'm not sure whether to laugh or cry at that. Suffice to say that ship has sailed all the way around the world several times, to the great detriment of everyone who isn't a advertising or other malware-development corporation.

a1369209993··on Heard of Idempotency but unsure what it is?
You do need (some subset of) associativity:

  (y0 * x) * x ?= y0 * (x * x)
        y1 * x ?= y0 * x
            y2 ?= y1
y2 is not in general constrained to be the same as y1 otherwise.
a1369209993··on South Pole Water Infrastructure
> A few years ago I saw someone calculate the energy required to melt the ice in front of a locomotive (I think) at speed; IIRC it required a (not small!) nuclear reactor's worth of energy.

Sounds like https://what-if.xkcd.com/130/.

a1369209993··on Unlocking the Duron and Athlon using the pencil (2007)
Actually, "bank" isn't just homonyms; both senses derive from circa-Proto-Germanic benc/bank: a bench or other raised area (either a bank counter or the raised ground adjacent to a riverbed). (And yes, this etymology is also shared with "bench".)
a1369209993··on This Message Does Not Exist
> Sleep(1) sleeps for approximately 1 second.

This is correct - Sleep(1) does sleep for approximately 1 second; the problem is you're confusing the 95% confidence interval (which might be as narrow as (999ms,1001ms) for some reasonable designs) with the absolute error bounds (which are (0ms,∞ms], and yes, the infinity end is inclusive).

a1369209993··on Intel's anti-upgrade tricks defeated with Kapton tape
That's accurate, but given the lack of words to the effect of "You can also put", it deserves the clarification that the most common something else is - as the parent suggested - a ∞-ohm resistor, either as a specific component or more commonly in the form of the absense of a component.
a1369209993··on Don't DRY Your Code Prematurely
> Whenever I have to work with a project where someone used DRY []consciously[], I know I am in for a world of pain.

Huh. When you put it that way, that's actually a good point. In my experience, competent programming will try to consolidate repeated code, and then cite "because DRY" if asked why, but I can't think of any case where I or anyone else competent started with "needs more DRY" as the original motivation (as opposed to "this is a incomprehensibly verbose mess" or the like).

Conversely, starting with "don't repeat yourself [and don't let anything else repeat itself]" as a design goal does seem to correlate well with cases where someone temporarily (newbie) or permanently (moron/ideologue) incompentent followed that design principle off a cliff.

a1369209993··on Don't DRY Your Code Prematurely
> such as the practice of decomposing every non-trivial function into a bunch of micro-functions that call each other,

That has approximately nothing to do with DRY. At best it might technically be a violation of DRY if (and only if) some of those micro-functions are identical, but the correct way to fix that is to recompose them into the non-trivial (and non-repeated) functions they're more usefully expressed as. And more often it's just a totally independent refucktoring that makes the codbase worse entirely orthogonally to 'DRY-ness'.

a1369209993··on C Style: My favorite C programming practices (2014)
IIUC, they're using the word itself correctly, but they mean "double precision is often used with the intent of it being a panacea".
a1369209993··on Ointers: A library for representing pointers where bits have been stolen (2021)
> in fact you need to work quite hard to allocate a structure with a pointer that isn't at least 4 byte aligned (i386), or 8 byte aligned (x64).

Well, no, actually; it's:

  p = malloc(size+1)+1;
It's just quite implausible that you'd do that by accident.
Page 1 of 34Next →