my main interest was to discuss the following syntax:
[ a-func/opt/:bool 123 ]
where opt and its arguments are passed if 'bool is true.

As an inbuild enhancement request for refinements, 
without need for [do refined].
It looks similar to the usual path-notation for arrays
(array/:i), saying »parts of this path are calculatet«.
And i think it is readable (for few refinements).

IMHO a inbuild »lightweight« refinement-passing would be nice,
but a proper way is unknown.
could this be it?

My implementation is to play with the syntax and look if it is handy.
And to collect some comments from other programmers :)

Volker

>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<

Am 25.02.01, 11:23:52, schrieb "Ladislav Mecir" <[EMAIL PROTECTED]> zum 
Thema [REBOL] Re: (no subject):


> I once posted a different solution. It works as follows:

> >> do-path [:a if b [/opt] /opt2 if e [/opt3] /end-path 123 234 345 456 
567]
> P1 is an integer of value: 123
> P2 is an integer of value: 234
> O1 is a none of value: none
> O2 is an integer of value: 345
> == 567

> Moreover, my REFINED (you can find it at:
> http://www.sweb.cz/LMecir/highfun.r ) can be used:

> do refined :a compose [(either b ['opt] [[]]) opt2 (either e ['opt3] 
[[]])]
> 123 234 345 456 567
> P1 is an integer of value: 123
> P2 is an integer of value: 234
> O1 is a none of value: none
> O2 is an integer of value: 345
> == 567

> Regards
>     Ladislav

> ----- Original Message -----
> From: Volker Nitsch <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 24, 2001 8:27 AM
> Subject: [REBOL] (no subject)


> > [rebol [
> >         title:
> >
> >         "proposal for passing refinements"
> >
> >         comment: {
> >
> >   hi all,
> >   i suggest following syntax:
> >   [ a-func/opt/:bool 123 ]
> >   where opt and its arguments are passed if 'bool is true.
> >   a sample implementation is presented here, which may be used
> >   in the way
> >   [do refined[ a-func/opt/:bool 123 ]]
> >   note this handles passing arguments ..
> >   an inbuild syntax would be preferable..
> >
> >   also i suggest using
> >   [ a-func/'opt 123 ]
> >   if 'opt and 'bool are the same name.
> >   not implemented yet.
> >
> >   would be nice if you test a bit more, baby is 1:30 old yet :)
> >
> >  }
> >         author: "volker"
> >     ]
> >
> >     refined: func [block
> >         /local val in-args part-args length-part-args option
> >         append-part count-part-args func-args rfunc options
> >         out-path out-args in-path
> >     ] [
> >         in-path: to block! first block
> >         in-args: next block
> >         out-args: copy []
> >         out-path: reduce [first :in-path]
> >         options: next in-path
> >         rfunc: get first in-path
> >         func-args: first :rfunc
> >         ;handle normal arguments
> >         parse func-args [copy normal-args to refinement!]
> >         append out-args copy/part in-args length? normal-args
> >         in-args: skip in-args length? normal-args
> >         ;handle options
> >         count-part-args: func [func-args option /part-args] [
> >             option: to refinement! option
> >             parse func-args [thru option copy part-args [to
> > refinement! | to end]]
> >             either part-args [length? part-args] [0]
> >         ]
> >         append-part: does [
> >             append out-path option append out-args part-args
> >         ]
> >         parse next :in-path [any [
> >                 set option word!
> >                 (
> >                     length-part-args: count-part-args func-args option
> >                     part-args: copy/part in-args length-part-args
> >                     in-args: skip in-args length-part-args
> >                 )
> >                 [
> >                     set val get-word! (
> >                         if get val [append-part]
> >                     )
> >                     |
> >                     (
> >                         append-part
> >                     )
> >                 ]
> >             ]]
> >         append reduce [to path! out-path] out-args
> >     ]
> >
> >     do example: [
> >         a: func [p1 p2 /opt o1 /opt2 o2 /opt3] [? p1 ? p2 ? o1 ? o2]
> >         source a
> >         b: none
> >         e: true
> >         raw-call: [a/opt/:b/opt2/opt3/:e 123 234 345 456 567]
> >         ? b ? e ? raw-call
> >         refined-call: refined raw-call
> >         ? refined-call
> >         print "do it"
> >         do refined-call
> >     ]
> > ]
> >
> >
> >
> > --
> > To unsubscribe from this list, please send an email to
> > [EMAIL PROTECTED] with "unsubscribe" in the
> > subject, without the quotes.
> >
> >

> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.



-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to