Path into a block
[1/3] from: swhite:ci:bloomington:mn:us at: 13-Jul-2006 15:14
I could swear I have done this, or read it, but I must be making a dumb mistake. I just
want to refer to an item in a block of blocks, by an index that is not a literal (1,2,
etc) but an integer word that contains the 1, 2, etc. The following demo script returns
the following error:
(In summary, I can reference
<DATA-NAME>/5
...but not
<DATA-NAME>/<index-name> where <index-name> has a value of 5)
Thank you.
*------ output of demo script *------------------
print type? HTMLCAL-SLOTS/5
block
print HTMLCAL-SLOTS/5
print type? HTMLCAL-INDEX
integer
print HTMLCAL-INDEX
5
print HTMLCAL-SLOTS/HTMLCAL-INDEX
** Script Error: Invalid path value: HTMLCAL-INDEX
** Where: halt-view
** Near: print HTMLCAL-SLOTS/HTMLCAL-INDEX
>>
*------ end of output of demo script *----------
*----------- demo script *------------
REBOL []
HTMLCAL-SLOTS: [
[" " " "]
[" " " "]
[" " " "]
[" " " "]
[" " " "]
[" " " "]
[" " " "]
]
HTMLCAL-INDEX: 5
print "print type? HTMLCAL-SLOTS/5"
print type? HTMLCAL-SLOTS/5
print "print HTMLCAL-SLOTS/5"
print HTMLCAL-SLOTS/5
print "print type? HTMLCAL-INDEX"
print type? HTMLCAL-INDEX
print "print HTMLCAL-INDEX"
print HTMLCAL-INDEX
print "print HTMLCAL-SLOTS/HTMLCAL-INDEX"
print HTMLCAL-SLOTS/HTMLCAL-INDEX
*-------- end of demo script---------
Steven White
City of Bloomington
1800 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
steven.white-ci.bloomington.mn.us
[2/3] from: greggirwin::mindspring::com at: 13-Jul-2006 14:39
Hi Steven,
SW> I could swear I have done this, or read it, but I must be making a dumb SW> mistake.
I just want to refer to an item in a block of blocks, by an SW> index that is not a
literal (1,2, etc) but an integer word that contains SW> the 1, 2, etc. The following
demo script returns the following error:
Use the get-word! syntax:
HTMLCAL-SLOTS/:HTMLCAL-INDEX
-- Gregg
[3/3] from: tim-johnsons::web::com at: 14-Jul-2006 9:17
* Steven White <swhite-ci.bloomington.mn.us> [060713 12:25]:
Hi Steven:
> *----------- demo script *------------
> REBOL []
<<quoted lines omitted: 19>>
> print HTMLCAL-SLOTS/HTMLCAL-INDEX
> *-------- end of demo script---------
;; try this
HTMLCAL-SLOTS/:HTMLCAL-INDEX
;; now try this
>> test: [a 1 b 2 c 3]
== [a 1 b 2 c 3]
>> test/a
== 1
>> d: 'b
== b
>> test/:d
== 2
>>
:-) The fun has just begun!
tj
--
Tim Johnson <tim-johnsons-web.com>
http://www.alaska-internet-solutions.com
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted