Saturday, September 16, 2023
One-liner dilemmas, the famous Yarn misnomer, and Python's successor becomes open to all | | Coding Bytes of Beauty | Top bitAs a web or mobile dev who could be in a junior position, it's pretty easy get caught in a rut, doing little apart from fixing bugs or displaying data to the user and moving it around. But it doesn't always have to be this way, there's so much more you can do on your own to make coding more exciting: implement complex algorithms and see them spring it to life, learn a new language/framework, solve real-world problems. Create a game!
| A big thank you to today's sponsors, Aura and Surfshark, for supporting all our educational content. | Scammers and spammers hate Aura - and that's a good thing for you | | Fed up with unwanted emails and calls from scammers? Aura leverages state-of-the-art AI to track your personal data exposure online. Claim your online privacy back, secure your information, reduce robocalls, and shield against identity thieves. Try Aura free for 2 weeks to check your data security. | | Featured content | You don't know what a one-liner is | | Here's a one-liner (or is it): | const groupBy = (arr, groupFn) => arr.reduce( (grouped, obj) => ({ ...grouped, [groupFn(obj)]: [ ...(grouped[groupFn(obj)] || ), obj ], }), {} ); | Surely a nice way to show your command of the language, especially in contrast to the step-by-step, imperative alternatives.
But exactly is a one-liner? Is it really code that takes only one line? If so, then can't every piece of code qualify as a one-liner, if we just remove all the newline characters? Think about it.
It seems like we need a more accurate definition, and here's what Tari Ibaba came up with this a while ago:
"A one-liner is a code solution to a problem, implemented with a single statement in a particular programming language, optionally using only first-party utilities". | | Surfshark VPN: Your ultimate cyber shield | | Securing your online activities is crucial. While browsing the internet, you're susceptible to numerous threats such as data leaks, cyber attacks, and eavesdroppers. A single comprehensive solution to combat these threats is a VPN. | | Mojo: 7 brilliant Python upgrades in the new AI language | | Mojo is a superset of Python that combines Python's usability, simplicity, and versatility with the incredible performance of the C language.
A famous claim is that it's 35,000 as fast as Python, and a few days ago, it become generally available for anyone to try out as an SDK. | | Mojo's upgrades to Python: Typed variables with let and var: unlike in JavaScript, Mojo's let is actually immutable. And var has no hoisting, like in C#. Python module integration: You can easily work with any Python module with a Python.import_module() method and run them 35,000 faster. Strong type checking: Mojo checks type at compile-time, just like in TypeScript transpilation.
| | How Yarn 3 became Yarn 2 | | What's Yarn 2?
There are dozens of recent articles and online discussions out there where people talk about "Yarn 2" like it's such a recent Yarn version, when in fact it's been outdated since as far back as July 2021.
At least technically; because the big Yarn update (Plug 'n' Play and all) came in version 2, a lot of people are now calling Yarn v3 (the 2021 release) "Yarn 2", and will probably continue to do so for version 4, 5, and so on.
Plug 'n' Play makes Yarn 2+ certainly superior to NPM & Yarn 1, and probably even better than PNPM. | | | On Twitter/X | | | | | | | |
|
|
|
| |
0 Komentar untuk "Coding should be fun and fulfilling"