Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Simple things should be simple to do ?

From: larry:ecotope at: 15-Nov-2000 17:19

Hi Michael The UNIQUE function in REBOL is handy for this sort of thing. Here is my solution to your question: count: func [x /local count][ foreach ux unique x [ count: 0 foreach item x [ if item = ux [count: count + 1] ] print [ux count] ] ] Example:
>> str: "sdfsdfsdfsdfsdfsd"
== "sdfsdfsdfsdfsdfsd"
>> count str
s 6 d 6 f 5 Perhaps others can find a more elegant solution? Cheers -Larry