Re: deepening listed subscripting

new topic     » goto parent     » topic index » view thread      » older message » newer message

Antonio Alessi wrote:
> 
> Antonio Alessi wrote:
> > 
> > ags wrote:
> > > 
> > > Antonio Alessi wrote:
> > > > An expression like:
> > > > }}}
<eucode>
> > > > newString­ =
> > > > originalString[1..2]&"INSERT"&originalString[5..9]&originalString[27..$]
> > > > </eucode>
{{{

> > > > could simply become:
> > > > }}}
<eucode>
> > > > newString­ = originalString[1..2]&"INSERT"&[5..9]&[27..$]
> > > > </eucode>
{{{

> > > > It should be plain to implement, I mean more useful than complicated...
> > > 
> > > I don't think that would work very well.  What if you wanted to use
> > > multiple
> > > strings like:
> > > 
> > > }}}
<eucode>
> > > newString = originalString[1..2] & "INSERT" & otherString[3..5] & [5..9]
> > > </eucode>
{{{

> > > What would the "[5..9]" refer to?
> > 
> > Hi Gary,
> > 
> > The last declared sequence, of course. I don't see where the problem arises.
> > If I had put to you the same question, which could have been you answer?
> > 
> > antonio
> 
> 
> Hi again Gary,
> 
> your comment made me deepen a bit this expression, 
> to make it "work very well".
> 
> If we want the same rule to apply to every sequence into the same line, 
> this seems so not difficult: enough to delimit each with ( ), like this:
> }}}
<eucode>
> newString = originalString[1..2] &"INSERT" &(otherString[3..5] &[7..8])
> &[5..9]
> </eucode>
{{{

> In such case, the "[5..9]" could clearly refer to the originalString, and so
> on.
> _________
> 
> To this purpose we could even refine as the best syntax setting:
> }}}
<eucode>
> newString = originalString[1..2] &"INSERT" &otherString[3..5][7..8] &[5..9]
> </eucode>
{{{

> where the "&" operator becomes the variables level delimiter, 
> so that we could have:
> }}}
<eucode>
> a = "abcdefrghjk"
> A = "ABCDEFGHJK"
> n = "123456789"
> 
> newString = a[1..2] & n[5..6] & "-INSERT-" & b[3..5][7..8] & [5..9] & [3..4]
> --          a:ab      n:56                   b:CDE + GH     n:56789  a:cd
> </eucode>
{{{

> to get:
> }}}
<eucode>
> newString = "ab56-INSERT-CDEGH56789cd"
> </eucode>
{{{

> no?
>  
> antonio

That just looks so complecated, it's unreal!! I see where it's all coming from
 but the logic is rediculous!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu