Anarchism is not chaos, which is what it seems like you think it means. Anarchism is the opposition to hierarchy and is thus directly opposed to fascism and therefore Trump. No anarchist wants to see Trump win because it means fascism has won.
Anarchism is not chaos, which is what it seems like you think it means. Anarchism is the opposition to hierarchy and is thus directly opposed to fascism and therefore Trump. No anarchist wants to see Trump win because it means fascism has won.
No, he’s not. Dumb as fuck take.
Exactly, heavy taxation on the ultra wealthy and wealth caps are incredibly popular topics in liberal circles. I swear some people have never actually talked to a liberal and just attack some strawman they’ve lumped in together with conservatives.
I’m leftist and anti-capitalist, but I also recognize that most liberals are people who want the same things leftists do, but simply haven’t thought deeply enough about what the true root causes of society’s issues are. It’s an issue of tactics rather than a fundamental disconnect in core principles and values. Ultimately they want a more equitable, less stratified society where society helps and supports the disenfranchised. The same thing leftists want. They just don’t understand that capitalism has to go in order to achieve it.
Liberals, unlike conservatives, are actually generally quite reasonable people since they aren’t motivated by hatred. As leftists, we should be doing everything we can to educate them and bring them into the fold, rather than tearing them down.
This is completely different from electron. Nix dependencies will be shared if they share the same hash. Electron just blindly copies everything over every time.
All milk has lactose, which is sugar.
It’s just some kind of starch. It often is noodles, but potatoes or rice are also common.
Spoken like a true addict.
Tiktok is genuinely terrible, as is Facebook and Instagram (though TikTok is somewhat worse).
You’re on Lemmy. People here don’t like Facebook or Instagram either.
Pretty sure everywhere except Minnesota calls it a casserole.
Yeah, it’s a little insane to me to automatically run code that exists in a file in the current directory, by default.
Like there’s a reason that direnv
requires you to execute direnv allow
if you enter a directory with an .envrc
that you hadn’t previously approved.
I don’t know of any other editor that has this as standard behavior, and for good reason.
A language is not functional just because it supports higher order functions. Technically C even supports them (even though the ergonomics and safety of them are terrible). Would you call C a functional programming language? Obviously not. Rust is also not a functional language, even though it comes closer than most OO/imperative languages.
Kotlin and plenty of other OO languages have borrowed some ideas from functional languages in recent years because those ideas are useful. That doesn’t make them functional languages. If Kotlin were a functional language, then it wouldn’t need libraries like arrow to try to make doing FP in Kotlin even (kind of) possible.
Hallmarks of FP (beyond higher-order functions), in no particular order:
There are some minor exceptions, such as Clojure lacking pattern matching, but on the whole functional languages generally fit these descriptions.
It’s funny you mention Reddit because there was a subreddit dedicated to making fun of shit “centrist” takes like yours: https://www.reddit.com/r/ENLIGHTENEDCENTRISM/.
The fact is that politics in the US is skewed so far to the right that the options are center-right (Democrats) or far, extremist right (Republicans).
That list also counts Java and C# as “functional languages”. I wouldn’t take it too seriously. Ocaml, Scala, F#, etc. are impure functional languages. Kotlin absolutely is not. Having a couple of features you might find in functional languages does not make a language functional. Kotlin is still very much an OOP-based language. It’s basically a somewhat nicer Java.
Minor nit: Kotlin is decidedly not a functional language.
Design patterns in OOP exist purely to solve the problems created by OOP itself. If you have a language with proper ADTs and higher order functions, the need for traditional design patterns disappear since the problems they solve are first-class features baked into the language.
The first-class replacement for the Strategy pattern (and many other patterns such as the Visitor pattern) is sum types (called enums in Rust).
All it means is if you were to reverse the order of the characters, you’d get the same string you started with. So “dog” isn’t a palindrome because when you reverse it, you get “god”. “dog god” is a palindrome, though, because if you read it backwards, it’s also “dog god”.
Your post only showed adding functionality over the algebra, not new types on which the algebra operates (or “sorts”, as they are otherwise known). In other words, you can’t easily extend Expr
to support Boolean logic in addition to addition itself. For a concrete example, how could you represent ternary operators like in the expression 2 + 2 == 4 ? 1 : 2
, such that it’s well typed and will never result in an exception? With GADTs, this is very simple to do:
data Expr a where
Lit :: Int -> Expr Int
Add :: Expr Int -> Expr Int -> Expr Int
Eq :: Expr Int -> Expr Int -> Expr Bool
If :: Expr Bool -> Expr Int -> Expr Int -> Expr Int
eval :: Expr a -> a
eval expr = case expr of
Lit n -> n
Add a b -> eval a + eval b
Eq a b -> eval a == eval b
If p a b -> if eval p then eval a else eval b
-- >> eval example == 1 => true
example :: Expr Int
example =
If ((Lit 2 `Add` Lit 2) `Eq` Lit 4) (Lit 1) (Lit 2)
It’s not complicated at all: https://en.m.wikipedia.org/wiki/Palindrome. Not really something that’s education-specific, in this instance (though I suppose it’s commonly used in entry-level programming classes since it’s a simple concept).
This is a very common toy example we use in Haskell, though honestly this OOP version leaves a lot to be desired, comparatively
The issue is that it tries to shoehorn separation of data and functions on data into a paradigm that’s fundamentally about fusing those two things together.
Here’s the Haskell version. Note how much simpler it is because data and functions are separate:
data Expr
= Lit Int
| Add Expr Expr
eval :: Expr -> Int
eval expr = case expr of
Lit n -> n
Add a b -> eval a + eval b
print :: Expr -> String
print expr = case expr of
Lit n -> show n
Add a b -> "(" ++ print a ++ " + " ++ print b ++ ")"
Typescript can do something similar:
type Expr = {
kind: 'Lit',
value: number
} | {
kind: 'Add',
left: Expr,
right: Expr
}
function eval(expr: Expr): number {
switch(expr.kind){
case 'Lit': return expr.value;
case 'Add': return eval(expr.left) + eval(expr.right);
default:
const _impossible: never = expr;
return _impossible;
}
function print(expr: Expr): string {
switch(expr.kind){
case 'Lit': return `${expr.value}`;
case 'Add': return `(${print(expr.left)} + ${print(expr.right)})`;
default:
const _impossible: never = expr;
return _impossible;
}
Both the OOP approach and Typescript itself struggle with additions to the algebra composed of different types, however. For example, imagine extending it to handle booleans as well, supporting equality operations. It’s difficult to make that well-typed using the techniques discussed thus far. In Haskell, we can handle that by making Expr
a GADT, or Generalized Algebraic Data Type. That article actually already provides the code for this, so you can look there if you’re curious how it works.
Nulls are famously called the billion dollar mistake, and for good reason.
Option types are the answer to that problem, because they make the optionality explicit and require one to handle it or propagate it.
That being said: as someone that does functional programming professionally, this looks kinda janky, to me. But the good news is that C# is actually adding support for discriminated unions finally (seriously, it’s been waaaay too damn long): https://github.com/dotnet/csharplang/blob/18a527bcc1f0bdaf542d8b9a189c50068615b439/proposals%2FTypeUnions.md
With discriminated unions, you can finally comfortably work with Option/Result types natively.
Just gonna keep posting this since we shouldn’t be perpetuating lies: https://www.snopes.com/fact-check/jd-vance-couch-cushions/.
How is that pronounced? wow-wow-rohn?