fine tuning question of Rebol
[1/4] from: sags::apollo::lv at: 25-Apr-2005 17:22
Hi, Rebolers! I wrote a function, that allows me to construct where parts of
sql, coma separated lists etc: insert-separator: func [ condSerie separator
][       rez: copy []
    #160 until [
     repend rez [ first condSerie ]
     if not tail? next condSerie [ repend rez
separator ]      tail? condSerie: next condSerie
 #160 ]      return rez ] Is it
possible to do it in some shorter and more effective way? brgds Janeks
[2/4] from: sags:apollo:lv at: 25-Apr-2005 17:34
Hi, Rebolers!
I wrote a function, that allows me to construct where parts of
sql, coma separated lists etc:
Ssee attached file.
Is it possible to do it in some shorter and more effective way?
brgds
Janeks
I am trying second time because of some conversions of []
characters.
Sorry if it will be the same!
-- Attached file included as plaintext by Ecartis --
-- Desc: Text from file 'insep.r'
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
]
[3/4] from: SQLAB:gmx at: 25-Apr-2005 16:43
Hi Janek
There should be a nice rejoin/with from Andrew Martin somewhere.
AR
[sags--apollo--lv] wrote:
[4/4] from: volker:nitsch:g:mail at: 25-Apr-2005 16:49
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, [sags--apollo--lv] <[sags--apollo--lv]> wrote:
> Hi, Rebolers!
> I wrote a function, that allows me to construct where parts of
<<quoted lines omitted: 20>>
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
--
-Volker
Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem.
David
Wheeler
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted