Hacker Newsnew | past | comments | ask | show | jobs | submit | derriz's commentslogin

When I first read the exp-minus-log paper, I found it extremely surprising - even shocking that such a function could exist.

But the fact that a single function can represent a large number of other functions isn't that surprising at all.

It's probably obvious to anyone (it wasn't initially to me), but given enough arguments I can represent any arbitrary set of n+1 functions (they don't even have to be functions on the reals - just as long as the domain has a multiplicative zero available) as a sort of "selector":

g(x_0, c_0, x_1, c_1, ... , x_n, c_n) = c_0 * f_0(x_0) + ... + c_n * f_n(x_n)

The trick is to minimize the number of arguments and complexity of the RHS - but that there's a trivial upper-bound (in terms of number of arguments).


When you may use functions of 3 or more arguments, it becomes trivial to find a single function that can be used to express large classes of other functions.

These tricks break when you are restricted to use one binary function, like in the EML paper.

The second argument cannot be used as a selector, because you cannot make binary functions from unary functions (while from binary functions you can make functions with an arbitrary number of parameters, by composing them in a tree).

If you used an argument as a function selector in a binary function, which transforms the binary function into a family of unary functions, then you would need at least one other auxiliary binary function, to be able to make functions with more than one parameter.

The auxiliary binary function could be something like addition or subtraction, or at the minimum a function that makes a tuple from its arguments, like the function CONS of LISP I.

The EML paper can also be understood that the elementary functions as defined by it can be expressed using a small family of unary functions (exponential, logarithmic and negation), together with one binary function: addition.

Then this set of 4 simple functions is reduced to one complex function, which can regenerate any of those 4 functions by composition with itself.

This is the same trick used to reduce the set of 2 simple functions, AND & NOT, which are sufficient to write any logical function, to a single function, NAND, which can generate both simpler functions.


This is similar to the idea of generating functions, if you would like more to read!


Why would it be surprising?

And if you want something truly surprising, Riemann's zeta function can approximate any holomorphic function arbitrarily well on the critical strip. So technically you need only _one_ argument.


> Why would it be surprising?

Because I don’t know as much mathematics as you.


> In a world where all the cars and trucks are electric you’re going to have to roughly supply your average highway with infrastructure comparable to the energy consumption of the cars on that highway (or the cities around it)

This is not true. Worldwide, typically about 80% of the energy used to charge EVs globally comes from a private connection. And the vast majority of that energy is drawn from the grid off-peak when transmission systems etc. are underutilized. You article reflects a mindset that envisages EVs working like ICE based transport.


Happens regularly. Last year’s heatwave caused a bunch of reactor shutdown across Switzerland and France - https://www.euronews.com/2025/07/02/france-and-switzerland-s...

And during that time France was net exporting 14GW to neighbors at dirt cheap prices. There's no reason to fix this. It's a nothing burger pushed by 'concerned' people

All thermal plants have this same issue, not just nuclear. And if you lose the natural gas peakers (which are also thermal and thus has this issue), you lose your baseload renewables too. Not that it matters, renewables used for baseload make more CO2 than just using FFs. Variability is a terrible quality in an energy source.

No, natural gas _peakers_ don't need water for cooling, since they don't have steam turbines like combined cycle gas plants. Cooling is only necessary in thermal plants to condense the steam on the low-pressure side of the steam turbine.

And excessive stability is also a terrible quality in an energy source. The only reason we used to put up with base-load power plants was because they were cheap; if they weren't we might as well have used peaker plants all the time.


Right, so rather than "We should have more thermal plants" what you want is a non-thermal electrical generator, and what do you know all the major renewable sources qualify, whether that's a wind turbine, hydro-electric or PV.

Do you know what else you'd get a lot of if it's so hot in the summer that you can't use lake and river water for cooling? Sunlight to run your PV. Because that's exactly why the water was heating up.


you can in fact use water for cooling. It's that sometimes you may be concerned about fish and not hurt it, esp with passthrough systems. But there are even more adv solutions (wastewater, dry cooling combo)

Could you explain what you mean here?

Hashes are _functions_ so provide the same output given the same input.

If you don't reseed the RNG after every hash computation, then you break this vital property of hashes.

And if you do reseed, then your claim boils down to "every hash function is just an XOR against a contstant" which certainly is not true either.


I would suggest at least having KYC (know your customer) rules which all banks, financial exchanges and traditional online bookmakers are required to implement would be reasonable for these markets?

At least it would somewhat hinder the type of activity we’ve seen (where journalists are threatened by criminals to withdraw or change their stories) without just banning such betting exchanges outright.


Trump leads a personality cult not a traditional political base. There are some who have stopped supporting him because they thought he aligned with their political views but 35% or so of the US population still support him despite his 180 degree turn on two of his foundational election promises: to keep the US out of foreign wars and to bust open an international pedophile ring run for elites.

Had also promised to end the war in Ukraine. In two weeks.

C++ is the last language I'd add to any list of languages used for correct-by-design - it's underspecified in terms of semantics with huge areas of UB and IB. Given its vast complexity - at every level from the pre-processor to template meta-programming and concepts, I simply can't imagine any formal denotational definition of the language ever being developed. And without a formal semantics for the language, you cannot even start to think about proof of correctness.


As with Spark, proving properties over a subset of the language is sufficient. Code is written to be verified; we won’t be verifying interesting properties of large chunks of legacy code in my career span. The C (near-) subset of C++ is (modulo standard libraries) a starting point for this; just adding on templates for type system power (and not for other exotic uses) goes a long way.


I don’t think this is a good comparison. Ada (on which Spark is based) has every safety feature and guardrail under the sun, while C++ (or C) has nothing.


There is a lot of tooling for C though, just not in mainstream compilers.


> The C (near-) subset of C++ is (modulo standard libraries) a starting point for this; just adding on templates for type system power (and not for other exotic uses) goes a long way.

In my experience, this is absolutely true. I wrote my own metaprogramming frontend for C and that's basically all you need. At this point, I consider the metaprogramming facilities of a language it's most important feature, by far. Everything else is pretty much superfluous by comparison


The phrase is striking but doesn't make a whole lot of sense to me.

Companies make dogfood and sell it and expect others (dogs, who aren't known for verbalizing dissatisfaction with their food) to consume it. The producers of dogfood don't really care what it tastes like or how nutritious it is.

But I can't imaging a business which involves collecting farts and selling them to others and where sniffing a small quantity of each bottled fart would help improve production processes to ensure a better experience for the customer. And most people are appalled at the smell of others' farts but can tolerate their own, so the "smell your own" test wouldn't really tell you anything.


  >The producers of dogfood don't really care what it tastes like or how nutritious it is.
Bingo. This is why "eat your own dog food" works so well. The best koans and parables include a contradiction, which is a teaching tool not a logic bug.

You may think you don't need to eat your own dog food (just like the dog food companies), but actually you should still do it.


I am surprised there are so many people on HN that completely miss the point. I am actually shocked. I am not shocked, however, that there are people who get offended. Getting offended is so 202x.


I think the metaphor is less about what you sell and more about the bullshit your customers have to endure to use the product you provide


If I were investing effort into acquiring knowledge in this domain, I'd skip straight to Polars. Before I made the switch, I had been using Pandas on and off for more than a decade. I'm not sure how representative this is, but most of the people I know who were Pandas users have also made this switch. I initially did it for the performance improvements but the API (according to my subjective opinion) is much more logical and has far fewer surprises compared to Pandas and it would be my default choice for this reason alone at this stage despite my years of Pandas experience.


I'd second this, especially if its just for personal use!

The data world owes a lot to pandas, but it has plenty of sharp edges and using it can sometimes involve pretty close knowledge of how things like indexing/slicing/etc work under the hood.

If I get stuck in polars, its almost always just a "what's the name of the function to use?" type problem rather than needing lots of knowledge about how things are working under the hood.


Ehhh, there are still plenty of pandas idioms for which there is only a clunky polars equivalent. Sure, I like the strictness of polars, but it is missing some day-to-day functionality. Which might never change - the polars team is trying to be disciplined about having a consistent and performant API, which does mean some functionality may be left behind.


Thanks, I'll look into this in the future. I don't need the most performant script, but this could change.


It's less about performance and more about ecosystem lockin. It's a bit like imperial vs metric units. Why would you ever chose to learn imperial if you had the option to only ever use metric to begin with?


That's exactly why I am reluctant to do anything with Polars. They are actively running a company and trying to sell a product. At any point they could be acquired and change the license for new releases. Sure you could fork it, or stay on an older version, but if what they offer isn't compelling enough for you then why take the risk?

Pandas on the other hand has been open source for almost two decades, and is supported by many companies. They have a governance board, and an active community. The risk of it going off the rails into corporate nonsense is much lower.


I would broaden the list of risks:

- Pandas is interwoven into downstream projects. So it will be here to stay for a long time. This is good for maintenance and stability. Advantage: Pandas.

- OTOH, the Pandas experience is awful; this was obvious to many from the outset, and yet it persisted. I haven't tracked the history. But my guess would be the competition from Polars was a key pressure for improvement. Edge: Polars.

- Lots of Python projects are moving to Rust-backed tooling: uv, Polars, etc. Front-end users get the convenience of Python and tool-developers get the confidence & capabilities of Rust. Edge: Polars.

- Pandas has a governance structure not tied to one company. Polars does not. (comment above said this) Advantage: Pandas.

But this could change. Polars users could (and may already be?) pressing for company-independent governance.


For short scripts and interactive research work, pandas is still much better than polars. Polars works well when you know what you want.

When you are still figuring out things step by step, pandas does a lot of heavy lifting for you so you don't have to think about it.

E.g. I don't have to think about timeseries alignment, pandas handles that for me implicitly because dataframes can be indexed by timestamps. Polars has timeseries support, but I need to write a paragraph of extra code to deal with it.


Because these are silly personal scripts. I'm not going to make sensible architectural decisions on something I run every now and then on my laptop. That's optimising too early.


DuckDB and SQL FTW.


> [Polars] is much more logical and has far fewer surprises compared to Pandas

A kind understatement imo. For me, the following experiences are highly coupled in my brain: "I'm using Pandas" + "I'm feeling a weird combination of confusion and pain" + "This is a dumpster fire".


It’s called TCO - tail call optimization - and gcc and llvm are supposed to implement it although tail recursive style code is probably uncommon in C or C++. Outside of that it’s common in functional languages where recursive functions are obviously idiomatic and so it has more potential to provide performance benefit.

It’s not a purely local optimization - affecting the call structure so debugging is a pain point. Which is probably why most imperative language compilers don’t bother given the lack of utility for the vast majority of code bases.

It feels like something that would need to be specified at the language spec or semantics level to make it useful rather than just making it optional for the compiler - otherwise the developer is probably just going to do the transform manually - to be safe - if stack explosion was a possibility if the compiler decided on a whim to not perform TCO.


Tail call optimization optimizes the situations where the recursion doesn't actually need any stack space, but I think the parent poster is asking about situations that aren't tail recirsive.


Just like many languages have annotations for inlining functions they could have annotations for tco. From an usability pov i would like annotations for must, must not, should, and should not. Where the "must" versions error if the compiler can't do the optimization


Scala and Kotlin have 'tailrec' annotation/modifier, though not as sophisticated as you describe.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: