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

quick help please!

 [1/5] from: rishioswal::yahoo::com at: 11-Jul-2001 13:19


hi. i'm at work and i'm stuck on a problem. here is the code: ;;;;;;;;;begin code rebol [] submenu: [ [%overview.html 0] [%topic1.html 1] [%subtopic1.html 0] ] i: 1 probe to-path rejoin ["submenu/" i "/1"] ;;;;; end code unfortunately, this results in the following being displayed: submenu/1/1 how would i make it display the actual data in the path: %overview.html ?? rishi

 [2/5] from: sterling:rebol at: 11-Jul-2001 13:37


Never try to make path! types from strings. They do not have the right context and will not work. The solution: print submenu/:i/1 == %overview.html Presto! Sterling

 [3/5] from: larry:ecotope at: 11-Jul-2001 13:46


Hi Rishi
>> submenu/:i/1
== %overview.html
>>
-Larry

 [4/5] from: jelinem1:nationwide at: 11-Jul-2001 16:13


I won't argue that there are problems with dynamically creating paths [from strings]. I've beat my head against the wall for some time over this and gave up. However, I found a "work-around": Instead of:
>> probe to-path rejoin ["submenu/" i "/1"]
Use:
>> probe do rejoin ["submenu/" i "/1"]
That is, leave the "path" as a string. To evaluate it, use 'do. Don't know exactly what context this uses, though I know it works when refering only to a global context (that is, 'submenu is defined globally). - Michael From: [sterling--rebol--com]@rebol.com on 07/11/2001 03:37 PM Please respond to [rebol-list--rebol--com] Sent by: [rebol-bounce--rebol--com] To: [rebol-list--rebol--com] cc: Subject: [REBOL] Re: quick help please! Never try to make path! types from strings. They do not have the right context and will not work. The solution: print submenu/:i/1 == %overview.html Presto! Sterling

 [5/5] from: rishioswal:y:ahoo at: 11-Jul-2001 14:20


neat. thanks.. rishi --- [sterling--rebol--com] wrote: