|Don't ask to ask, just ask|
Re: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)by BrowserUk (Pope)
|on Aug 12, 2007 at 14:34 UTC||Need Help??|
Given that haskell's group is a library routine defined (one flavour) as:
it would be equivalent to hide the complexity of a perl equivalent in a function, and it might be defined something like this:
Giving a roughly equivalent one line usage:
Of course, the equivalence is only rough because Haskell's syntactic sugar of allowing a list of chars to look like a string. The above won't work for an arbitrary list.
I remember suggesting that it would be nice if Perl 6 would allow a scalar to be treated syntactically as a list of chars: $scalar = 'x'; etc. It would allow a single routine to be polymorphic to arbitrary lists and scalars and simplify the above, but I guess it wouldn't work for many other cases.
BTW, does anyone know of a CPAN module that can solve this problem directly?
I just did a codesearch for lang:haskell 'group', and without promising to have exhaustively searched every link, I couldn't find a single use of group in any of the first 5 or so pages of hits.
Loads of definitions, mostly the same but some variations in different libraries, but no uses.
I guess that's why you won't find it on cpan. Other than for essentially academic uses like this, there are very few uses for it.
Of course, now someone will turn up a 300 lines haskell module with 250 uses of group, but on the basis of what I found, it's not exactly an essential function.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.