A lot of people incorrectly assume that polymorphism is an Object Oriented thing. This is not true. Polymorphism is an important and generally useful thing, and the vast majority of functional languages provide facilities to accomplish polymorphism.
The challenge itself is simple: write a polymorphic 'range' function that works for more than one type of thing.
Some languages already have ranges, especially numeric ranges. 'range' takes a lower bound and an upper bound and generates a sequence from the lower bound up to the upper bound. Here is an example using Clojure's range function:
user=> (range 1 10) (1 2 3 4 5 6 7 8 9)
As you can see, I generated a range of numbers from 1 to 10 (10 isn't inclusive, so we only get 9 numbers).
Generating a range of numbers is usually easy. Once you've got that implemented, you'll need a version of range that works on something else. An idea for this 'something else' could be characters. You could have it generate a sequence of characters, such as from a to z.
The most important thing is that it be polymorphic. In Clojure you'd use protocols or multimethods, in Haskell you'd use type classes, in Common Lisp, CLOS, etc. You have to write range for at least two different types. I suggested numbers and characters, but feel free to be creative.
There are no specific languages that you have to use, but keep in mind that this challenge doesn't make a lot of sense for *every* language. For example, Java and C# submissions wouldn't be very interesting, because they're predominately object oriented languages. Languages like Scala, OCaml, and Common Lisp that aren't predominately object oriented but support object orientation are fair submissions. Use your best judgement.
This challenge will end on the 31st of this month, at which time it will be unpinned from this forum. The thread wont, however, be deleted.
Have fun, and if you have any questions, feel free to ask them. If you need help with anything that doesn't regard specifics of this challenge but in individual implementations, please ask in a new topic rather than this one.
This post has been edited by Raynes: 17 January 2011 - 10:02 AM