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

FAQ: How to return a block with evaluated value ?

 [1/10] from: pat665::ifrance::com at: 10-Dec-2001 22:04


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).

 [2/10] from: greggirwin:mindspring at: 12-Dec-2001 12:02


Hi Patrick, << How to return a block with evaluated value ? Short answer: Using compose. >> 'reduce also works for your example: b: func [n][return reduce [n n]] Jeff Kreis has written a really great article about 'compose for the REBOL Forces eZine. Check it out for all the details. It's behavior is different than 'reduce, and the use of the /deep refinement with 'compose can be very handy too. There's often more than one solution in REBOL, and there is rarely a single best solution. :) --Gregg

 [3/10] 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).

 [4/10] from: nitsch-lists:netcologne at: 13-Dec-2001 12:07


RE: [REBOL] FAQ: How to return a block with evaluated value ? Hi Pat this style remembers me to this "tip of the day" - stuff. how about having something like that, a window showing a random hint of some basic stuff? we could even make it a "riddle of the day", hiding the anwer first, and giving the user kind of console to eperiment? hmm, even a cgi comes to mind where peoples can post their riddles and download the actual collection. just thinking.. -Volker [pat665--ifrance--com] wrote:
> Hi, all > Is it OK if I post some short Q&A about Rebol to the list for validation ?
<<quoted lines omitted: 12>>
> == [3 3] > Compose forces the evaluation of the parens (n).
-Volker

 [5/10] from: rebol665:ifrance at: 13-Dec-2001 13:06


Hi volker That's a cool idea. I had something similar in mind. However rebol is consuming a good part of my available time. This part cannot grow at this time of the year. So I think we'll have to wait 'til 2002. Note : I'm so addicted to rebol ! is it the same for everybody ? It's amazing how much I enjoy trying some stuff on the console just for the fun of it. Addicted I said ! Patrick

 [6/10] from: nitsch-lists:netcologne at: 13-Dec-2001 15:57


RE: [REBOL] Re: FAQ: How to return a block with evaluated value ? Hi Patrick [rebol665--ifrance--com] wrote:
> Hi volker > That's a cool idea. I had something similar in mind. However rebol is
<<quoted lines omitted: 3>>
> amazing how much I enjoy trying some stuff on the console just for the fun > of it. Addicted I said !
---addicted to rebol? if i read this list and its postings on http://www.osnews.com/story.php?news_id=199 , i think yes :) ---trying stuff? Hey! may i suggest you copy your discoveries in a safe place to have it as a base for the riddles? later, more experienced, its sooo hard to remember the good newbie-questions ;-) having a large file of "somehow this was interesting" - snippets could come in handy then :)
> Patrick >
-Volker

 [7/10] from: jasonic:cunliffe:verizon at: 13-Dec-2001 12:14


> Note : I'm so addicted to rebol ! is it the same for everybody ? It's > amazing how much I enjoy trying some stuff on the console just for the fun > of it. Addicted I said !
Yes: should come with warning label :-) ./Jason

 [8/10] from: rotenca:telvia:it at: 13-Dec-2001 18:20


Hi, Patrick
> Note : I'm so addicted to rebol ! is it the same for everybody ? It's > amazing how much I enjoy trying some stuff on the console just for the fun > of it. Addicted I said !
You are not the only one. I must have a Carl Sassenrath dependency. The last time I felt so addicted was when i read the Exec disassembled. But i have a my personal cure to leave the keyboard and the monitor: try to read a Perl source. --- Ciao Romano

 [9/10] from: greggirwin:mindspring at: 13-Dec-2001 11:53


Hi Pat! << I'm so addicted to rebol ! is it the same for everybody ? >> My name is Gregg, and I'm a...REBOL programmer. I thought I had things under control, and then I wrote this little piece of code that should have been really hard to write and debug...and it just worked.<sniff> I've been at it ever since. I can't even fire up another development tool without thinking about using REBOL. It's always there, in the back of my mind. I even try to get other people started on it. I don't think that makes me a bad person. I mean, it expands your mind in the most wonderful way, right? Besides, I could stop any time I want. I just don't want to. :) --Gregg

 [10/10] from: lmecir:mbox:vol:cz at: 14-Dec-2001 9:55


Hi Gregg, <<Gregg>> (...) Besides, I could stop any time I want. I just don't want to. (...) <</Gregg>> heard this a lot of times (about different things), but the truth was questionable sometimes... ;-) Cheers Ladislav

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted