From: Arjen M. <arj...@wl...> - 2006-10-31 08:41:43
|
Joe English wrote: >Kevin Kenny wrote: > > >>TIP #272: PRESENT >> Does this TIP have a use case other than benchmarksmanship? >> >> > >I can think of plenty of times when I've needed to >iterate over a list from back-to-front; in such >situations "foreach e [lreverse $l] {...}" is a >much more pleasant solution than the equivalent >"for {...} {...} {...} {...}" loop. > >[string reverse] has fewer apparent use cases, but >there are a couple -- > > map {string reverse} [lsort [map {string reverse} $filenames]] > >is a quick-and-dirty way to collate a list of filenames >by extension for instance. > > > I am no expert, but I think string reversal is also useful with genetic sequences. Regards, Arjen |