Albert Lai wrote:
Let's have a fun quiz! Guess the mainstream languages in question:
Spoilers for the quiz
0. What language would allow
4["hello world"]
when a normal person would just write
"hello world"[4]
This is a classic C misfeature.
1. What language, supporting a kind of both parametric polymorphism
and subclass polymorphism, allows and actually features such a class
declaration as
class Enum<T extends Enum<T>> { ... }
I have to guess here. Java.
2. What language allows you to test primality in constant runtime?
That is, move all the work to compile time, using its polymorphism.
C++, also a classic feature. There are even books that discuss this
technique, and I believe a SPJ paper referring to it.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe