Tuesday, October 9, 2007

Fun with tags

I've been playing with groovyconsole the other day to experiment with some 'tag' (yes, the web2.0 tags) :-) manipulations, etc. Let's say I wanted to build the del.icio.us style 'for:username' tag trickery, to send a message, save bookmark, etc. to any particular user's 'private inbox', etc. Extremely easy with Groovy:


tags = ['tag1', 'tag2','for:dima','tag4','for:someoneelse']

usersWhoShouldRecieveSomething = tags.findAll { it[0..3] == 'for:'}.collect { it - 'for:' }

assert usersWhoShouldRecieveSomething == ['dima','someoneelse']


Later...