holding lit-word! values in a word...
[1/4] from: moliad:aei:ca at: 16-Oct-2003 0:14
helo,
an advanced question:
is it possible to store a lit-word value inside a word?
so far this seems impossible (including in view 1.2.10)
>> a: to-lit-word 'r
== 'r
>> probe a
== r
>> type? a
== word!
so far I'm only able to store lit-word values within a BLOCK... ex:
>> a: append [] to-lit-word 'r
== ['r]
it seems to work with set-word types (in view v1.2.10 and probaly in core
2.5.6)...
>> a: to-set-word 'r
== r:
>> probe a
== r:
>> type? a
== set-word!
be carefull, older version of rebol will give you an error with the above
set-word! examples... that is because the newer versions evaluate word values
less aggressively. The older core complains that "r needs a value" whenever you
reference the word a .
any ideas are welcome
-MAx
[2/4] from: rebol:techscribe at: 15-Oct-2003 21:44
Hi Maxim.
>> a: to-lit-word 'r
== 'r
>> type? :a
== lit-word!
>> type? get 'a
== lit-word!
Using the colon prefis or the get function you get the correct result.
Notice the difference:
>> type? a
== word!
Or:
>> a: 'r
== r
>> type? :a
== word!
Hope this helps.
Elan
Maxim Olivier-Adlhoch wrote:
[3/4] from: maximo:meteorstudios at: 16-Oct-2003 9:15
WOW!
my brain just clicked .
now all of a sudden all those lines of code using get-word notation when it seems its
not specifically essential... make sense!
I've use get-word notation before, but often I see parser code or advanced vid stuff
and you get stuff like:
if :var [set :var new new/var: to-word :var var: none] (taken from layout function)
and I'd say, why all those get-words... now it seems its time to look at those lines
again...
:-)
rebol, the never-ending (learning) story.
-MAx
---
You can either be part of the problem or part of the solution, but in the end, being
part of the problem is much more fun.
[4/4] from: andrew::martin::colenso::school::nz at: 24-Dec-2003 22:41
> WOW!
>
> my brain just clicked .
>
> now all of a sudden all those lines of code using get-word
> notation when it seems its not specifically essential... make sense!
Rebol: the Zen learning experience...
Andrew J Martin
Attendance Officer
& Grail Jedi.
Colenso High School
Arnold Street, Napier.
Tel: 64-6-8310180 ext 826
Fax: 64-6-8336759
http://colenso.net/scripts/Wiki.r?AJM
http://www.colenso.school.nz/
DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally
liable) for materials distributed to or acquired from user e-mail accounts. You can report
any
misuse of an e-mail account to our ICT Manager and the complaint will be investigated.
(Misuse can come in many forms, but can be viewed as any material sent/received that
indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate
language and/or other issues described in our Acceptable Use Policy.)
All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0
Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]