Path evaluation
[1/7] from: krobillard:san:rr at: 1-May-2003 20:49
Hi all,
Is there a simple, general purpose path evaluator in REBOL?
As an example, how would you go about getting the value 22 from p in the
following code:
obj: context [ var: 22 ]
p: 'obj/var
After much fiddling I came up with this:
a: get first p
x: get in a second p
Of course, this assumes that the path begins with an object and has a length
of 2. Is there some method other than deconstructing the path manually? It
seems something simple like 'do p' should work.
-Karl Robillard
[2/7] from: jvargas:whywire at: 2-May-2003 0:47
You could just ge the value directly, instead of construction the path.
print get in obj var
Hope this helps. Cheers, Jaime
On Thursday, May 1, 2003, at 11:49 PM, Karl Robillard wrote:
[3/7] from: lmecir:mbox:vol:cz at: 2-May-2003 8:54
Hi Karl,
you wrote:
obj: context [ var: 22 ]
p: 'obj/var
> It seems something simple like 'do p' should work.
If you want to use the "basic" 2.5.5 method, you can do as follows:
do reduce [:p] ; == 22
this version will work even in old interpreter versions, because it uses the get-word
version of 'p.
HTH
-Ladislav
[4/7] from: smith:munsterman at: 2-May-2003 9:25
Hi Folks,
Why not make it easier and clearer?
>> obj: context [ var: 22 ]
>> print obj/var
22
Or if you need p later:
>> obj: context [ var: 22 ]
>> p: 'obj/var
>> print obj/var
22
Or am I missing something?
-Jeff
On Fri, 2 May 2003 08:54:48 +0200, Ladislav Mecir <[lmecir--mbox--vol--cz]>
wrote:
> Hi Karl,
> you wrote:
<<quoted lines omitted: 11>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
-Jeff Smith
770-565-5462
[5/7] from: greggirwin:mindspring at: 2-May-2003 8:33
Hi Jeff,
JS> Why not make it easier and clearer?
I'm guessing he has a reason for wanting to use the indirection. I
know I've used it a numer of places myself.
-- Gregg
[6/7] from: krobillard:san:rr at: 2-May-2003 21:20
Thank you Ladislav! That's what I was looking for.
For those of you wondering why I didn't access obj/var directly, let me
apologize for not making it clear that my code does indeed have indirect
access to the path. I distilled the problem down to its essence so people on
the list wouldn't have to spend 10 minutes studying my program.
My code was written using view 1.2 but it broke on the latest core due to the
less aggressive path evaluation. It took me a while to figure out what was
going on because I was using two different methods to run my script and
sometimes it would generate good data and sometimes it wouldn't! It turned
out that my bash shell was running a different version of Rebol than the
makefile I was also using.
-Karl
On Thursday 01 May 2003 11:54 pm, you wrote:
[7/7] from: smith:munsterman at: 3-May-2003 22:11
Hi Karl,
See I was right, I was missing something! :=} I hope you got what you
needed from the folks on the list...
-Jeff
On Fri, 2 May 2003 21:20:22 -0700, Karl Robillard <[krobillard--san--rr--com]>
wrote:
> Thank you Ladislav! That's what I was looking for.
> For those of you wondering why I didn't access obj/var directly, let me
<<quoted lines omitted: 27>>
>> HTH
>> -Ladislav
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted