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

[REBOL] Re: Using a Math oper. buried in a variable

From: mumpsoid:gmx at: 2-Apr-2009 14:52

On Thu, 2 Apr 2009, Henrik Mikael Kristensen wrote:
> On Thu, Apr 2, 2009 at 10:37 PM, <mumpsoid-gmx.com> wrote: > > > > On Thu, 2 Apr 2009, Wall, Scott wrote: > > > >> > >> Hi Duke, > >> > >> > As with most things in REBOL, there are a number of ways to do what > >> > you want. Here's another one: > >> > >> >>> num1: 6 > >> >== 6 > >> >>> num2: 5 > >> >== 5 > >> >>> op: :* > >> >>> op num1 num2 > >> >== 30 > >> >>> print [op num1 num2] > >> >30 > >> > >> Still another way is to leave > >> op: "*" > >> and use: > >> do reform [num1 op num2] > >> > >> Scott > >> > > JOY!!!!!!!! > > > >>> > >>> num1 > > == 5 > >>> num2 > > == 6 > >>> op > > == * > >>> do reform [num1 op num2] > > == 30 > >>> > > > > Is it OK for me to think that this is a PITA? > > Actually, it's only one form: Code is data and data is code, but the > method above creates a string, which is fast in REBOL2 due to the > string being in ASCII format, but slower in R3, because it's converted > to unicode and away from unicode. > > I believe the most correct and fastest method here is to assign the > function directly to 'op, so you don't have to put things inside a > block. It was mentioned earlier: > > >> op: :* > >> op num1 num2 > == 30 > >> about
REBOL/Core 2.7.6.2.5 17-Mar-2008 Copyright 2000-2008 REBOL Technologies. All rights reserved. REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
>> op: :* >> op num1 num2
== 30
>>
Cool! but I would have never fingered that out in a million years. :) -- Duke Normandin A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?