For in list

Kinda expected this to work?

myList = “1,2,3,4,5” ;

for(item in myList){
writeOutput(item);
}


Paul Kukiel

it does since 4.5.1.016… https://luceeserver.atlassian.net/browse/LDEV-47

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/lucee/duJ65996rqQ/801B_gdkPGkJ

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/On 6/1/2015 9:28 PM, Paul Kukiel wrote:

Kinda expected this to work?

myList = “1,2,3,4,5” ;

for(item in myList){
writeOutput(item);
}


Paul Kukiel

You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAHX0TS7hf67-gtnU4BmddJvTnTA0LJyrysAvpz8z1AmAYsUEUg%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAHX0TS7hf67-gtnU4BmddJvTnTA0LJyrysAvpz8z1AmAYsUEUg%40mail.gmail.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

Not sure why?

Because it is practical and avoids converting the string to an array.

Thanks,
JeanOn Tue, Jun 2, 2015 at 9:11 AM, Mark Drew <@Mark_Drew> wrote:

p.s. Adam, I’ve just checked and this works:

mystring = "this is a string" mystring.each( function( char ){ echo( char ); } ); On 2 June 2015 at 17:22, Dominic Watson <@Dominic_Watson> wrote:

A native string.split( regex ) would be great too; avoiding the ‘list’
baggage and implementing more flexible splitting using regex rather than a
list of single character delimiters.

On 2 June 2015 at 17:16, Adam Cameron <@Adam_Cameron> wrote:

On Tuesday, 2 June 2015 15:09:47 UTC+1, Igal wrote:

@Mark

I personally agree with you, but the driving force behind fixing this
issue was ACF compatibility.

if anything, I would prefer

for (ch in someString) { /* ... to iterate over the characters of

the string … */ }

but then compatibility would completely break…

I’ve been mulling over a sensible syntactical tweak to disambiguate
between “by list element” and “by char”, but drew a blank.

However it’s perhaps better to join the current decade and take an OO &
FP approach to these things, by implementing String.each(), .reduce(),
.map(), .sort(), .filter(), etc

It makes for more clear code to use purpose-specific iteration methods,
rather than generic and procedural looping statements.


Adam


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/e4b5c137-ff0a-4dd4-8a12-490175bcf5f3%40googlegroups.com
https://groups.google.com/d/msgid/lucee/e4b5c137-ff0a-4dd4-8a12-490175bcf5f3%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn
http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB

It was good though, I decided to look up the initial change to lucee, which
encouraged me to take a closer look at the underlying code.

So all in all a good result.On Tue, Jun 2, 2015 at 7:51 PM, AJ Mercer <@AJ_Mercer> wrote:

Code review was a freebie :stuck_out_tongue:

On Tuesday, 2 June 2015, Paul Kukiel <@Paul_Kukiel> wrote:

Oh boy what have I done!

Lists have always been a part of cfml, can’t change that, I would think
that it you can cf loop list then for in would also just work.

Yes listToArray was used but it was one extra line if code to type in big
deal.

I simply asked if it should work not weather my code is shit.
On Jun 2, 2015 7:09 PM, “Adam Cameron” <@Adam_Cameron> wrote:

On Tuesday, 2 June 2015 09:54:20 UTC+1, Desmond Miles wrote:

If it is intended be a shorcut for converting string list to an array
then it must add a “delimiter” parameter.

Good point, the solution for this has not been implemented properly, as
the delimiter has been hard-coded (as a comma):

return ListUtil.listToArray(o.toString(), ‘,’).getIterator();

