IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 1 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: ML Functors
Just a note, I think the normal way to do it in Java would be to use java.util.Comparator objects in a 'comparable' way to your use of Functors. The queues could accept a Comparator in their constructors, and use its "int compare(Object a, Object b)" method for ordering - perhaps handled in an abstract base class.

It's entirely possible that I'm not appreciating the ML code (not familiar with it), but the Java version could/should/would be neatly done without the "combinatorial explosion".
New Re: ML Functors
Passing an explicit comparison function/object would work in ML too, but I left it out of the list of possibilities because it's not as type-safe a solution, and I wanted to compare maximally safe solutions in both languages.

Eg, two priority queues with different ordering schemes would have the same signature, which means that it's possible to (for example) incorrectly merge two queues with different ordering schemes. If each kind of ordering is a queue with a different type, then this error can get caught at compile-time. With the signature I outlined it's not a big deal, but for things like a Set class (which have union and intersection methods) it becomes a more significant problem.
     ML Functors - (CrisR) - (9)
         Re: ML Functors - (neelk) - (8)
             C++ templates? - (Arkadiy) - (5)
                 Re: C++ templates? - (neelk) - (4)
                     Re: C++ templates? - (Arkadiy) - (3)
                         Re: C++ templates? - (jlalexander)
                         Re: C++ templates? - (neelk) - (1)
                             Re: C++ templates? - (Arkadiy)
             Re: ML Functors - (luke) - (1)
                 Re: ML Functors - (neelk)

Oh look... it's a dork!
201 ms