forall would drop a line. the "res: copy[]" not, we have no collecting
loops inbuild.

insert-separator: func [ condSerie separator ] [
       rez: copy []
       forall condSeries [
       repend rez [ first condSerie ]
       if not tail? next condSerie [ repend rez separator ]
       ; dropp this:   tail? condSerie: next condSerie
       ]
       return rez
]

another trick is to add the seperator allways, and drop it later:

insert-separator: func [ condSerie separator ] [
       rez: copy []
       forall condSeries [
       repend rez [ seperator first condSerie ] ;sep. first!
       ; drop this:  if not tail? next condSerie [ repend rez separator ]
       ; drop this:   tail? condSerie: next condSerie
       ]
       return remove rez ;drop first seperator
]

or append [condSeries seperator] in that order, and
  return head (clear back tail rez) ;parens for clarity
slightly faster, more ugly

On 4/25/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi, Rebolers!
>=20
> I wrote a function, that allows me to construct where parts of
> sql, coma separated lists etc:
>=20
> Ssee attached file.
>=20
> Is it possible to do it in some shorter and more effective way?
>=20
> brgds
> Janeks
>=20
> I am trying second time because of some conversions of []
> characters.
> Sorry if it will be the same!
>=20
> -- Attached file included as plaintext by Ecartis --
> -- Desc: Text from file 'insep.r'
>=20
> insert-separator: func [ condSerie separator ] [
>         rez: copy []
>         until [
>         repend rez [ first condSerie ]
>         if not tail? next condSerie [ repend rez separator ]
>         tail? condSerie: next condSerie
>         ]
>         return rez
> ]
>=20
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>=20
>=20


--=20
-Volker

"Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem." David
Wheeler
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to