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

[REBOL] Block/array manipulation

From: mat::b::codeplay::com at: 15-Oct-2001 16:17

Folks, Here's a simple thing which I've needed to do quite a bit of, but couldn't quite figure out how you'd do it in Rebol so tended to do things the long way. Let's take a block of stuff; Stuff: make block! ["fire" "water" "air" "water" "water" "air"] Now the object of the excersize is to to build block with all of the unique values. That bit is easy; foundstuff: make block! [] foreach bitofstuff stuff [ if found? find foundstuff bitofstuff [ append foundstuff bitofstuff ] ] After this, all of the unique values are loaded into the 'foundstuff' block. The question is, say I wanted to do this but count each instance of the words as they are subsequently found? IE I could somehow tell that water was found 3 times and air was found twice. This is where my rudimentary grasp of Rebol fails me. :) Regards, Mat Bettinson Codeplay Tel: +44 (0)20 7482 3382 140-142 Kentish Town Rd, London, NW1 9QB