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

[REBOL] Re: Please help me out

From: carl:cybercraft at: 24-Aug-2010 11:48

On Monday, 23-August-2010 at 22:23:53 Emeka wrote,
>Why REDUCEd? I am a bit confused now.
REDUCE is useful for returning a block that contains the contents of a blocks after its been evaluated. ie. from the console...
>> cat: "feline"
== "feline"
>> dog: "canine"
== "canine"
>> blk: [cat dog 1 + 1]
== [cat dog 1 + 1]
>> reduce blk
== ["feline" "canine" 2] Note that words, (ie 'cat and 'dog in blk), are just datatypes too. So while REDUCE might be one of REBOL's default functions, when in a block it's just a word to be used as you with. ie...
>>> b: [reduce blk 10]
== [reduce blk 10]
>> foreach value b [print [value "type:" type? value]]
reduce type: word blk type: word 10 type: integer Hope that doesn't add to the confusion! -- Carl Read.