(that’s from the commit linked-to in
https://luceeserver.atlassian.net/browse/LDEV-47)

It shouldn’t be hard-coded at all, for a start; but it should be
parameterised in this case.

I’ve suggested the ticket should be reopened & the work finished.


Adam


You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/a781f472-9cc3-4a5c-9df7-e533755279bd%40googlegroups.com
https://groups.google.com/d/msgid/lucee/a781f472-9cc3-4a5c-9df7-e533755279bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAHX0TS5_RoA5t1yfG7Q7%2Bh-EvSw4x3zEKngtL%2BwLBa7YwmaaWQ%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAHX0TS5_RoA5t1yfG7Q7%2Bh-EvSw4x3zEKngtL%2BwLBa7YwmaaWQ%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

AJ Mercer
<webonix:net strength=“Industrial” /> http://webonix.net | <webonix:org
community=“Open” /> http://webonix.org
http://twitter.com/webonix


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAPURtC0dCbEAT17h1z%2BnfvKbRk_szJGxBHh4ocAiMxLyngi5%2BQ%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAPURtC0dCbEAT17h1z%2BnfvKbRk_szJGxBHh4ocAiMxLyngi5%2BQ%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Paul Kukiel

Not sure why?

Probably because of https://luceeserver.atlassian.net/browse/LDEV-47?On Tuesday, 2 June 2015 08:11:23 UTC+1, Mark Drew wrote:


Adam

I am with you on the looping over chars bit.

I now realise the context (I didn’t when I replied this morning) to this whole discussion.

I didn’t realise there was some compat ticket lurking about "for loops”.

Not sure how I could have from the original post without reading between the lines.
All I read was
"Kinda expected this to work?”

And I replied that I wouldn’t.

I guess I stand corrected.

Mark Drew

develop • deploy • deliver
http://charliemikedelta.com ttp://charliemikedelta.com> On 2 Jun 2015, at 15:09, Igal @ Lucee.org <@Igal> wrote:

@Mark

I personally agree with you, but the driving force behind fixing this issue was ACF compatibility.

if anything, I would prefer

for (ch in someString) { /* ... to iterate over the characters of the string ... */ }

but then compatibility would completely break…

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/

you mean something like:

var MaList = new List(“Tahi,Rua,Toru,Wha”);

for(s in MaList.each()){

}

and

var MaString = “Elvis is the bomb!”;

for(c in MaString.each()){

}

That is much clearer in a way
?

Mark Drew

develop • deploy • deliver
http://charliemikedelta.com ttp://charliemikedelta.com> On 2 Jun 2015, at 17:16, Adam Cameron <@Adam_Cameron> wrote:

On Tuesday, 2 June 2015 15:09:47 UTC+1, Igal wrote:
@Mark

I personally agree with you, but the driving force behind fixing this issue was ACF compatibility.

if anything, I would prefer

for (ch in someString) { /* ... to iterate over the characters of the string ... */ }

but then compatibility would completely break…

I’ve been mulling over a sensible syntactical tweak to disambiguate between “by list element” and “by char”, but drew a blank.

However it’s perhaps better to join the current decade and take an OO & FP approach to these things, by implementing String.each(), .reduce(), .map(), .sort(), .filter(), etc

It makes for more clear code to use purpose-specific iteration methods, rather than generic and procedural looping statements.


Adam


You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com mailto:lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/e4b5c137-ff0a-4dd4-8a12-490175bcf5f3%40googlegroups.com https://groups.google.com/d/msgid/lucee/e4b5c137-ff0a-4dd4-8a12-490175bcf5f3%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

Sorry. Hadn’t memorised all tickets. Still a stupid idea.

Mark Drew

  • Sent by typing with my thumbs.> On 2 Jun 2015, at 08:29, Adam Cameron <@Adam_Cameron> wrote:

On Tuesday, 2 June 2015 08:11:23 UTC+1, Mark Drew wrote:
Not sure why?

Probably because of https://luceeserver.atlassian.net/browse/LDEV-47?


Adam

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/c6ff073b-dd1d-4c1a-903d-7f567653be13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I have seen too much crap code using lists (Gert will back me up on this. Inside joke etc) that they make my skin crawl. Hence my questioning. Arrays are faster but I guess if under the covers it converts it to an array for you to loop through then fair enough. Go listy listy!

Mark Drew

  • Sent by typing with my thumbs.> On 2 Jun 2015, at 08:43, Paul Kukiel <@Paul_Kukiel> wrote:

Works in ACF and to be honest I did expect it to work in lucee

On Jun 2, 2015 5:11 PM, “Mark Drew” <@Mark_Drew> wrote:
Not sure why? Lists are not s primitive collection. Just a string.

Try

myList = listToArray(“1,2,3,4,5”) ;

for(item in myList){
writeOutput(item);
}

Mark Drew

  • Sent by typing with my thumbs.

On 2 Jun 2015, at 05:28, Paul Kukiel <@Paul_Kukiel> wrote:

Kinda expected this to work?

myList = “1,2,3,4,5” ;

for(item in myList){
writeOutput(item);
}


Paul Kukiel

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAHX0TS7hf67-gtnU4BmddJvTnTA0LJyrysAvpz8z1AmAYsUEUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/A8BD07DC-4364-4BC7-942F-86E8272CAF09%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAHX0TS56v%3D9XwyZKaM_iNtA8R-vL04RAMEu3X_OWvJX27zCtWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Oh boy what have I done!

Lists have always been a part of cfml, can’t change that, I would think
that it you can cf loop list then for in would also just work.

Yes listToArray was used but it was one extra line if code to type in big
deal.

I simply asked if it should work not weather my code is shit.On Jun 2, 2015 7:09 PM, “Adam Cameron” <@Adam_Cameron> wrote:

On Tuesday, 2 June 2015 09:54:20 UTC+1, Desmond Miles wrote:

If it is intended be a shorcut for converting string list to an array
then it must add a “delimiter” parameter.

Good point, the solution for this has not been implemented properly, as
the delimiter has been hard-coded (as a comma):

return ListUtil.listToArray(o.toString(), ‘,’).getIterator();

(that’s from the commit linked-to in
https://luceeserver.atlassian.net/browse/LDEV-47)

It shouldn’t be hard-coded at all, for a start; but it should be
parameterised in this case.

I’ve suggested the ticket should be reopened & the work finished.


Adam


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/a781f472-9cc3-4a5c-9df7-e533755279bd%40googlegroups.com
https://groups.google.com/d/msgid/lucee/a781f472-9cc3-4a5c-9df7-e533755279bd%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

I would not add “for in” string list support in .lucee dialect (my opinion).

I agree with some people that looping over a string is not efficient over
Arrays. I would use the available cf string utilities (just like java did
with their string tokenizer for e.g)

If it is intended be a shorcut for converting string list to an array then
it must add a “delimiter” parameter.
I’m not a Lucee code contributor but for example the current 4.5.1.016 (and
master branch) implementation only works with comma separated string list.On Tuesday, June 2, 2015 at 9:37:36 AM UTC+2, Adam Cameron wrote:

On Tuesday, 2 June 2015 08:31:39 UTC+1, jmoniatte wrote:

On Tue, Jun 2, 2015 at 9:11 AM, Mark Drew mark...@gmail.com wrote:

Not sure why?

Because it is practical and avoids converting the string to an array.

Indeed. Whilst CFML makes a claim that there is such a thing as a list
(which is string with element delimiters in it: we get that), then it
stands to reason that all the usual collection-iteration possibilities are
availed to it.

In for a penny, in for a pound. Even if they penny is misshapen and not
accepted as legal tender anywhere else.

That said: hands up who’d like to list support in .lucee entirely? [raises
hand. Raises other hand too].


Adam

Thanks for the ticket feedback :slight_smile:

Even if for-in with list is supported by ACF, their docs are not up-to-date
because it does not explicitly state so (as of writing this but maybe I
didn’t search enough).
I hope others won’t do the same forgetting as we need to know how to pass
the delimiter if so.
e.g for(item in list ; delimiter = “/”) or for(item in list ; “/”)
or or for(item in list ; “==” , multiChars=true) etc…On Tuesday, June 2, 2015 at 11:09:18 AM UTC+2, Adam Cameron wrote:

On Tuesday, 2 June 2015 09:54:20 UTC+1, Desmond Miles wrote:

If it is intended be a shorcut for converting string list to an array
then it must add a “delimiter” parameter.

Good point, the solution for this has not been implemented properly, as
the delimiter has been hard-coded (as a comma):

return ListUtil.listToArray(o.toString(), ‘,’).getIterator();

(that’s from the commit linked-to in
https://luceeserver.atlassian.net/browse/LDEV-47)

It shouldn’t be hard-coded at all, for a start; but it should be
parameterised in this case.

I’ve suggested the ticket should be reopened & the work finished.


Adam

Still a stupid idea.

If you say so.On Tue, Jun 2, 2015 at 9:46 AM, Mark Drew <@Mark_Drew> wrote:

A clearer way to do all of this IMO is:
for (item in list.split("")) { // loop over chars
}

for (item in list.split(",")) { // loop over list elements
}
Sure, it uses reflection, but we’re talking about lists. They are already
not great performance-wise.

for (element in list[; delimiter[; multi-char]]);

I would be against that for the same reason that you cannot specify the
“step” (eg, every other element) in a for…in array loop. Plus, this is
all because of ACF compatibility. I say this type of list loop is bad
design to begin with, but since Lucee strives for ACF compat, it should be
supported for the CFML dialect - but only to the level Adobe has supported
it. I surely hope the for…in list construct does not apply to the .Lucee
dialect…

I’ve created an ehancement request:
https://luceeserver.atlassian.net/browse/LDEV-379On 2 June 2015 at 11:37, Desmond Miles <@Desmond_Miles> wrote:

Thanks for the ticket feedback :slight_smile:

Even if for-in with list is supported by ACF, their docs are not
up-to-date because it does not explicitly state so (as of writing this but
maybe I didn’t search enough).
I hope others won’t do the same forgetting as we need to know how to pass
the delimiter if so.
e.g for(item in list ; delimiter = “/”) or for(item in list ; “/”)
or or for(item in list ; “==” , multiChars=true) etc…

On Tuesday, June 2, 2015 at 11:09:18 AM UTC+2, Adam Cameron wrote:

On Tuesday, 2 June 2015 09:54:20 UTC+1, Desmond Miles wrote:

If it is intended be a shorcut for converting string list to an array
then it must add a “delimiter” parameter.

Good point, the solution for this has not been implemented properly, as
the delimiter has been hard-coded (as a comma):

return ListUtil.listToArray(o.toString(), ‘,’).getIterator();

(that’s from the commit linked-to in
https://luceeserver.atlassian.net/browse/LDEV-47)

It shouldn’t be hard-coded at all, for a start; but it should be
parameterised in this case.

I’ve suggested the ticket should be reopened & the work finished.


Adam


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/a275a002-ddab-49fa-a153-258b85d39122%40googlegroups.com
https://groups.google.com/d/msgid/lucee/a275a002-ddab-49fa-a153-258b85d39122%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn
http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB

you mean something like:

var MaList = new List(“Tahi,Rua,Toru,Wha”);

for(s in MaList.each()){

}

Not quite. This:

MaList.listEach(function(x){

});

Which I think we have already.

and

var MaString = “Elvis is the bomb!”;

for(c in MaString.each()){

}

MaString.each(function(){

});

Although Dom says this has already been implemented for strings? I didnae
know that.On Tuesday, 2 June 2015 17:24:47 UTC+1, Mark Drew wrote:


Adam

I shall shut my mouth up until I can do all the relevant research on my mobile then.
Sorry for having stupid ideas.

Mark Drew

  • Sent by typing with my thumbs.> On 2 Jun 2015, at 08:50, Adam Cameron <@Adam_Cameron> wrote:

On Tuesday, 2 June 2015 08:46:47 UTC+1, Mark Drew wrote:
Sorry. Hadn’t memorised all tickets.

It’s always best to be informed before putting one’s oar in, I find. Still: I know I am an outlier in that regard.

Still a stupid idea.

No. Dogmatically going “it’s just a string”, and being in denial that CFML has a concept that is a string-based collection is what’s stupid.


Adam


You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/2897d86d-f4c5-473c-9348-82a1800a8a49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

It was just not very performant. I have seen code that had 100’s of ListGetAt all over the place in one template hence my negative attitude to use lists as a collection.

As I said before, I wouldn’t use it and if Lucee converts it to a nice array under the covers for you, then great. Go for it.

Mark Drew

  • Sent by typing with my thumbs.> On 2 Jun 2015, at 08:48, Jean Moniatte <@Jean_Moniatte> wrote:

On Tue, Jun 2, 2015 at 9:46 AM, Mark Drew <@Mark_Drew> wrote:
Still a stupid idea.

If you say so.

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAG-7QUsKnWbkNpX8OJgBYayo-J5b3N0R_OYR%3DDipFC3ZW9f-yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Turns out I was hasty with my .each() example. It works, but not as I had
expected. This is what you get:

mystring = "this is a string"; mystring.each( function( char ){ echo( char & char ); } );

Outputs: “this is a stringthis is a string”.

You can specify a delimiter after the closure however:

mystring = "this is a string"; mystring.each( function( char ){ echo( char & char ); }, "" );

Outputs: tthhiiss iiss aa ssttrriinngg

Perhaps there is a way to set delim there, but not sureOn 2 June 2015 at 17:24, Mark Drew <@Mark_Drew> wrote:

you mean something like:

var MaList = new List(“Tahi,Rua,Toru,Wha”);

for(s in MaList.each()){

}

and

var MaString = “Elvis is the bomb!”;

for(c in MaString.each()){

}

That is much clearer in a way
?

Mark Drew

develop • deploy • deliver
http://charliemikedelta.com

On 2 Jun 2015, at 17:16, Adam Cameron <@Adam_Cameron> wrote:

On Tuesday, 2 June 2015 15:09:47 UTC+1, Igal wrote:

@Mark

I personally agree with you, but the driving force behind fixing this
issue was ACF compatibility.

if anything, I would prefer

for (ch in someString) { /* ... to iterate over the characters of the

string … */ }

but then compatibility would completely break…

I’ve been mulling over a sensible syntactical tweak to disambiguate
between “by list element” and “by char”, but drew a blank.

However it’s perhaps better to join the current decade and take an OO & FP
approach to these things, by implementing String.each(), .reduce(), .map(),
.sort(), .filter(), etc

It makes for more clear code to use purpose-specific iteration methods,
rather than generic and procedural looping statements.


Adam


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/e4b5c137-ff0a-4dd4-8a12-490175bcf5f3%40googlegroups.com
https://groups.google.com/d/msgid/lucee/e4b5c137-ff0a-4dd4-8a12-490175bcf5f3%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/7418F5AA-99BA-4EFB-9D50-E269D7EE8B38%40gmail.com
https://groups.google.com/d/msgid/lucee/7418F5AA-99BA-4EFB-9D50-E269D7EE8B38%40gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn
http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB