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

[REBOL] Re: REP Path! as Block!

From: ryanc::iesco-dms::com at: 10-May-2001 10:06

How about support for paren! when creating a path to do as you mention?
>> a: [ aa [ aaa 1 bbb 2 ] bb [ aaa 22 ] ]
== [aa [aaa 1 bbb 2] bb [aaa 22]]
>> x: 'aa
== aa
>> a/(x)
** Syntax Error: Invalid path -- a/ ** Near: (line 1) a/(x)
>> p: to path! [a (x)]
== a/(x)
>> p
** Script Error: Invalid path value: x ** Where: halt-view ** Near: p
>>
This works, but its not as much fun...
>> p: to path! [a :x]
== a/:x
>> p
== [aaa 1 bbb 2] You can always get jiggy with it...
>> f: func [] [random 2] >> funky-path: func [blk] [to-path reduce blk] >> fp: funky-path ['a x f]
== a/bb/1
>> fp
== aaa
>>
Side note: When I set 'fp, it returned the path, and not the value of it. Makes it tricky to work with. It would be nice, as long as there is not much of a speed penalty, as I dont see it as too important. --Ryan Andrew Martin wrote:
> A path! datatype could act in much the same way as a block, except that the > "contents" are executed immediately (instead of at a later date or not at > all). > > A block! datatype is this: > "[" optional Rebol-Values separated with spaces "]" > For example: > [Test: func [Arg] [print join Arg "on end"] Test "Text"] > > I believe that a path! datatype/value could be like this: > optional ":" Rebol-Value "/" Rebol-Value "/" and so on; followed by > optional ":" > and be evaluated immediately. > For example: > Test:/func/[Arg]/[print join Arg "on end"]/Test/"Text" > The above is a fairly meaningless example, but provides a interesting > possibility for the path! data-type. > > Andrew Martin > ICQ: 26227169 http://members.nbci.com/AndrewMartin/ > -><- > > -- > To unsubscribe from this list, please send an email to > [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400 I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world. -Einstein