- cross-posted to:
- programmer_humor@programming.dev
- cross-posted to:
- programmer_humor@programming.dev
And the best:
public static void () {}spoiler
/s
:(){:|: &};::(){:|: &};: :(){:|: &};::(){:|: &};: :(){:|: &};: :(){:|: &};: :(){:|: &};::(){:|: &};: :(){:|: &};: :(){:|: &};: :(){:|: &};: :(){:|: &};: :(){:|: &};: :(){:|: &};: :(){:|: &};:
Bash fucks me up so much, too. You just put the parentheses there to say that something is a function, not for actually declaring the parameters that can be passed in…
|{}
Haskell:
=The language of the gods
function() {}JavaScript can do better than that:
() => {}C++:
[](){}Huh, I haven’t looked at C++ in decades, and I didn’t know they’d added lambda functions/expressions, in C++11. Apparently you can shorten it further:
[]{}
The intention was to provide a longer version for the first step of the ladder.
Some Lisp dialects:
(λ () )your IDE is hiding 6 characters there
Some Lisps will accept a literal Unicode lambda character.
Remember kids:
public void doFun();
Teacher, I just voided myself in public, are we having fun?
Python: def :
derpface.jpg
They could have put php up the top where it belongs.
Idk much about programming but that looks like a beautiful reduction of bloat in coding language 😶
I don’t use any but I’m sure there are functional languages where () is a valid function.
In Haskell, that’s “unit” or the empty tuple. It’s basically an object with no contents, behavior, or particular meaning, useful for representing “nothing”. It’s a solid thing that is never a surprise, unlike undefined or other languages’ nulls, which are holes in the language or errors waiting to happen.
You might argue that it’s a value and not a function, but Haskell doesn’t really differentiate the two anyway:
value :: String value = "I'm always this string!" funkyFunc :: String -> String funkyFunc name = "Rock on, "++name++", rock on!"Is
valuea value, or is it a function that takes no arguments? There’s not really a difference, Haskell handles them both the same way: by lazily replacing anything matching the pattern on the left side of the equation with the right side of the equation at runtime.Mostly a great comment, but I wouldn’t compare unit to null, it’s more like the void type.
kotlin also has ()->{} and {} (when there is just 1 parameter)
Nix:
x:;











