And the best:
public static void () {}
spoiler
/s
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: =
function() {}
JavaScript can do better than that:
() => {}
Some Lisp dialects: (λ () )
Remember kids:
public void doFun();
Python: def :
derpface.jpg
that's a class method not a function tho
AFAIK the syntax seems to be the same.
def sayHam():
print("Ham")
sayHam()
works when typed into the Python console, no class needed. I program as a hobby, I'm no expert on the language, but does Python even differentiate between functions and class methods internally? Other than just scope? There's a possibility I'll learn something today.
I thought python was one of those weird OOP languages like Java or C# that bound all classless methods to some universal static class but im wrong on that.
They are out there though so be on the lookout for these languages that doesnt believe in algebra.
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 value a 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.
all 39 comments