1. 5

    Rationals would be a great default number type. When fractions are available you have to go way out of your way: Fraction(1, 10). Why shouldn’t 0.1 mean exactly one tenth?

    Floats can have the ugly syntax: float(0.1). You’re rounding 1/10 to the nearest float.

    1. 3

      The problem is that only rationals which divide nicely by 10 have such nice syntax. For example, 1/3 cannot be written down in decimal point notation (as it would be 0.333 followed by an infinite number of threes). So, it makes more sense to use the fractional syntax for rational numbers and the decimal point syntax for floating-point numbers.

      Of course, you can have your cake and eat it too: Lisps use exactly this syntax: 1/3 for rational numbers. It’s slightly ugly when you get larger numbers, because you can’t write 1 1/3. Instead, you write 4/3, appears rather unnatural. I think 1+1/3 would’ve been nicer and would have been consistent with complex number syntax (i.e. 1+2i). But it does complicate the parser quite a bit. And in infix languages you can’t do this because of the ambiguity of whether you meant 1/3 or (/ 1 3). But one could conceive a prefix syntax like r1/3 or so.

      It’s unfortunate that the floating-point notation us humans prefer to use is base 10, while the representation in a computer is base 2, because these don’t divide cleanly, hence the weirdness of how 0.3 gets read into a float.

      1. 4

        Instead, you write 4/3, appears rather unnatural.

        Unnatural? Nah. Maybe a bit improper, though.

        1. 2

          4/3 appears rather unnatural

          Matter of opinion.

          notation us humans prefer to use is base 10, while the representation in a computer is base 2, because these don’t divide cleanly, hence the weirdness of how 0.3 gets read into a float

          Decimal formats are a thing. Supported by some databases and used for some financial work. Ultimately it doesn’t solve the problem of ‘I want to represent arbitrary fractions with perfect fidelity’. That being said you can go further in that direction by using a more composite number; neither 10 nor 2, but maybe 12.

          in infix languages you can’t do this […] prefix syntax like r1/3 or so

          Better solution: use a different separator. E.g. in j: 1r3.

          1. 1

            Decimal formats are a thing.

            True, but I don’t know of any popular programming language which uses them as the native representation of floating point numbers.

            It works well enough for raku.

            How does it distinguish between a division operation on two numbers (which may well result in a rational number) and a rational literal?

            1. 2


              1. 1

                As far as I know about Raku.

                When you write 0.3 in Raku, it is considered as a Rational and not a Float that is why 0.2 + 0.1 = 0.3 and division operator convert it also internally as a Rational (3/2).WHAT => Rat or (1/3).WHAT => Rat. Use scientific notation to create a double directly (the type will be Num). For arbitrary precision rational number, you will use FatRat type.

                Rational number in Raku from Andrew Shitov course

                Floating-point number in Raku from the same course

        1. 4

          It is actually one of the nicest introduction to what Prolog is (not to how to use it).

          1. 1

            Arbitrary paper read: Optimal Predator Risk Assessment by the Sonar Jamming Arctiine Moth Bertholdia trigona

            “Productivity”: I want a bidirectional synch tool for my Remarkable2, so likely 2% actually working and 98% yelling at build systems in vain until whiskey-o-clock. Hello “__atomic_load_8” my old friend..

            “That one bug”: I’m up to my 3rd dot exporting tool for trying to understand the single (ha) remaining issue with using X11 window managers to partially drive Arcan. Short story is that translating from the Xorg-scene to the scene graph format used in Arcan through the meta-WM does not give the same composition order for windows with a deeper hierarchy (decorations).

            When I’ve failed at all of the above: Re-reading Transmetropolitan

            1. 2

              Let’s be honest go directly for the bald guy with mismatched glasses and his three eyed two head cats. Oh I need to read again Transmetropolitan (■__●)

            1. 14

              I was expecting the worst, but this was actually a really well-done video explaining the issues to do with completeness, consistency, and decidability in mathematics, and how it relates to computer science. Highly recommended!

              1. 10

                Moreover, there is also a lack of knowledge about Karl Popper and the scientific method in scientific circles. For most it is counter intuitive to understand the rejection of the inductivist approach of the scientific method and the limits sets by the empirical falsification. Accepting that in empirical sciences, no theory can be proven is at the opposite how education and teaching scientific theory is done and how the transfer of knowledge occurs in academia (being lessons at university or peer-reviewed research). I wish we could accept and teach a more probabilist view of the truth without the need to set in stone everything. It goes further than just science but it is really present in the scientific discouse.

                1. 4

                  This reminds me of Gettier’s two-pager “Is Justified True Belief Knowledge?” His counter examples rely on conclusions from cogent inductive arguments being true for the wrong reasons.

                2. 3

                  The few minutes starting here are the best explanation I’ve seen of why the halting problem is undecidable.

                1. 14

                  Can someone explain me the point of the rant? I don’t really understand what it’s trying to say.

                  1. 84

                    Every language has some core idea that inspired its creators to make it, instead of putting up with the other perfectly good languages that already existed. Sometimes, that idea is simple (“everything is an object” for Smalltalk, “everything is a cons cell” for LISP), and sometimes that idea is more complex (the way that Java is designed to scale to huge teams, or the way that Perl is “the Cliff’s Notes of Unix”).

                    The author’s idea is that the core idea of Ruby is (waves hands) for making domain-specific languages. It’s not the universal syntax for expressing all algorithms, but if you have an idea for how a particular algorithm should be expressed, you can probably bend Ruby into that shape, at least within a particular class or project.

                    The author’s lament is that Ruby’s core idea was never really named, and thus never advertised, and thus never formed part of Ruby’s reputation. As a result, it didn’t build up the audience of tinkerers and experimenters who could form a long-lived supportive community around it.

                    Instead, what it got was Rails, which was the opposite of that core idea: instead of bending Rails into a domain-specific language for the application you want to create, the idea is to bend your application to fit within the framework Rails provides. And since Rails became hugely popular, the vast majority of the Ruby community valued that framework-style approach and Ruby just became the incidental-complexity runtime for Rails instead of an interesting thing in its own right.

                    1. 11

                      Brilliant summary. Well done.

                      1. 4

                        The Ruby-on-Rails revolution and its consequences have been a disaster for the Ruby race.

                        1. 2

                          Can you expand a bit on the idea that Ruby is for DSLs? I feel like I’ve heard that here and there and it always seemed like a bit of a stretch. Ruby just doesn’t have things that I would think would be critical for truly writing DSLs, such as lazy evaluation and macros.

                          The vagrant config, for example, is a bunch of ruby code that calls itself a DSL but it really just feels like… writing ruby. Python, for instance, could do it just as well (see: SCons).

                          1. 5

                            The instance_exec method allows for succinct DSLs whose syntax couldn’t be easily copied in other languages like Python. Basically, it allows you to evaluate blocks as if they were running in the scope of an arbitrary object’s methods — or to put it in Rubyist terms, it allows you to execute blocks with an arbitrary receiver. For (a completely contrived) example, in Python you might write:

                            conf = Library.config_object()
                            worker = Library.worker(conf)

                            Whereas a Ruby library might read:

                            worker = Library.worker do
                              config_file "foo.txt"
                              worker_processes 2

                            The interior of the Ruby block defining the worker feels in a certain sense like a DSL; these methods are not in global scope: they’re special methods that are accessible inside the block, running on an anonymous object. It’s sort of like having a domain-specific language with new keywords — config_file and worker_processes — that elegantly composes with standard Ruby.

                            Of course, really all it means is you can leave out repeated references to conf, since Library.worker makes everything run as if it’s in the scope of some method on conf (and Ruby has implicit self inside method calls, so you can write config_file instead of self.config_file). But ergonomically it can feel nice. It’s the same number of lines, but much less significant text.

                            1. 1

                              To your point: until I read this comment, I had no idea that the Vagrant config was even supposed to be any kind of DSL. It just looked like ordinary Ruby to me.

                            2. 1

                              Thank you… Didn’t even bother reading the post - love your writing style too!

                              1. 1

                                Thanks for that. I never learned that about ruby because the first and only place I tried it was (gross) codecademy, before I’d started learning how to code.

                                1. 1

                                  The author’s lament is that Ruby’s core idea was never really named, and thus never advertised

                                  I know this is not your point, but I have a bunch of populer old books from ruby 1.9 times such as “metaprogramming ruby” and “rspec” which disagree.

                                2. 5

                                  That Ruby never gained traction for the face value of its expressiveness. I feel that this rant imply that the mix of semantic approach of Perl and the meta-approach of Lisp meeting in the right balance in Ruby have not been recognized and exploited fully to show what Ruby really is.

                                  The way the author speaks about “phrase-based” reminds me of Perl, Raku, APL, dense language where you can express yourself in short understandable phrase. The author pushes the idea that this is the meaning of the mantra “Desifned for developer’s happiness”. To be happy, you have to be able to express yourself without convolution and Ruby provided that solid base and rich vocabulary to be expressive and precise.

                                  1. 3

                                    Me neither. Wondering if I should flag this as off-topic.

                                  1. 1
                                    • Continue onboarding at $work.
                                    • Discovering and playing Exploding Kittens and Azul (card and boardgame respectively)
                                    • Reading Georges Perec - L’art et la manière d’aborder son chef de service pour lui demander une augmentation (Translated it would be “The art of asking your boss for a raise”). It is not a motivational book, it is an absurd novel. Georges Perec write it without any punctuation at all and the impact on the reading experience is very uneasy. It is a one sentence novel about professional life and the loose of sanity and identity by an employee trying to ask their boss a raise.
                                    1. 3

                                      ${HOME}: I made homemade ricotta and it turned out great. That is step one in making homemade syrniki. (I need to point out that I have never made either of these things before….well, I had one abortive attempt at making ricotta that failed miserably.)

                                      ${HOBBY}: Hopefully finishing up my custom regex engine.

                                      ${WORK}: Creating a completely hands-free installer for our code for deployment in airgapped situations with untrained technicians.

                                      1. 2

                                        I would be happy to know how you made your ricotta. I tend to do labneh at home from time to time.

                                        1. 2

                                          I sent you a message. Let me know how it turns out!

                                      1. 3
                                        • Onboarding at new job, meetings, familiarizing myself with the teams and the tools (I have to say that I missed that after six months of job hunt)
                                        • Took a Macbook Air as work laptop and learning how to use it after 10y of linux (my private laptop is still on Fedora).
                                        • Enjoy seeing friends and family and get back to job routine.
                                        1. 2

                                          What’s the new job?

                                          1. 3

                                            Geospatial Data Analyst in an start up specialized in Health Information Systems called Bluesquare. It is the crossover of my previous jobs and on paper the perfect next job I wanted to consolidate my experience and really grow. Pretty excited by it to be honest!

                                        1. 6

                                          I’ve been working on alternate firmware for the Novation LaunchPad Pro, a MIDI controller consisting of an 8x8 grid of pressure-sensitive pads and 32 buttons, all with RGB LEDs. Novation released open source code for it a few years ago, but for various reasons (explained in the README) it doesn’t include the default functionality, it’s more of a blank-slate framework.

                                          I’ve been building on that, and I’ve reproduced the basic “notes mode” and added a chord mode and better support for different scales. The end goal is to add a sequencer.

                                          I’m doing this in C++17 with an OO design, despite the fact the hardware has only 20KB RAM, a few hundred KB flash, and zero standard library (not even memcpy, let alone malloc.) so far it’s going great. I’m having fun seeing how far I can push constexpr — I have classes for notes, scales, modes and chords but there’s no runtime overhead. I can write Mode major(“*-*-**-*-*-*“) and it compiles into a uint16_t. So far I’ve used about 35KB of code and maybe 1KB RAM (mostly for double-buffering the LEDs.)

                                          I made the weird discovery that, since my musical model classes are nearly all constexpr, they can have compile-time unit tests! I just use static_assert for my assertions, and I can see my IDE flag them as passing or failing as I type, without even having to build. It’s quite weird.

                                          1. 2

                                            That’s amazing! Do you plan to post something (blog, notes) somewhere? I would be super curious to read about that as I am looking to settle for a groovebox but lurking on the various grid-based hardware existing too.

                                            1. 2

                                              Thanks! I hope to push it to GitHub in the next few days. It’s a useful tool by now, and the code’s decent enough that I feel ok letting other people see it. I just need to change the settings page a bit and write a new README.

                                              Once it’s up I’ll post it to Lobsters, of course.

                                          1. 5

                                            Factory reset may brick your device. This function may not do what you are expecting. While it resets all user data, it will not restore the device to the original factory condition.

                                            Why is it even called a factory reset if it doesn’t restore the device to the original factory condition?? They should just call it what it is and get rid of the disclaimers

                                            1. 4

                                              Just to be clear, this github repo and the different softwares/API are maintained by volunteers not by reMarkable company.

                                              1. 2

                                                Noted. Doesn’t change my suggestion lol

                                                1. 1

                                                  It does not but the clarification is needed to separate between whom has the better label their functionality and whom would be able to get rid of the warning. I totally agree with your remark and suggestion.

                                            1. 5
                                              • After six months looking for a job and unemployed, signing a permanent contract in a really wanted job which will began in two weeks \o/
                                              • Preparing myself for the onboarding and stuff
                                              • Relaxing and take some good time
                                              1. 3

                                                This article leaves me uneasy between the broad brush paints against not-sure-what and pushing from one fallacy (scientists don’t know enough stats, the system is rigged with stupid indices to evaluate research (p-value)) to another one (highly complex models without any control or understand but that may or not predict something based another set of indices). I find it dishonest to shout out only social sciences where medecine and biomedical sciences are at the heart of the replication crisis. The first list about the differences between “classical statistics” and ML seems false based on how I learned. Cross-validation was always part of the models evaluation, [experimental design] is utterly essential knowledge to assure the analysis of “Aan experiment (in generally : How, why and by whom your data are created is essential knowledge to identify biais at the origin of the dataset).

                                                One really good book to better understand statistics for anyone is Statistics done wrong by Alex Reinhart.

                                                First quote learned about models and the only to always keep in mind “All models are wrong, but some are useful” attributed to G. Box.

                                                1. 1

                                                  There is a replication crisis in all areas of research. It just so happens that Medicine and biomedical researchers are the first to make a major fuss about the issue, and start doing something about it.

                                                  The replication crisis is motivated by the low status of performing replications.

                                                  Software engineering is a long way away from a replication crisis, because so few experiments are done in the first place.

                                                1. 11

                                                  I think it is one of the first “why xx rewritten in Rust” I read that is not about safety, borrow checker, etc. And also one of the simplest presentation of the trait system and deriving.

                                                  I was reading Learn Haskell Fast and Hard and maybe that is why it was easier to grasp.

                                                  1. 3

                                                    Awesome work on Raku, thanks Jonathan Worthington! One kind of dispatch that seems missing, I don’t if it could be applied in Raku, is on the return type. Maybe it would involve too much complications?

                                                    1. 1

                                                      Dispatching on return type makes code non-understandable by a human reader.

                                                      1. 1

                                                        But could provide a better ergonomic interaction between functions as in Rust. I am thinking about return type polymorphism. I have the fealing that’s in a way it maybe already possible in Raku but have not the knowledge to confirm it.

                                                        1. 5

                                                          Perl has something sort of resembling that in the form of “context” (functions can see whether they were called in a context expecting a scalar, a list, or no value at all, and alter their behavior accordingly). One of Raku’s early design goals was to kill that, making functions context-insensitive, and having them return values that might be “multi-faceted” enough to be used wherever they ended up.

                                                          If you extend that philosophy, it says you’ll probably never see return type polymorphism in that form. But you can have functions return objects with coercions (“if you try to assign me to a Hash, I’m this; if you try to assign me to an Array, I’m this”); if you assign to the unspecified type, you get the raw object, with all of its potential. Or, more idiomatically, I think, you would just return an object that does both the Positional and Associative roles, which makes it compatible with either kind of subscripting and iteration, without having to transform into a new value.

                                                    1. 8

                                                      I totally support the tag proposal!

                                                      If a specific tag for Raku could not be accepted, another possibility would be to change the description of the Perl tag in the spirit of the APL tag to include Raku specifically. It is not ideal but an option.

                                                      1. 5

                                                        I think this is probably best. I don’t think that there’s enough of a difference between the two languages to support an extra tag (I know there’s some difference. Maybe I’m completely off the mark here, I’ve only slightly used Raku). I’d point to the “lisp” tag as an example of a tag for various languages that are only tangentially related (admittedly clojure is a separate tag) and I’ve seen a lot more around here about lisp than perl.

                                                        maybe perl people are different from lisp people in what they do and don’t want to see, but i know that a lot of common lispers don’t care at all for scheme, and schemers don’t care for common lisp.

                                                        1. 11

                                                          They’re basically two different languages, and I’d personally appreciate being able to browse Perl (5) posts without seeing Raku posts. But I’m okay with Raku posts under the perl tag if the amount of Raku posts is still low.

                                                          1. 2

                                                            I would differentiate between what I see and think that the communities only partly overlap. There are also some historical reasons I think.

                                                            Personally I’d prefer to be able to filter between one or the other, so I agree with the statement:

                                                            Having a separate tag will both enable Raku enthusiasts to promote the language, and Perl 5 curmudgeons to filter it out ;)

                                                        1. 7

                                                          Yikes. If I read this correctly, it could really screw up FastAPI. That would be a serious headache for me, in a way that’s far worse than the breakage I normally expect from a “3.9” -> “3.10” transition.

                                                          1. 2

                                                            Could you explain what breakage points do you expect for FastAPI with those changes that may impact Pydantic?

                                                            1. 6

                                                              FastAPI uses pydantic for data validation. By my read of this issue, if PEP 563 happens without PEP 649, the code I write will see data that’s not been validated the way I expect it to. If my code treats data that hasn’t been validated as if it has, I’m gonna have a bad time.

                                                          1. 17

                                                            I used to use SQLite all the time for geospatial data using the SpatiaLite extensions, it made dealing with data in many different formats much easier (and scriptable) and just simplified a lot of the work we had to do to manage weird datasets on nationalmap.gov.au(/renewables - sadly recently made defunct due to lack of government funding).

                                                            We’d pretty regularly get CSVs with columns for LAT and LON, and need to do some actual work with the data, or turn it into another format like GeoJSON. Or we’d get a bunch of GeoJSON data that we wanted to manipulate.

                                                            Probably the most useful thing I did (but have probably lost access to sadly) was sticking the Australian Government’s Geocoded National Address File (GNAF) into a SpatiaLite database which we could use to geocode addresses, display know addresses etc. It handed the rather large quantity of data well (though IIRC generating spatial indexes for the several million locations took a while. Having the indexes meant we could do things like find all addresses which mapped to identical or nearby locations.

                                                            All this is pretty basic, and could be done in plenty of tools, but it ended up being the one that was most flexible, allowing us to do more than we could in QGIS and without having to buy licenses for ArcGIS. Importantly it was also as powerful, at least as far as we needed, as PostGIS which we used for serving much of the data. Anything we knew would be static was simply put in SpatiaLite databases and handed to GeoServer.

                                                            1. 1

                                                              This is a great illustration on why geospatial data must move past shapefiles and other clunku format to sqlite+spatialite and Geopackage (being sqlite+spatialite configured). Having al you data in a geospatial-aware database let you use easily Geojson as the data format to transfer in-between but also allow to just drop Geoserver/Mapserver in front of it (the databases) and provide WCS/WFS api for free or almost. QGIS can also be used easily as a viewer for a local or remote database with PostGIS or Spatialite or an editor also.

                                                              There is some much to move to in the geospatial/gis field to simplify the data format and get rid of past format as shapefiles that is a pain to work with.

                                                            1. 6

                                                              Chorded keyboards are a thing, I have a https://www.gboards.ca/product/georgi, and apart from taking a bit of time to get used to it, it’s a nice way for input.

                                                              1. 4

                                                                Steno keyboards are a thing. Look at Plover if interested.

                                                                1. 4

                                                                  Hahah, this is the keyboard that always breaks my autocompletion! I made a (full-size) keyboard called “George”, and whenever I try to cd into its QMK directory, autocompletion always annoyingly stops at “georg” because there’s “georgi” too. I had no idea it was chorded as well, thanks for the link!

                                                                1. 25

                                                                  So basically we finally arrived at the “make your app a web page” that Apple demanded when launching the iPhone

                                                                  1. 30

                                                                    Yes, and the latest trend in web development is to render content on the server. Everything old is new again!

                                                                    1. 7

                                                                      I think it’s better this time, because phones and network are fast enough that doing everything in the browser isn’t limited by UMTS speeds.

                                                                      1. 3

                                                                        The original iPhone didn’t even support UMTS (3G), it was GPRS (2G) EDGE (2.5G). A load of mobile providers who had already rolled out large UMTS had to go and deploy older hardware to support the iPhone without it falling back to GPRS. The latency on GPRS was awful (500ms RTTs were common, making it unusable for anything interactive).

                                                                      2. 2

                                                                        I have noticed this and had the very same reaction a few weeks ago.

                                                                      3. 13

                                                                        To be fair: when Apple announced this, React did not exist, Vue did not exist, precursors like Backbone didn’t even exist, and most critically, most of the technologies and tools we use in 2021 to do SPAs, let alone offline webapps, did not exist. Hell, I think the dominant offline storage solution was WebSQL, which was never standardized and is not (AFAIK) supported in any contemporary browser, and no equivalent of web workers existed unless you had Google Gears installed. You also had nothing like WebGL, or web sockets, or even widespread contemporary CSS that would make reasonable, cross-platform styling feasible. So what Apple was offering at the time was morally equivalent to having bookmark links on the home screen.

                                                                        (Yeah, I’m very aware of the pile of old meta tags you could use to make the experience be better than that in a literal sense, but that doesn’t resolve anything else I highlighted.)

                                                                        Speaking purely for myself, I found the initial announcement infuriating, not because I didn’t believe in the web (I did! Firefox was growing! Safari was proving the viability of KHTML! IE was on the decline!), but because Apple’s proposal was just so damn far from what doing that seriously would’ve actually looked like that it felt condescending. The Palm Pre, which notably came out two years later, was dramatically closer to what I’d have expected if Apple were being sincere in their offer. (And even there, webOS, much as I love it, is more an OS that happens to have JavaScript-powered apps than a genuine web app platform in the 2021 sense.)

                                                                        1. 5

                                                                          Even at the time, Apple’s stance felt to me like, “We aren’t finished with our native SDK yet and it’s so far from ready for public consumption that we’re going to just pretend it doesn’t exist at all.” I remember talking about the iPhone with my coworkers when it first came out and everyone just assumed native apps would be coming at some point.

                                                                          Even webOS (which I also loved) ended up supporting native apps eventually, despite having a much more feature-rich platform for JavaScript code.

                                                                          Games seem to be the killer app category that pushes mobile OS vendors to support native code. They’re one of the few categories of application where a lack of native code support can make an app impossible to implement, rather than just making it a bit slower or clunkier but still basically workable.

                                                                        2. 3

                                                                          Even Firefox OS was too early in the game for that (besides other problems of FFOS).

                                                                          1. 6

                                                                            If it was timed right, Mozilla would have found another way to run it into the ground. ;-)

                                                                            1. 1

                                                                              Could not agree more !

                                                                        1. 9

                                                                          Something they miss in the article and I don’t see in the comments here either is just how much a move like this limits the app’s audience size.

                                                                          I have a feeling most crustaceans would be SHOCKED at how many “end users” would peel off and walk away when confronted with instructions to add a web app to their mobile device’s home page in favor of just downloading a native app from the app store.

                                                                          1. 5

                                                                            Why not make a “Web Store” that helps with aggregation and discoverability of web apps that will link to the website. It will give more credibility to the web app and not some unwanted pop up that screams “Download me”.

                                                                            1. 2

                                                                              Since we’ve broached the topic of iOS feature requests, why not make a “unlocked bootloader” that helps with aggregation and discoverability of apps (and daemons) since there is no longer the concept of an “app store”. It will give more credibility to 3rd party developers and not some unwanted censor that screams “it’s for your security and privacy!!!one!11”

                                                                              1. 5

                                                                                Ah, yes, because getting rid of a centralized, built-in way to discover new apps which (generally) are known to be more or less safe is a great idea for the average, often-times tech-adverse consumer.

                                                                                I can think of no way in which this could cause a negative impact for app discoverability, make it more difficult for users to install applications, or increase the risk of downloading and running malicious code (which, before you say it: no, the average user is not going to know how to check to see if something is malicious).

                                                                                This sounds like a fantastic idea.

                                                                                1. 1

                                                                                  I’d agree, but the stores would need to do a better job of curation. As of now, there’s still a lot of grift and outright scams on the iOS app store - let alone the Android or Windows one. It undermines the message.

                                                                                  1. 1

                                                                                    Very true. The stores are all quite bad at curation, but I’d wager even a half-assed curation is better than none at all.

                                                                                    1. 1

                                                                                      You took my comment the wrong way. That’s not what I meant.