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

There's an important issue with async iterables: what's the initial value of derived "signals"?

In the Dart/Flutter world, async iterables are known as streams. The biggest problem is that they are asynchronous so if you derive new streams from existing streams, you won't have a value immediately for those streams available, you'll have to wait a frame for values to propagate. That's not a problem if you're just processing data, but if you're using them in a UI framework and your UI framework is coupled to the event loop, then you have a problem.

This doesn't happen with the ReactiveX approach because things are evaluated immediately, one doesn't have to wait for the event loop to tick. (A fun historical artifact is that ReactiveX has not caught on in the Dart/Flutter community around 2019-ish because it was eventually migrated to use Streams and the initial-value-problem was a real problem that made the benefits of ReactiveX not carry its weight nobody noticed that but I was heavily involved and I am still using a custom framework derived from my observations back then).

If we zoom out a bit, the problem is actually that we are trying to define a computation graph and then need a strategy for evaluation it. I think Elm has actually made the biggest progress on that front (here's THE talk on that topic that shows how complicated working out all the kinks can be: https://www.youtube.com/watch?v=Agu6jipKfYw)

I still think that functional reactive programming solves most of the problems we have in UI-land, but the complexity that we have to deal with when we use traditional methods of state mutation, that complexity becomes enormous when trying to define a reactive programming framework, especially in languages that are not purely functional.

I think in 10 or 20 years there will be somebody that solves this problem, I don't see it happening anytime soon, sadly. It's just too complicated and we need programming languages that are built around those ideas for them to become comfortable enough to be usable in practice.


Thanks for your feedback!

> The biggest problem is that they are asynchronous so if you derive new streams from existing streams, you won't have a value immediately for those streams available

I tested that using `myAsyncIterable.map`, which is part of the stage 2 async iterator helpers proposal, and it works fine. Maybe I miss a specific case you have in mind?

How did Dart (or you) fix the initial-value problem?

> If we zoom out a bit, the problem is actually that we are trying to define a computation graph

I agree with that considering the comfort it brings, and since you mentioned Elm I will also mention lustre (a Gleam lib) which has the exact same approach. But both those tools/languages are niche functional languages, which JS is definitely not. I'd love to discuss why but it's another debate.

Elm's and Lustre's approach imply some trade-offs too, delegating a lot of work to the rendering engine.

This idea does not aim at replacing approaches like Elm's or Lustre's, the idea is to integrate with non-functional Web APIs – DOM nodes are definitely not immutable – following the exact opposite approach like SolidJS's about putting evaluation at the lowest level (ie: DOM node) rather than highest level (app).

If your team has the skills to build web apps in another language (Elm, Gleam, OCaml, …), you should probably do that. If you are all-in on JS, I'd better have something as close as possible to the Web platform.


Very interesting, I always believed we should have more declarative frameworks in other domains and not just UI. My experience shows me this gives LLMs a much smaller space to explore which leads to better results.


Yeah, I fully agree. UI has become a pretty obvious example for declerative programming, but it probably makes sense for so many other domains as well!


NIT: That's not quite correct if your first statement is meant to imply an equality rather than a subset relation.

The idea of an index is more general, as an index can be built for many different domains. For example, B-trees can index monoidal data and inverted indexes are just an instance of such a monoid that a B-tree can efficiently index.

Furthermore, metric spaces (e.g., levenshtein distance) can also be efficiently indexed using other trees: metric trees. So calling inverted indexes just indexes would be really confusing since string data is not the only kind of data that a database might want to support having efficient indexes for.


My point is that all indexes are "inverted" in the sense that they map some searchable value to occurrences of said value. That is true even if method of comparison is not strict equality.


Most indexes people hear about are like that. However, there are indexes that work the other way around, like Postgres' Block Range Indexes (BRIN). They are mostly useful as skip indexes - for a given block, they have a summary that tells whether some given data may be there.

The trade-off this kind of index makes is that it is more optimized for (batch) writes than the more popular B-Tree indexes, but it is less optimized for reads on the other hand. If the write throughout of a given table is very high, you might want to remove all B-Tree indexes that are not strongly correlated to the insert order and have BRIN indexes instead. Combine it with table partitioning, and you can add B-Tree indexes in the cold partitions, or even migrate them to columnar storage if available (with the Citus extension).

By the way, a few years ago a Bloom BRIN variant was added, not to be confused with Postgres' Bloom indexes which are something else.


I wouldn't say BRIN indexes are "the other way around"; index structure is still one where data values are looked up to find the area where occurrences exist.

"Coarse" indexes like BRIN and ClickHouse's data-skipping indexes are still indexes in a broad sense of serving to narrow down a search.


The university I went to started its math education with groups, which is really unfortunate and they never even mentioned monoids.

Monoids are a key idea in computer science and I think that everyone should know what monoids are. Monoids are EVERYWHERE and once you recognize that you have a monoid you can immediately use known methods to compute over monoids in efficiently (e.g. https://static.googleusercontent.com/media/research.google.c...).

Once you have a certain lattice (I'm leaving out some details), you can solve problems efficiently by known methods (e.g. using dataflow solvers) and automatically have a proof that the solution always terminates.

I really wish that more people took their time to learn these fundamentals and I think this is a wonderful introductory site. I don't mean to offend anyone, but if you've never heard of most of that stuff, then I think that you don't deserve to call yourself a professional programmer. Why? You will reinvent solutions to problems that have been solved before much more efficiently then you will be able to i.e. you're an amateur.


> I don't mean to offend anyone, but if you've never heard of most of that stuff, then I think that you don't deserve to call yourself a professional programmer [...] i.e. you're an amateur.

Every person is going to have a different idea of what knowledge is essential, and as you point out, we don't know what we don't know.

It is easy to look down on people who don't know what we consider fundamental, but it takes a little bit of humility to realize that we are ignorant of what other professionals value the most. Different roles require of different knowledge.


Also, one important thing I've learnt is not to take in advice from obnoxious people.


I'm using euro cents as weights in my weighted vest.

When I started doing this I didn't want to afford dedicated weights as it seemed like a waste of money, but I had many cents saved up from my childhood, which I started to use instead.

I have roughly 15kg in euro cents in my vest and I'm regularly talking walks with it.

To get one kilo you need 435 cents and it turns out that in Germany you can also "buy" coins "for free" at the "Bundesbank", that is, you can exchange actual money for weights without any fees. You give 4 euros and 35 cents and you get a kilo. Once you need the money back, you can also sell those coins back to them for free.


You can also go to the beach and get unlimited amounts of weight for free too. That's what's most budget weights are made of


Just FYI this is illegal in many areas.


It's illegal to fill a bucket with sand?!


Sand is not an infinite resource. It's crucial for both protection (if you remove all the sand from the beach, there will be nothing to cushion the waves and currents and etc. and it will result in more erosion, which can be deadly for any constructions nearby) and construction.

As such, it's completely normal that you can't just take sand or stones from many beaches. The very famous Étretat town in France with its accompanying beach and rocks, have a very strict "don't take souvenirs from the beach because you'd be actively destroying it" policy.


Sometimes someone has paid money to place the sand at the beach because it wasn't a sand beach from the start. So no, you can't go fill your sacks with sand anywhere you like, not even in Sweden were we can pick berries in the forest for free. Stones, trees and sand is not allowed without permission.


Definitely a euro thing then.


Not particularly, it's prohibited in US National Parks, National Historic Sites, National Memorials, National Wildernesses, National Seashores & Lakeshores[0], US National Wildlife Refuges [1], Most US State parks.

Canadian National Parks[2] and most Provincial/Territorial Parks.

[0]: https://www.nps.gov/articles/recreational-collection-of-rock...

[1]: https://www.ecfr.gov/current/title-50/chapter-I/subchapter-C...

[2]: https://parks.canada.ca/voyage-travel/regles-rules#objects


So like less than a tenth of one percent of the US coastline. Literally so uncommon in the US I'd have to go well out of my way to find a section of beach where this is applicable.


And remove it from the beach, yes.


No, to walk away from the beach still holding that full bucket.


You would be surprised how many things its illegal to take from beaches or country (sand, corals, some shells, of course anything old enough etc)


Literally none of that is illegal at any of the beaches I've been to (east coast US). Not only does nobody care, there's frequently nobody around to even notice in the first place.


I don't mean to argue that it's just gimmick and any sane person would just use sand, but to be completely fair, sand is much less dense than steel, so if the coins pack well it does make a better weight.

I do also suspect that there must be some product that must be more cost effective than coins but denser than sand, but cannot think of it right away. I mean, scrap steel is a couple of cents per kg.


Olympic weight plates for barbells. They're widely used, so competition has brought the cost down, and they're easily available in useful increments. I currently see 4x 10lbs for <$50 on Amazon. That works out to 2,53 Euro per kg. So cheaper than euro cents. They may not have the exact shape you need.

The scrap steel probably didn't cost cents per kg when it was sold for its original purpose. You are paying for a useful shape.

A professional equivalent of weighted vests are ballistic plate carriers. Real ballistic plates can be fragile and expensive, so options for exercising in (or milsim games in airsoft etc.) include expired (and failed to re-certify) real ballistic plates, made for purpose training plates... or plate shaped sandbags!


> That works out to 2,53 Euro per kg. So cheaper than euro cents.

The cents are free though, cause they're legal tender — just deposit them instead of having to sell 2nd hand


Assuming you live in a sane country. One of the few complaints I have with Dutch society being so "streamlined". Cash is seen as a nusciance here.


The cheapest plates can be higher variance than you might expect. I’ve seen reports of 45s that are 10% light.


Especially if you hit eBay or similar, you can get it for cheap


Sometimes sand + water is used for ballast. Depends on your use case, if your heavy thing is moving around then the sloshing won't be ideal, but if it's just sitting somewhere static then it can work.

eg; weighing down the corners of a beach tent, pegs won't grip in the sand so instead tie plastic bags onto the guy ropes and fill them with sand and water.


It's a lot easier to contain coins vs sand, though.


You can keep both in a series of ziploc bags for convenience.


Round coins are also less coarse and rough


For me, it would be rather long trip and generally too expensive. I would had to steal it from kids playground. Which is rather low thing to do.


I have to ask, how do you not sound like ~6500 coins jingling together as you walk? I notice when I have like 10 coins in a backpack. Do you wrap bundles of coins in cellophane or something?


I remember back when I used physical coins, banks used to wrap them in paper rolls with known quantities in them. So you could get a $10 roll of ten $1 coins or whatever.


Ah that is almost certainly it, it's been so long since I've gotten a roll of quarters from a bank that I forgot that is an option. Thanks!


Could you explain more? I do not understand how you can buy coins for free by paying coins for “weights” (what are these weights? What are they made from?). Also, what is the use for this? To check of your coins are real? Calibrate your coin scale?


I guess OP means you don't need to buy above or sell below its value when "buying" or "selling" a metric shitton of small coins (like you would for gold for instance).

15 kilograms sounds excessive though, I bet the bank clerks hate that trick ;)


Banks usually stock pre-counted rolls of coins, and it's not much hassle to count out several of those. Though I guess 15 kg is probably going to be several dozen.


The coins are weights, the actual money is paper or electronic money.


Excuse the nerdy nitpick, I get the point but technically as far as "actual" money goes that's the coins. Electronic entries in bank ledgers are not legal tender.

One can of course go further and question if banknotes and coins should be called actually money. Today the nominal value is completely disconnected from what the metal is really worth, it's not like with gold coins back in the day. And once collective belief in the value is lost fiat money quickly becomes worthless. Zimbabwe and Venezuela are recent examples.


Have to correct your nitpick. What you're talking about is currency not money. Not being legal tender doesn't mean it's not money. The majority of money sits as electronic entries in each country's central bank. https://www.investopedia.com/terms/c/currency.asp#:~:text=Th....


True. I'm talking about private bank books, the kind of "electronic money" regular people use, which I assume is what the comment above referred to. Since only financial institutions have access to central bank accounts.


How do you pay 35 cent in paper is still a mystery. But OP just means you can exchange/buy coins (and use them as weights)?


You should be just as mystified about the 4€ component.


You give bills and get pennies.


The decathlon weight 500g pakets of sand)jacket is about €20. How easy is it to make your jacket 10kg? Are the coins easily removable? Do you have straps to keep the weight 'tight'?


It's very easy. I'm using the cheapest weighted vest that I could find and it came with blue bags that I've just filled with coins. You don't really need straps to make the weights tight because the money just kind of spreads inside of the bag and doesn't move at all once it's there.

It's on my todo list to 3d print some containers to replace the bags with actual "money rolls" so that I can remove them more easily.


Maybe you've already considered and decided paper wouldn't work, or maybe you want the fun of working with a 3D printer, but my initial thought:

Would it not be simple to create rolls of coins by simply wrapping a sheet of paper round a stack of them, once or twice around, a little bit of sellotape to hold the paper in place, including folding it over at both ends and taping there too? I'd imagine an A4 sheet would be more than enough for each stack of coins, cutting off what isn't needed, and since you wouldn't care about them being beautiful you wouldn't even need fresh paper and could just use paper that would otherwise go into recycling/trash (letters received, junk mail, etc.)

edit: I did a quick search which both confirmed people have made coin rolls using simple paper, and also that it's highly likely banks will offer pre-made paper holders for the various coin sizes that you can just ask for and get for free (with the bank assuming you'll be bringing them back full of coins - you could either ask for as many as you need, or just one per size and use it as a template for making more from plain paper like this guy does: https://m.youtube.com/watch?v=AvsOkp_WPxY )


That's a very good point. I wonder about the durability of a paper based solution, but 3d printed rolls might also be suboptimal in that regard. This needs some experimentation.


I'd imagine that if paper alone wasn't strong enough for long term use, using sellotape to cover the entire roll such that the whole thing has a layer of tape on top of the layer of paper would make them pretty durable and add very little time and cost to it. (But I've not done anything like this, so my guessing could be bullshit - happy experimenting!)


I'd honestly just use some ziplock bags and call it a day.


What's a weighted vest? Something for diving?


It's a vest that you can fill with stuff to increase the intensity of a workout.

There was a time in my life when my legs started hurting and shaking from muscle atrophy because I was programming too much and moving too little.

I was looking for a way to fix that issue and I didn't want to waste time going to a gym, so I started talking walks with a weighted vest. Walking is nice because you can think while walking and with a weighted vest you don't have to walk for hours for it to have a useful effect on your body.


FYI going to the gym is hardly a waste of time. You feel refreshed and your body will thank you after a while.


Working out without the commute saves time.


What is a waste of time is going in and out of the gym.


For information, the current research shows that the intensity of the exercise is much less important than the duration. So if you did so little exercise that you get muscle atrophy, a weighted vest isn't going to do much for you.


> For information, the current research shows that the intensity of the exercise is much less important than the duration

For what goal? Increasing strength? I have my doubts.


They're probably referring to some contrived fitness study on hypertrophy.


Anyone who has actually done both low-intensity exercise, e.g. walking, and high-intensity, e.g. heavy compound lifts, will tell you that statement needs a lot of additional caveats.


You’re gonna need to provide a source to that. For caloric burning? Sure, I’d agree. For cardiovascular health? Eh, the answer lies in the middle. For strength and muscle building? No, quite the opposite really. At some point the intensity of an exercise is so low it provides no meaningful muscle stimulus.


haha yeah nah. This needs a lot more additional context and caveats.

If I'm working on increasing my deadlift's 1rm, doesn't matter if I practice deadlifting for 16 hours a day, 7 days a week, but never go above 10% of my current 1rm


It's a way to increase the risk of injury to your knees and ankles and strain your back and shoulders while taking walks, and in general make walking more unpleasant.

Some people think it's an exercise 'life hack'.


If you're injuring yourself by walking around with a few extra kilos then you are so, so hilariously out of shape that any advice you can give is competely disregardable.


I avoided injury when backpacking through the Himalayas by tying helium balloons to by backpack for neutral buoyancy. Had to make slight adjustments as altitude changed, but it all worked out. I had my porter carry the helium tanks.


God must have created America, humans wouldn’t have been capable of trekking with such weight.


I do not know if that is satirical, specially the last sentence?


The OP said their legs were shaking just standing due to lack of exercise. So, they were literally that hilariously out of shape.


The risk of injury while walking in a weighted vest is not much higher than walking normally. A very high weight of vest is probably ill advised, but walking on a very flat/regular surface for long periods is far more damaging than walking with a little extra weight. Weighted bracelets/limb weights are dangerous though, and shouldn't be used unless you know what you're doing and take care not to move too quickly and put excess strain on joints.


How much weight on a weighted arm band is considered dangerous? I'm considering 500 gram bands for my arms, that's just about twice the weight of a cellular phone today.


It depends on what you're doing, but 500g shouldn't be dangerous as long as you wear the weights tightly bound so they don't bounce or slide. What you want to watch out for are anything that overextends or puts pressure on the joints - those movements can cause damage even unweighted and having weights just makes the danger worse.


I'd be worried about blisters/rashes/rubbing if the weights slide around. I use an exercise-bike like device and realised I was getting a blister on my hands from the constant motion of the grip.


Thank you.


Ehh, I've been doing fitness boxing and knockout home fitness (Nintendo switch) with 1.5 kg wrist/hand weights for ages now, no issues to speak off. I think he's taking about the 2-5kg weights, these are way more dangerous then you'd expect from wearing them. (I did that for a while, after getting slightly In shape - at least until I read up on it)

Strong recommendation for Nintendo switch for baseline fitness btw, these games are great for a 1-2 day 20 minutes workout/week for unfit office workers. Way better experience then the equivalent VR games.


What are the equivalent VR games? Just curious.

I don't play too much VR these days, but enjoyed Beat Saber for "stationary movement", Gorn for beating up stuff and the VR ports of the original Serious Sam games for "run and shoot like a maniac".


These can be pretty physically challenging too! my issue with arcade style games for fitness is that they stop whenever you fuck up. That's not really great when your goal is to get moving for ~20 minutes or so.

The one's I've currently got installed on my quest 3 are

Supernatural Fitness (I need a VPN to play because they're geolocking it to USA). I find the way they try to "get personal" with the trainer super awkward.

FitXR (only one with decent passthrough gameplay) I dislike how most exercises are centered around "gyms", whenever you enter a session, there are others around you doing the same exercise as you and you get a scoreboard. It really doesn't vibe with me whatsoever. I also don't believe that I almost always get first or second place - I'm pretty sure this is showing you numbers to make you feel good about yourself.

XR workout It's the most "indie" of these and with the highest difficulty ceiling. It's biggest downfall is that it doesn't really give you a generated "I wanna exercise for 20 minutes" button. At least I couldn't find it.

There are also others, but I don't have them installed. I.e. Les milles etc

But as I said before: purely from a workout perspective, the Nintendo games work way better in my experience.

It's just so awkward in VR compared to Knockout Home Fitness, worse signalling what you need to do next - you're wearing a headset while getting sweaty - no center stage youre watching, instead youre just trying to guess which movement you're supposed to do while things randomly float around.

https://m.youtube.com/watch?v=ctLdgFf5GCQ


Your body weight varies by more than that during the course of a normal day. Carrying 1kg should not increase any sort of risk of injury unless you exceptionally weak (as in, have trouble walking at all).

For the same reason, you probably won't see much benefit from such light weight over just walking a little faster or a little further.


The problem is that when you put weight on your limbs you are creating levers and inertia which get transferred to joints in ways those joints are not good at dealing with.


How to you carry groceries (or, basically, function at all) if you can't handle a 500g weight attached to your arm?


One usually doesn't do much with their arms while carrying groceries, they just hang at the side or move the bag around when putting it down or picking it up. When performing other movements, especially when they are fast or forceful, the extra weight can add momentum that is potentially hazardous, especially if it bounces or moves around (makes it very hard to compensate for reflexively). If present during repetitive tasks, extra weight can increase the risk of repetitive stress injuries occurring.


Some people have no, zero, none understanding of sensible limits. "If X is good then more X must be better" applied to one or more aspects of their life. Hence protein in their diet, vitamin supplements, weight in a vest, and of course, infamously, having a presence on social media.


Is it worse than carrying a backpack?


I went 0' 5' 10' 15, 20kg over 3 years after an embolism. N=1 (rather like yourself: or you spoke to/ read about people that don't quite understand 'pacing'. Do you/ them struggle with 1 bag of shopping? I make three or more light(er)trips.


In the same way that consuming food and drink is? Or carrying a backpack of things you need, not just dead weight?

Maybe I misundertand - how much weight are we talking about here?


Used in running to add extra resistance.

I've used them on and off in the past; useful in limited circumstances.


> you can also "buy" coins "for free"

Free till you count inflation and opportunity cost. (What you could gian as interest with some other investment)

But yeah, probably still cheaper than some product from a store.


> saved up from my childhood

Isn't Euro just from 2002? That surely is not that long time ago!


It's 22 years ago, roughly


I'm still wondering if there could exist an alternative world where efficient addition over decimal numbers that we developers use on a day to day basis is associative. Is that even possible or is there perhaps some fundamental limit that forces us to trade associativity for performance?

It seems to me that non associative floating point operations force us into a local maximum. The operation itself might be efficient on modern machines, but could it be preventing us from applying other important high level optimizations to our programs due to its lack of associativity? A richer algebraic structure should always be amenable to a richer set of potential optimizations.

---

I've asked a question that is very much related to that topic on the programming language subreddit:

"Could numerical operations be optimized by using algebraic properties that are not present in floating point operations but in numbers that have infinite precision?"

https://www.reddit.com/r/ProgrammingLanguages/comments/145kp...

The responses there might be interesting to some people here.


I’m not 100% clear on what you are asking, but integer addition is associative, right? (With quibbles about over/underflow of course). If you have some limited range of decimal numbers that you care about, you can always just use integers and account for the shifted decimal places as needed.

Floats are mostly for when you need that dynamic range.


It could also be that a lot of languages don't actually have integer types and just use a 64bit floating point number instead - ala JavaScript etc.


worth mentioning - js has had a built-in bigint type for quite a while now:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

the problem is it's marginally useful, since everyone expects number


Really? That seems nuts. How do they index an array?


They index them with doubles, they do the same with loop variables. As long as your integer is less (in absolute value) than about 2^53 (because they have 53 bit mantisas) you can represent it exactly with a double. 2^53 is 2^(10*5+3) so even if you're indexing individual bytes that many indexes works until you need to index into an array with 8 petabytes of data in it, at which point you're probably not using javascript anymore.

Like many things in javascript it's a bit cursed but it does work.


Plus 53-bit indices exceed the amount of memory that many 64-bit architectures can address (x86_64 is 48 bits, ARM is either 48 or 52 bits).



Thanks for the correction! TIL.


Tbf, it's not commonly run because it increases TLB miss latency for rarely any benefit (why are you mmap-ing so much? How can you afford to keep that much data around...).


In practice, JavaScript has 32-bit signed integers and 64-bit floating-point numbers as distinct types (look into any JS engine, and you'll see a distinction between the two being made), even if they both surface as a single "number" type. You can also see the distinction in the way that bitwise operators coerce numbers to integers, even though the arithmetic operators coerce to floats in theory.


The spec describes the behavior of converting to and from 32-bit signed for the purposes of the bitwise operators. https://tc39.es/ecma262/#sec-toint32


floor() enters the chat


It would be quite funny if that was how it worked, but it just checks to see if the exponent is 0 and then uses the mantisa as the index if so.


> I'm still wondering if there could exist an alternative world where efficient addition over decimal numbers that we developers use on a day to day basis is associative. Is that even possible or is there perhaps some fundamental limit that forces us to trade associativity for performance?

You're always welcome to use a weaker notion of associativity than bitwise equality (e.g., -ffast-math pretends many operations are associative to reorder them for speed, and that only gives approximately correct results on well-conditioned problems).

In general though, yes, such a limit does exist. Imagine, for the sake of argument, an xxx.yyy fixed-point system. What's the result of 100 * 0.01 * 0.01? You either get 0.01 or 0, depending on where you place the parentheses.

The general problem is in throwing away information. Trashing bits doesn't necessarily mean your operations won't be associative (imagine as a counter-example the infix operator x+y==1 for all x,y). It doesn't take many extra conditions to violate associativity though, and trashed bits for addition and multiplication are going to fit that description.

How do you gain associativity then? At a minimum, you can't throw information away. Your fast machine operations use an unbounded amount of RAM and don't fit in registers. Being floating-point vs fixed-point only affects that conclusion in extremely specialized cases (like only doing addition without overflow -- which sometimes applies to the financial industry, but even then you need to think twice about the machine representation of what you're doing).


> How do you gain associativity then? At a minimum, you can't throw information away.

That's an interesting perspective that I haven't considered before, thank you.

Now I'm wondering, could we throw away some information in just the right way and still maintain associativity? That is, it doesn't seem like throwing information away is fundamentally what's preventing us from having an associative operation, since we can throw information away and still maintain associativity by, for example, converting each summand to a 0 and adding them, and that operation would be associative. However, we would have thrown all information away, which is not useful, but we would have an associative operation.


Herbie, a fp optimizer, might be of interest to you

https://herbie.uwplse.org/


There's a link in there to future directions for Herbie which talks about the intriguing idea of out-sourcing the translation of a high level "I want to do this real number math" to the lower level "Here's some floating point arithmetic" via Herbie.

That is, the physicist writes the two line equation they want for electromagnetic force into their program, the same way they'd write a for-each style loop in the program if that's what they needed.

Obviously the CPU doesn't understand how to compute the appropriate approximation for this electromagnetic force equation, but nor does it understand how to iterate over each item in a container. Tools convert the for-each loop into machine code, why shouldn't other, smart, tools convert the physicist's equation into the FP instructions ?

Today the for-each loop thing just works, loads of programming languages do that, if a language can't do it (e.g. C) that's because it is old or only intended for experts or both.

But every popular language insists that physicist should laboriously convert the equation into the code to compute an approximation, which isn't really their skill set, so why not automate that problem?


> Could numerical operations be optimized by using algebraic properties that are not present in floating point operations but in numbers that have infinite precision?

... are you not aware of -ffast-math? There are several fast-math optimizations that are basically "assume FP operations have this algebraic property, even though they don't" (chiefly, -fassociative-math assumes associative and distributive laws hold).


That's where Dart and Flutter shine. Sadly, people discussing Swift/SwiftUI, Kotlin/KMP, and Dart/Flutter often only have surface-level comments that do not address potential issues like these.

Dart's static type system has been designed to avoid such problems.

Not once have I had, or heard of, a performance issue related to the Dart type checker. That's also one of the reasons why hot reload always works as expected.


There's a similar project from Google: https://github.com/flutter/packages/tree/main/packages/rfw

rfw is used by Google's Gemini LLM to generate UI.

rfw runs on the web/android/ios/macos/linux/windows, anywhere where Flutter runs.


There's a similar project at Intel: https://github.com/intel/rohd

It uses Dart instead of Scala.


Hey, I'm the lead for that! I think it addresses a lot of the problems raised in these comments about Chisel and other generator frameworks. Happy to answer questions! https://intel.github.io/rohd-website/


Are you saying this because r-trees expect a proper metric space, and people have the need to index datasets over non-metric spaces?


The curse of dimensionality creates a seemingly paradoxical situation where you have a vast vast search space, but everything is incredibly close to each other. Space subdivision algorithms become ineffective.


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

Search: