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

[REBOL] Map

From: al::bri::xtra::co::nz at: 5-Oct-2000 15:54

jn wrote:
> > The next one (I can't recall if there's a common name for it) can be
used for statistics and other fun things: Chris wrote:
> In Lisp this function is still MAP. MAP takes any number of sequences and
the function takes a number of arguments equal to the number of sequences:
> (map 'vector #'max '(4 7 16) '(9 5 15)) > => '(9 7 16) > Perhaps the REBOL map implementation could do the same. >> source map
map: func [[catch] Blocks [block!] F [any-function!] /local Results F-Block][ Results: none if equal? length? Blocks length? first :F [ Results: make block! length? first blocks repeat i length? first Blocks [ F-Block: copy [] append F-Block :F foreach Block Blocks [ append/only F-Block Block/:i ] append/only Results do F-Block ] ] Results ]
>> map [[4 7 16] [9 5 15]] :max
== [9 7 16] Bug reports gratefully accepted. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/