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

[REBOL] The map function

From: sharriff::aina::med-iq::de at: 8-Nov-2000 8:12

Hi Andrew! USAGE: MAP Arg1 Arg2 /Only DESCRIPTION: Maps a function to all elements of a block. MAP is a function value. ARGUMENTS: Arg1 -- (Type: any-function block) Arg2 -- (Type: any-function block) REFINEMENTS: /Only -- Inserts the result of the function as a series. (SPECIAL ATTRIBUTES) throw catch
>> adder: func [ a b ] [ a + b ] >> testblock: [ "element1" "element2" ]
== ["element1" "element2"]
>> map testblock adder
** Script Error: adder is missing its a argument. ** Where: map testblock adder
>> printer: does [print "ho"] >> printer
ho
>> map [testblock] printer
ho ** Script Error: map expected Arg2 argument of type: any-function block. ** Where: map [testblock] printer
>> map [testblock] [printer]
** Script Error: Cannot use "Map block!" on "block!" value. ** Where: map [testblock] [printer]
>> map testblock [printer]
** Script Error: Cannot use "Map block!" on "block!" value. ** Where: map testblock [printer]
>>
According to the MAP help, it takes the types any-function block or block? what am I doing wrong? Sharriff Aina med.iq information & quality in healthcare AG www.med-iq.de