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

[REBOL] Re: FAQ: How to return a block with evaluated value ?

From: lmecir:mbox:vol:cz at: 13-Dec-2001 11:55

Hi Patrick, in the specified case the solution using REDUCE is a little bit shorter: b3: func [n][return reduce [n n]] Cheers Ladislav ----- Original Message ----- From: "Patrick Philipot" <[pat665--ifrance--com]> To: <[rebol-list--rebol--com]> Sent: Monday, December 10, 2001 10:04 PM Subject: [REBOL] FAQ: How to return a block with evaluated value ? Hi, all Is it OK if I post some short Q&A about Rebol to the list for validation ? Here is an example. I have one more to come. I will continue depending on the feed back I will get. How to return a block with evaluated value ? Short answer: Using compose. Problem illustration :
>> b: func [n][return [n n]] >> b 3
== [n n] The result of b 3 is [n n] where one obviously expects [3 3]. Problem resolution :
>> new-b: func [n][return compose [(n) (n)]] >> new-b 3
== [3 3] Compose forces the evaluation of the parens (n).