HN user

yccs27

1,185 karma
Posts0
Comments387
View on HN
No posts found.

The gluon with color (|g1> + |g2> + |g8>) / √3 is just a superposition of the gluons with colors g1, g2 and g8, the same way you can make superpositions of any other particles. You are right that the choice of basis vectors is arbitrary, but that doesn't make it wrong to count the number of dimensions. It also doesn't make it fundamentally different than, say, polarizations of photons or even flavors of quarks. You can have superpositions of photon polarizations or quark flavors.

All of these are continuous properties in an n-dimensional vector space.

Yeah, this is basically stochastic dithering applied to numeric floating point quantization instead of image color quantization.

This makes me wonder whether you could apply different dithering approaches to numeric computations. You cannot use diffusion or similar mehods, because you don't have information about neighboring pixels/computations. Using low-discrepancy sequences might work to reduce stochastic noise, but it could also reintroduce bias for some computations.

Making laws more explicit in important cases is valuable because it reduces uncertainty about legal interpretation. Using your example of cellphone use, under distracted driving laws the prosecution would have to prove that the specific case of cellphone use was distracting enough to be a safety hazard. With the more specific ban on cellphones, that is no longer an obstacle.

Thank you for the detailed answers!

I think purity is something the programmer just has to annotate themselves. Any boundary between languages with different type system guarantees will always have this kind of friction - Rust to C/C++ FFI also has to deal with ownership, lifetimes and aliasing manually.

Regarding type classes, monomorphisation indeed seems like a difficult obstacle for polymorphic function. But just translating type classes and impls might not be as difficult? So going from:

    trait Foo {
      fn foo(&self);
    }
    
    impl Foo for Bar {
      fn foo(&self) {...}
    }
to
    class Foo a where
      foo :: a -> IO ()
    
    instance Foo Bar where
      foo :: Bar -> IO ()
      foo self = ...

It's great that this allows passing Rust structs both as ForeignPtr and as native records with marshalling!

Some questions/ideas:

- Is there a way to generate #[hsrs::data_type] bindings for Rust library types, or do you need to create custom wrapper types for them?

- It seems like all #[hsrs::function]s are translated to return IO (since Rust functions can do arbitrary side effects). It would be great if you could (unsafely) mark functions as pure, to get pure Haskell functions without having to wrap them in unsafePerformIO.

- Both Haskell and Rust have HM type systems, so I wonder if you could also translate type classes from Rust to Haskell.

Monads got their name from monoids (being a monoid in the category of endofunctors). Monoids are equivalent to one-object categories, so the name uses the greek syllable "mono" for one.

I've noticed this with UI interfaces before: For example, an IBAN field which actively blocks you from entering more than the expected number of characters. Seems like a good idea - except whoever sent me their account number helpfully included spaces to separate blocks of numbers, so when I copy-paste it the last few digits get cut off. Now I not only have to delete the spaces, but also copy the missing digits again! Just make the field red and block me from submitting until I fix my input!

[dead] 4 months ago

Does "Pharma" actually dose medication based on the Eyring equation? I'm not convinced we actually know the value of ΔG. AFAIK, the optimal biological dose is determined via dose-ranging studies during Phase I/II of clinical trials. And drug metabolism rate is measured, not derived from theoretical models.

Waymo Safety Impact 4 months ago

Road capacity does not increase with speed above 50 km/h on urban roads or 70 km/h on highways. Following distance scales with speed, so more speed can actually mean fewer cars per unit of time.

In theory, braking distance scales quadratically with speed. In practice, people leave less room on highways, because they rely on others driving predictably, but spacing still increases faster than linear.

I'm not so sure this is really a free market equilibrium. There are two effects which explain the prevalence of ads even if consumers are willing to pay more for ad-free products:

- Imperfect information, aka Market for Lemons: It can be hard to find out how prevalent ads will be when buying a product. Consumers often make a purchasing decision without knowledge about ads.

- Changing terms after lock-in, aka Enshittification: Manufacturers (like Hisense here) can add advertising to products after consumers have already bought them. Initially, consumers have negotiation power since they can freely choose a product, but later they are locked in and cannot easily react to the manufacturer changing the product to their detriment.

The last line of the introduction

By doing so, we aim to provide a novel paradigm [...]

also made me think of item 19 on your list:

10 points for claiming that your work is on the cutting edge of a "paradigm shift".

I'm sad though that you didn't call it the "Baez crackpot index"...

The saying probably assumes that each chronometer has a certain small probability of malfunctioning, resulting in a significant error (basically a fat-tailed error distribution). With three chronometers, you can use a robust estimator of the true value (consensus value or median). With two, there's no robust estimator and if you use the mean, you have twice the probability of being significantly wrong (though only by half as much).

It is enforced automatically for most purposes: If you're writing a proof involving e.g. the sqrt function, you want to use theorems about it, e.g. that (sqrt(x))^2 = x. Almost all of those theorems have x>=0 as a precondition, so you do need to prove it when it matters.

Inverse Parentheses 7 months ago

Thanks, writing it as 1+2(*)3 made it click for me.

Reminds me of the '$' operator in Haskell - it lowers the precedence of function application, basically being an opening parenthesis that's implicitly closed at the end of the line.

No. There is a global allocator which is used by default, but all the stdlib functions that allocate memory have a version which allows you to pass in a custom allocator. These functions are still "unstable" though, so they can currently only be used with development builds of the compiler.

Ruby Symbols 8 months ago

The article is a bit confusing, but I like the concept behind symbols: Basically a way to distinguish identifier names (chosen by the programmer) from user-facing strings.

The distinction between is one I've mentally adopted in other languages like Python as well. For personal projects I like to use single quotes for 'symbols' and double quotes for "strings", e.g.:

    add_label(text="Hello World!", align='center')
Does anyone else do something similar?

The most general approach is to calculate all the different cases, and then do a branchless selection:

    var4 = (var1==1)*(var2+var3) | (var1==2)*(var2-var3) | ...
Of course this is basically the slowest possible option, but it might work as a starting point for a general-purpose optimizer to find a faster solution. If it doesn't, this will likely compile to conditional move instructions.

It might help if you replace the comparison and multiplication with an equivalent expression made from bitwise operations, but I believe most compilers already know how to do this transformation.