Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

by Anonymous Monk
on Sep 11, 2007 at 08:20 UTC ( [id://638250]=note: print w/replies, xml ) Need Help??


in reply to Re: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)
in thread Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

Generic version in the D programming language
$ cat test4.d && gdc test4.d -o test4 && echo "----" && ./test4 import std.stdio; T[][] group(T)(T[] array) { T[][] res; foreach (index, elem; array) { if (index == 0 || elem != array[index-1]) res~=(T[]).init; res[$-1]~=elem; } return res; } void main() { writefln(group("ZBBBCZZ")); } ---- [Z,BBB,C,ZZ]
  • Comment on Re^2: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://638250]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found