[REBOL] Re: problems creating a path
From: lmecir:mbox:vol:cz at: 1-Jun-2003 17:20
Hi Anton,
----- Original Message -----
From: "Anton" <[antonr--iinet--net--au]>
To: "rebol-list" <[rebol-list--rebol--com]>
Sent: Sunday, June 01, 2003 4:20 PM
Subject: [REBOL] problems creating a path
> I am trying to call a function with certain
> refinements present or not present, depending on
> user switches.
> This is one example that gives me what I want:
>
> files?: true
> join 'my-func/test either files? ['files][[]]
> ;== my-func/test/files
>
> files?: false
> join 'my-func/test either files? ['files][[]]
> ;== my-func/test
>
> That joins onto the lit-path! 'my-func/test successfully or
> leaves it alone.
>
> But this example is difficult to make work, because all the
> refinements of the path are optional, so the path starts as
> only a single word!:
>
> files?: true
> folders?: false
> to-path reduce ['my-func either files? ['files][[]] either folders?
> ['folders][[]]]
> ;== my-func/files/[]
>
> How to get rid of the brackets?
>
> I tried also:
>
> to-path reduce [to-lit-path 'my-func either files? ['files][[]] either
> folders? ['folders][[]]]
> ;** Script Error: Invalid argument: 'my-func
> ;** Where: to-path
> ;** Near: to path! :value
>
> join to-lit-path 'my-func [either files? ['files][[]] either folders?
> ['folders][[]]]
> ;== my-func/files/[]
>
> So using a block for the second argument is not going to work.
> (Anybody know a way?)
> Finally I went back to how it was working to start with:
>
> join join to-path 'my-func either files? ['files][[]] either folders?
> ['folders][[]]
> ;== my-func/files
>
> It seems less nice, but it works.
>
> Anton Dale Rolls.
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
>
see http://www.fm.vslib.cz/~ladislav/rebol/apply.r
or have a look at
http://www.fm.vslib.cz/~ladislav/rebol/tfunc.r
-L