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

[REBOL] Re: Clunky-looking code

From: chris:arranfolkfestival at: 2-Apr-2001 14:36

Hi Colin,
> I'm trying to multiply respective elements of two blocks and get a > single sum: > e.g. > [a b c] * [d e f] = a*d + b*e + c*f
This may be neater... Matter of opinion really. multiply-blocks: func [ block-1 [block!] block-2 [block!] ][ sum: make integer! 0 while [and not tail? block-1 not tail? block-2][ sum: add sum ((first block-1) * (first block-2)) block-1: next block-1 block-2: next block-2 ] return sum ] Actually, its a fair bit longer than your suggestions - but it is an alternative :o) - Chris