Name: Anonymous 2014-12-20 10:36
"I was a C++ programmer before I started designing Ruby. I programmed in C++ exclusively for two or three years. And after two years of C++ programming, it still surprises me."
And after two years of C++ programming, it still surprisesThat's not a good property for a language.
And after two years of C++ programming, it still surprisesThat's not a good property of a programmer.
Haskell has 21 reserved keywords that cannot be used as names for values or types. This is a relatively low number (Erlang has 28, OCaml has 48, Java has 50, C++ has 63—and Miranda has only 10), and keeping it low was a priority of the Haskell Committee.
module where
import let
in where
do case
of class
instance infixr
infixl data
type newtype
foreign deriving
if then
else
It is an operatorYou must think
+
is a HASKAL operator too. Well it is, but it is also a function, and actually there's no function-operator distinction here. >>=
is just another function of the Monad type class, and actually you could define a Monad instance with return
and >=>
too, so there's nothing special about >>=
.>>=
of IO monad as given. That's entirely different from >>=
being somehow syntactically significant. Keywords in C
i;
fizzbuzz(n) {
(i % 3 == 0) &&
printf("Fizz");
(i % 5 == 0) &&
printf("Buzz");
((i % 3) && (i % 5)) &&
printf("%d", i);
printf("\n");
++i;
(i <= n) &&
fizzbuzz(n);
}
main() {
i = 1;
fizzbuzz(100);
}
fizzbuzz(i, n) {
(i % 3 == 0) &&
printf("Fizz");
(i % 5 == 0) &&
printf("Buzz");
((i % 3) && (i % 5)) &&
printf("%d", i);
printf("\n");
++i;
(i <= n) &&
fizzbuzz(i, n);
}
main(argc, argv) {
argc = 1;
fizzbuzz(argc, 100);
}
auto
) but you can create global vars without keywords (this only works because C HAS TO interpret sth like ``i;
'' as decl when it's in global scope, since it can't legally be an expression or statement).