Tim,

Thanks so much!

If you won't mind could you throw more light on this:
 "Also, I recommend that you familiarize yourself with
       the rebol function interface dialect."


I would like to see examples.


Regards,
Emeka

On Thu, Sep 9, 2010 at 8:28 PM, Tim Johnson <[email protected]> wrote:

>
> * Emeka <[email protected]> [100909 09:59]:
> > Hello All,
> >
> > I have the below solution, but I want something better.
> >
> >
> >  Ismember?: func[my-list start-n  n t-element][
> >    first-element: first at my-list start-n
> >    if t-element = first-element [return true]
> >     if  start-n = n [return false]
> >    Ismember? my-list ADD start-n 1 n t-element
> >     ]
>  The last line:
> >    Ismember? my-list ADD start-n 1 n t-element
>
>  would be better coded:
>     Ismember? my-list (ADD start-n 1) n t-element
>         for readability, precedence and disclosure of intent.
>
>        Also, I recommend that you familiarize yourself with
>        the rebol function interface dialect.
>
>        IOWS, you can control the data sent to the function
>        by specifying the datatypes of the arguments
>
>    Example:
>    Ismember?: func[my-list[block!] start-n[integer!]  n[integer!]
> t-element[any-type!]][
>                ;; .... code here
>                ]
>   This approach has at least two advantages:
>   1)Clarifies the intent of the function
>   2)Generates error messages at the function call rather than
>   somewhere down the road where some side effect kicks in as
>   a result of an unintended argument type.
>
>   I hope this helps. If I have confused the issue more, :) I can
>   elaborate.
>   tim
>
> > On Thu, Sep 9, 2010 at 6:38 PM, Emeka <[email protected]> wrote:
> >
> > >
> > > Hello All,
> > >
> > > Which word would I use for something like this? I have a block [ A B C
> D] ,
> > > I would like to do
> > > Ismember? [A B C D] D comes true because D is in the block already ,
>  but
> > > Ismember?{A B C D] F comes false.
> > >
> > >
> > > Regards,
> > > Emeka
> > >
> > > --
> > > *Satajanus  Nig. Ltd
> > >
> > >
> > > *
> > >
> >
> >
> >
> > --
> > *Satajanus  Nig. Ltd
> >
> >
> > *
> >
> >
> > --
> > To unsubscribe from the list, just send an email to
> > lists at rebol.com with unsubscribe as the subject.
> >
>
> --
> Tim
> tim at johnsons-web.com or akwebsoft.com
> http://www.akwebsoft.com
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
>


-- 
*Satajanus  Nig. Ltd


*


-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to