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

[REBOL] Re: foreach with block question

From: joel:neely:fedex at: 14-Oct-2001 8:30

Hi, Miquel, Miquel Gaya wrote:
> Are there an independent of 'a Jeff's solution type of solution ? >
Here's a variation that favors readability over esoterica. This way you can use whatever names you like, and do other things with them than just print the (sub-)block of values.
>> rowlength: 5
== 5
>> s: data
== [1 AAA BBB 3 0 2 MMM XXX 1 1 3 DDD VVV 2 1]
>> forskip s rowlength [
[ use [u v x y z] [ [ set [u v x y z] copy/part s rowlength [ print [v x y z y + z "(" u ")"] [ ] [ ] AAA BBB 3 0 3 ( 1 ) MMM XXX 1 1 2 ( 2 ) DDD VVV 2 1 3 ( 3 ) As far as BIND itself, please see my note to Chris about how that one works. That might explain why "a" through "e" are the only names which work at the end of the BIND phrase. HTH! -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;