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

[REBOL] Re: Trace function

From: joel:neely:fedex at: 22-Jun-2001 1:49

Hi, Christophe, CRS - Psy Sel/SPO, COUSSEMENT, Christophe, CPN wrote:
> [My experiences on that field are similar to those of Joel. > - BTW I don't know *MAP* what does it means ?- >
We've kicked around several variations on the MAP theme, here's one... map: function [ {Maps a function to all elements of a block} [throw] f [any-function!] blk [block!] ] [result] [ result: make block! length? blk foreach elem blk [ insert/only tail :result f get/any 'elem ] result ] ...from the collection of functions Ladislav published on his web site: http://www.sweb.cz/LMecir/highfun.r MAP applies an argument function to all elements of a block and returns the block of results, as in
>> square: func [x] [x * x] >> map :square [1 2 3 4 5]
== [1 4 9 16 25]
>> map :positive? [1 -2 3 -4 5 -6]
== [true false true false true false]
>> map :random [2 2 6 6 52 52]
== [2 1 2 1 11 10] HTH! -jn- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com