Re: Repeat syntax addition

2015-04-07 Thread Ben Rubinstein
(Going back to HyperCard?) the concepts used to be containers and sources of 
value - where the latter can be a literal, a function call, an expression...


I always thought that containers were a subset of sources of value, defined as 
the items where you could set the value as well as get it; but looking at the 
current LiveCode user guide I see that these are used as exclusive sets, where 
the key distinction is not whether the item can be both evaluated and changed, 
but whether it can be changed using put.  So a field is a container, just as 
a variable is; but a property is a source of value because you need to use 
the set syntax to change it, so it's grouped with a constant literal or an 
expression, which is read-only.  This seems wrong to me, and I don't know 
whether it marks a subtle change.


At any rate, the desirable change in the dictionary would be to replace 
container with container or source of value - better not to introduce a 
new term altogether!


Ben

On 06/04/2015 04:21, Mike Bonner wrote:

Use of the word Container is a bit deceptive.  Perhaps datasource would
be better.  Is it still possible to add notes to the dictionary?

On Sun, Apr 5, 2015 at 5:11 PM, Peter Haworth p...@lcsql.com wrote:


I'd guess the last of the options.

The more I think about this, the more I think there should be mention of
this in the dictionary entry for repeat.

It's a little like the ability to use a function to create a sortkey in the
sort command.  Nothing in the dictionary about that except for a user note.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 3:40 PM, Mike Bonner bonnm...@gmail.com wrote:


Yeah, kinda makes sense that it would work that way. Grab the data from

the

container once, do magic things behind the scenes to get it ready to go,
then loop through the lines.  I guess it could work either way though,
where it uses byte offsets to get the next chunk, which would have made

the

function method really suck for large data sets.

Now I'm curious.. what exactly does repeat for each do?  Split on cr,

sort

the keys and increment each loop to pop out the right line from the

array?

Store all the data in a temp variable and read each line (item, char) by
start/end position?

On Sun, Apr 5, 2015 at 4:19 PM, Jerry Jensen j...@jhj.com wrote:


Hi Mike,


On Apr 5, 2015, at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:

While not exactly whats been requested, this works pretty well:

repeat for each line tLine in (myFilter(sData,abc*,with))

I like the way a where clause reads as in the OP, but being able to

use

an

inline function for data generation is rather powerful, and if all

you

need

is a filter, setting up a function to do so is pretty straight

forward.


Good trick! I didn't know you could do that either.

I wondered if the function was called just once, or on every repeat.

Your

exapmle wouldn't tell, because the function would return the same stuff
every time.

So I tested it. The answer is that the function is called only once.

Good!


global gCount

on mouseUp
global gCount
put 0 into gCount
repeat for each line L in mylines()
   put L  cr after msg
end repeat
put gCount after msg -- how many times mulines() was called
end mouseUp

function mylines
global gCount
add 1 to gCount
return 1  cr  2  cr  3  cr
end mylines





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-07 Thread Peter Haworth
I'm really liking this feature.  I just used it in a series of nested
repeat statements that traverse their way through an array with 5 levels of
keys by writing a function for each level of key.  Makes the code so much
more readable.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 8:21 PM, Mike Bonner bonnm...@gmail.com wrote:

 Use of the word Container is a bit deceptive.  Perhaps datasource would
 be better.  Is it still possible to add notes to the dictionary?

 On Sun, Apr 5, 2015 at 5:11 PM, Peter Haworth p...@lcsql.com wrote:

  I'd guess the last of the options.
 
  The more I think about this, the more I think there should be mention of
  this in the dictionary entry for repeat.
 
  It's a little like the ability to use a function to create a sortkey in
 the
  sort command.  Nothing in the dictionary about that except for a user
 note.
 
  Pete
  lcSQL Software http://www.lcsql.com
  Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
  SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
 
  On Sun, Apr 5, 2015 at 3:40 PM, Mike Bonner bonnm...@gmail.com wrote:
 
   Yeah, kinda makes sense that it would work that way. Grab the data from
  the
   container once, do magic things behind the scenes to get it ready to
 go,
   then loop through the lines.  I guess it could work either way though,
   where it uses byte offsets to get the next chunk, which would have made
  the
   function method really suck for large data sets.
  
   Now I'm curious.. what exactly does repeat for each do?  Split on cr,
  sort
   the keys and increment each loop to pop out the right line from the
  array?
   Store all the data in a temp variable and read each line (item, char)
 by
   start/end position?
  
   On Sun, Apr 5, 2015 at 4:19 PM, Jerry Jensen j...@jhj.com wrote:
  
Hi Mike,
   
 On Apr 5, 2015, at 12:31 PM, Mike Bonner bonnm...@gmail.com
 wrote:

 While not exactly whats been requested, this works pretty well:

repeat for each line tLine in (myFilter(sData,abc*,with))

 I like the way a where clause reads as in the OP, but being able to
  use
an
 inline function for data generation is rather powerful, and if all
  you
need
 is a filter, setting up a function to do so is pretty straight
  forward.
   
Good trick! I didn't know you could do that either.
   
I wondered if the function was called just once, or on every repeat.
  Your
exapmle wouldn't tell, because the function would return the same
 stuff
every time.
   
So I tested it. The answer is that the function is called only once.
   Good!
   
global gCount
   
on mouseUp
   global gCount
   put 0 into gCount
   repeat for each line L in mylines()
  put L  cr after msg
   end repeat
   put gCount after msg -- how many times mulines() was called
end mouseUp
   
function mylines
   global gCount
   add 1 to gCount
   return 1  cr  2  cr  3  cr
end mylines
   
   
   
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
   
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
  
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-06 Thread Sri
Peter Haworth wrote
 Wouldn't it be nice if you could:
 
 repeat for each line rLine in tLines where rLine begins with xyz
 .
 end repeat

It would be even nicer if we could have the more general form

repeat for each line rLine in tLines [/condition/] [/transformation/]
...
end repeat

where
[condition] is an optional condition that returns a boolean, and
[transformation] operates on the line to transform it.

Thus, it could be useful as a filter, universal transformer, or conditional
transformer.

Regards,
Sri.



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Repeat-syntax-addition-tp4690850p4690880.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-06 Thread Peter Haworth
I gave up trying to add dictionary notes a while ago since it never worked,
not sure what the current status is.  I guess there's a completely new
dictionary in LC8 but for now, I have my own plugin that gives me the
ability to add my own notes to any dictionary entry.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 8:21 PM, Mike Bonner bonnm...@gmail.com wrote:

 Use of the word Container is a bit deceptive.  Perhaps datasource would
 be better.  Is it still possible to add notes to the dictionary?

 On Sun, Apr 5, 2015 at 5:11 PM, Peter Haworth p...@lcsql.com wrote:

  I'd guess the last of the options.
 
  The more I think about this, the more I think there should be mention of
  this in the dictionary entry for repeat.
 
  It's a little like the ability to use a function to create a sortkey in
 the
  sort command.  Nothing in the dictionary about that except for a user
 note.
 
  Pete
  lcSQL Software http://www.lcsql.com
  Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
  SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
 
  On Sun, Apr 5, 2015 at 3:40 PM, Mike Bonner bonnm...@gmail.com wrote:
 
   Yeah, kinda makes sense that it would work that way. Grab the data from
  the
   container once, do magic things behind the scenes to get it ready to
 go,
   then loop through the lines.  I guess it could work either way though,
   where it uses byte offsets to get the next chunk, which would have made
  the
   function method really suck for large data sets.
  
   Now I'm curious.. what exactly does repeat for each do?  Split on cr,
  sort
   the keys and increment each loop to pop out the right line from the
  array?
   Store all the data in a temp variable and read each line (item, char)
 by
   start/end position?
  
   On Sun, Apr 5, 2015 at 4:19 PM, Jerry Jensen j...@jhj.com wrote:
  
Hi Mike,
   
 On Apr 5, 2015, at 12:31 PM, Mike Bonner bonnm...@gmail.com
 wrote:

 While not exactly whats been requested, this works pretty well:

repeat for each line tLine in (myFilter(sData,abc*,with))

 I like the way a where clause reads as in the OP, but being able to
  use
an
 inline function for data generation is rather powerful, and if all
  you
need
 is a filter, setting up a function to do so is pretty straight
  forward.
   
Good trick! I didn't know you could do that either.
   
I wondered if the function was called just once, or on every repeat.
  Your
exapmle wouldn't tell, because the function would return the same
 stuff
every time.
   
So I tested it. The answer is that the function is called only once.
   Good!
   
global gCount
   
on mouseUp
   global gCount
   put 0 into gCount
   repeat for each line L in mylines()
  put L  cr after msg
   end repeat
   put gCount after msg -- how many times mulines() was called
end mouseUp
   
function mylines
   global gCount
   add 1 to gCount
   return 1  cr  2  cr  3  cr
end mylines
   
   
   
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
   
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
  
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Mike Bonner
Yeah, kinda makes sense that it would work that way. Grab the data from the
container once, do magic things behind the scenes to get it ready to go,
then loop through the lines.  I guess it could work either way though,
where it uses byte offsets to get the next chunk, which would have made the
function method really suck for large data sets.

Now I'm curious.. what exactly does repeat for each do?  Split on cr, sort
the keys and increment each loop to pop out the right line from the array?
Store all the data in a temp variable and read each line (item, char) by
start/end position?

On Sun, Apr 5, 2015 at 4:19 PM, Jerry Jensen j...@jhj.com wrote:

 Hi Mike,

  On Apr 5, 2015, at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:
 
  While not exactly whats been requested, this works pretty well:
 
 repeat for each line tLine in (myFilter(sData,abc*,with))
 
  I like the way a where clause reads as in the OP, but being able to use
 an
  inline function for data generation is rather powerful, and if all you
 need
  is a filter, setting up a function to do so is pretty straight forward.

 Good trick! I didn't know you could do that either.

 I wondered if the function was called just once, or on every repeat. Your
 exapmle wouldn't tell, because the function would return the same stuff
 every time.

 So I tested it. The answer is that the function is called only once. Good!

 global gCount

 on mouseUp
global gCount
put 0 into gCount
repeat for each line L in mylines()
   put L  cr after msg
end repeat
put gCount after msg -- how many times mulines() was called
 end mouseUp

 function mylines
global gCount
add 1 to gCount
return 1  cr  2  cr  3  cr
 end mylines



 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Peter Haworth
I'd guess the last of the options.

The more I think about this, the more I think there should be mention of
this in the dictionary entry for repeat.

It's a little like the ability to use a function to create a sortkey in the
sort command.  Nothing in the dictionary about that except for a user note.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 3:40 PM, Mike Bonner bonnm...@gmail.com wrote:

 Yeah, kinda makes sense that it would work that way. Grab the data from the
 container once, do magic things behind the scenes to get it ready to go,
 then loop through the lines.  I guess it could work either way though,
 where it uses byte offsets to get the next chunk, which would have made the
 function method really suck for large data sets.

 Now I'm curious.. what exactly does repeat for each do?  Split on cr, sort
 the keys and increment each loop to pop out the right line from the array?
 Store all the data in a temp variable and read each line (item, char) by
 start/end position?

 On Sun, Apr 5, 2015 at 4:19 PM, Jerry Jensen j...@jhj.com wrote:

  Hi Mike,
 
   On Apr 5, 2015, at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:
  
   While not exactly whats been requested, this works pretty well:
  
  repeat for each line tLine in (myFilter(sData,abc*,with))
  
   I like the way a where clause reads as in the OP, but being able to use
  an
   inline function for data generation is rather powerful, and if all you
  need
   is a filter, setting up a function to do so is pretty straight forward.
 
  Good trick! I didn't know you could do that either.
 
  I wondered if the function was called just once, or on every repeat. Your
  exapmle wouldn't tell, because the function would return the same stuff
  every time.
 
  So I tested it. The answer is that the function is called only once.
 Good!
 
  global gCount
 
  on mouseUp
 global gCount
 put 0 into gCount
 repeat for each line L in mylines()
put L  cr after msg
 end repeat
 put gCount after msg -- how many times mulines() was called
  end mouseUp
 
  function mylines
 global gCount
 add 1 to gCount
 return 1  cr  2  cr  3  cr
  end mylines
 
 
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Jerry Jensen
Hi Mike,

 On Apr 5, 2015, at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:
 
 While not exactly whats been requested, this works pretty well:
 
repeat for each line tLine in (myFilter(sData,abc*,with))
 
 I like the way a where clause reads as in the OP, but being able to use an
 inline function for data generation is rather powerful, and if all you need
 is a filter, setting up a function to do so is pretty straight forward.

Good trick! I didn't know you could do that either. 

I wondered if the function was called just once, or on every repeat. Your 
exapmle wouldn't tell, because the function would return the same stuff every 
time.

So I tested it. The answer is that the function is called only once. Good!

global gCount

on mouseUp
   global gCount
   put 0 into gCount
   repeat for each line L in mylines()
  put L  cr after msg
   end repeat
   put gCount after msg -- how many times mulines() was called
end mouseUp

function mylines
   global gCount
   add 1 to gCount
   return 1  cr  2  cr  3  cr
end mylines



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Mike Bonner
Actually, if the container is on the receiving end rather than the source
end, it wouldn't work. But other than that, yeah.  (obviously you can't
put something into a function)  There may be other exceptions I haven't
though of.

On Sun, Apr 5, 2015 at 2:41 PM, Mike Bonner bonnm...@gmail.com wrote:

 Most likely yeah.  I wouldn't swear 100% (I like to TRY first lol) but it
 SHOULD work.

 On Sun, Apr 5, 2015 at 2:40 PM, Peter Haworth p...@lcsql.com wrote:

 Wow, didn't know that, thanks.

 The dictionary doesn't give any clue that's possible, just uses
 container
 as what follows in.  Does that mean that anywhere the dictionary uses
 the
 word container, it can be a function call?

 Pete
 lcSQL Software http://www.lcsql.com
 Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
 SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

 On Sun, Apr 5, 2015 at 1:24 PM, Mike Bonner bonnm...@gmail.com wrote:

  As long as you wrap your function in parens so that it forces evaluation
  first, then yeah.  Have the function do your filter, and then return the
  filtered data.  (not positive you even need the extra parens, but its a
  habit for me in cases like this.)
 
  repeat for each doesn't really care where the list comes from, so an
 inline
  function call is just fine.
 
  On Sun, Apr 5, 2015 at 2:18 PM, Peter Haworth p...@lcsql.com wrote:
 
   Hi Mike,
   I like that.  Are you saying you can do that now?
  
   Pete
   lcSQL Software http://www.lcsql.com
   Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
   SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
  
   On Sun, Apr 5, 2015 at 12:31 PM, Mike Bonner bonnm...@gmail.com
 wrote:
  
While not exactly whats been requested, this works pretty well:
   
repeat for each line tLine in (myFilter(sData,abc*,with))
   
I like the way a where clause reads as in the OP, but being able to
 use
   an
inline function for data generation is rather powerful, and if all
 you
   need
is a filter, setting up a function to do so is pretty straight
 forward.
   
On Sun, Apr 5, 2015 at 1:03 PM, Ralph DiMola 
  rdim...@evergreeninfo.net
wrote:
   
 Wouldn't it be nice if you could:

 Repeat for each line tLine in tLines index tIndex
 End repeat

 Where tIndex goes from 1 to (in this case) the number of lines in
   tLines.
 With such an elegant repeat loop in LC it kills me to do a:


 Local tIndex
 put 1 into tIndex
 Repeat for each line tLine in tLines
 Add 1 to tIndex
 End repeat


 Ralph DiMola
 IT Director
 Evergreen Information Services
 rdim...@evergreeninfo.net



 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
   
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
  
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Mike Bonner
Use of the word Container is a bit deceptive.  Perhaps datasource would
be better.  Is it still possible to add notes to the dictionary?

On Sun, Apr 5, 2015 at 5:11 PM, Peter Haworth p...@lcsql.com wrote:

 I'd guess the last of the options.

 The more I think about this, the more I think there should be mention of
 this in the dictionary entry for repeat.

 It's a little like the ability to use a function to create a sortkey in the
 sort command.  Nothing in the dictionary about that except for a user note.

 Pete
 lcSQL Software http://www.lcsql.com
 Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
 SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

 On Sun, Apr 5, 2015 at 3:40 PM, Mike Bonner bonnm...@gmail.com wrote:

  Yeah, kinda makes sense that it would work that way. Grab the data from
 the
  container once, do magic things behind the scenes to get it ready to go,
  then loop through the lines.  I guess it could work either way though,
  where it uses byte offsets to get the next chunk, which would have made
 the
  function method really suck for large data sets.
 
  Now I'm curious.. what exactly does repeat for each do?  Split on cr,
 sort
  the keys and increment each loop to pop out the right line from the
 array?
  Store all the data in a temp variable and read each line (item, char) by
  start/end position?
 
  On Sun, Apr 5, 2015 at 4:19 PM, Jerry Jensen j...@jhj.com wrote:
 
   Hi Mike,
  
On Apr 5, 2015, at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:
   
While not exactly whats been requested, this works pretty well:
   
   repeat for each line tLine in (myFilter(sData,abc*,with))
   
I like the way a where clause reads as in the OP, but being able to
 use
   an
inline function for data generation is rather powerful, and if all
 you
   need
is a filter, setting up a function to do so is pretty straight
 forward.
  
   Good trick! I didn't know you could do that either.
  
   I wondered if the function was called just once, or on every repeat.
 Your
   exapmle wouldn't tell, because the function would return the same stuff
   every time.
  
   So I tested it. The answer is that the function is called only once.
  Good!
  
   global gCount
  
   on mouseUp
  global gCount
  put 0 into gCount
  repeat for each line L in mylines()
 put L  cr after msg
  end repeat
  put gCount after msg -- how many times mulines() was called
   end mouseUp
  
   function mylines
  global gCount
  add 1 to gCount
  return 1  cr  2  cr  3  cr
   end mylines
  
  
  
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
  
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Richmond

On 05/04/15 19:54, Peter Haworth wrote:

Wouldn't it be nice if you could:

repeat for each line rLine in tLines where rLine begins with xyz
.
end repeat

I know it's trivial to test the condition within the repeat loop but having
where condition seems more elegant somehow.

Pete



Certainly seems a good idea to me.

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Paul Dupuis
On 4/5/2015 12:54 PM, Peter Haworth wrote:
 Wouldn't it be nice if you could:

 repeat for each line rLine in tLines where rLine begins with xyz
 .
 end repeat

 I know it's trivial to test the condition within the repeat loop but having
 where condition seems more elegant somehow.

Why not:

filter lines of tLines with xyz*
repeat for each line rLine in tLines
.
end repeat

The suggested  - where rLine begins with xyz - clause is 5 words. The
- filter lines of tLines with xyz* - is also just 5 words

Extending LiveCode's to do something you can already do in the language
easier makes most sense if it save the developer significant keystrokes.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: Repeat syntax addition

2015-04-05 Thread Ralph DiMola
Wouldn't it be nice if you could:

Repeat for each line tLine in tLines index tIndex
End repeat

Where tIndex goes from 1 to (in this case) the number of lines in tLines.
With such an elegant repeat loop in LC it kills me to do a:


Local tIndex
put 1 into tIndex
Repeat for each line tLine in tLines 
Add 1 to tIndex
End repeat


Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Peter Haworth
Because I might not want to eliminate the lines beginning with xyz from
the list, just not process them within the repeat loop, there's a
difference.



Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 10:18 AM, Paul Dupuis p...@researchware.com wrote:

 On 4/5/2015 12:54 PM, Peter Haworth wrote:
  Wouldn't it be nice if you could:
 
  repeat for each line rLine in tLines where rLine begins with xyz
  .
  end repeat
 
  I know it's trivial to test the condition within the repeat loop but
 having
  where condition seems more elegant somehow.

 Why not:

 filter lines of tLines with xyz*
 repeat for each line rLine in tLines
 .
 end repeat

 The suggested  - where rLine begins with xyz - clause is 5 words. The
 - filter lines of tLines with xyz* - is also just 5 words

 Extending LiveCode's to do something you can already do in the language
 easier makes most sense if it save the developer significant keystrokes.


 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Repeat syntax addition

2015-04-05 Thread Peter Haworth
Wouldn't it be nice if you could:

repeat for each line rLine in tLines where rLine begins with xyz
.
end repeat

I know it's trivial to test the condition within the repeat loop but having
where condition seems more elegant somehow.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Mike Bonner
While not exactly whats been requested, this works pretty well:

repeat for each line tLine in (myFilter(sData,abc*,with))

I like the way a where clause reads as in the OP, but being able to use an
inline function for data generation is rather powerful, and if all you need
is a filter, setting up a function to do so is pretty straight forward.

On Sun, Apr 5, 2015 at 1:03 PM, Ralph DiMola rdim...@evergreeninfo.net
wrote:

 Wouldn't it be nice if you could:

 Repeat for each line tLine in tLines index tIndex
 End repeat

 Where tIndex goes from 1 to (in this case) the number of lines in tLines.
 With such an elegant repeat loop in LC it kills me to do a:


 Local tIndex
 put 1 into tIndex
 Repeat for each line tLine in tLines
 Add 1 to tIndex
 End repeat


 Ralph DiMola
 IT Director
 Evergreen Information Services
 rdim...@evergreeninfo.net



 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Peter Haworth
Nic Ralph. Useful where you don;t want to incur the overhead of repeat with
but still need a counter.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 12:03 PM, Ralph DiMola rdim...@evergreeninfo.net
wrote:

 Wouldn't it be nice if you could:

 Repeat for each line tLine in tLines index tIndex
 End repeat

 Where tIndex goes from 1 to (in this case) the number of lines in tLines.
 With such an elegant repeat loop in LC it kills me to do a:


 Local tIndex
 put 1 into tIndex
 Repeat for each line tLine in tLines
 Add 1 to tIndex
 End repeat


 Ralph DiMola
 IT Director
 Evergreen Information Services
 rdim...@evergreeninfo.net



 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Peter Haworth
Hi Mike,
I like that.  Are you saying you can do that now?

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:

 While not exactly whats been requested, this works pretty well:

 repeat for each line tLine in (myFilter(sData,abc*,with))

 I like the way a where clause reads as in the OP, but being able to use an
 inline function for data generation is rather powerful, and if all you need
 is a filter, setting up a function to do so is pretty straight forward.

 On Sun, Apr 5, 2015 at 1:03 PM, Ralph DiMola rdim...@evergreeninfo.net
 wrote:

  Wouldn't it be nice if you could:
 
  Repeat for each line tLine in tLines index tIndex
  End repeat
 
  Where tIndex goes from 1 to (in this case) the number of lines in tLines.
  With such an elegant repeat loop in LC it kills me to do a:
 
 
  Local tIndex
  put 1 into tIndex
  Repeat for each line tLine in tLines
  Add 1 to tIndex
  End repeat
 
 
  Ralph DiMola
  IT Director
  Evergreen Information Services
  rdim...@evergreeninfo.net
 
 
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Mike Bonner
As long as you wrap your function in parens so that it forces evaluation
first, then yeah.  Have the function do your filter, and then return the
filtered data.  (not positive you even need the extra parens, but its a
habit for me in cases like this.)

repeat for each doesn't really care where the list comes from, so an inline
function call is just fine.

On Sun, Apr 5, 2015 at 2:18 PM, Peter Haworth p...@lcsql.com wrote:

 Hi Mike,
 I like that.  Are you saying you can do that now?

 Pete
 lcSQL Software http://www.lcsql.com
 Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
 SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

 On Sun, Apr 5, 2015 at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:

  While not exactly whats been requested, this works pretty well:
 
  repeat for each line tLine in (myFilter(sData,abc*,with))
 
  I like the way a where clause reads as in the OP, but being able to use
 an
  inline function for data generation is rather powerful, and if all you
 need
  is a filter, setting up a function to do so is pretty straight forward.
 
  On Sun, Apr 5, 2015 at 1:03 PM, Ralph DiMola rdim...@evergreeninfo.net
  wrote:
 
   Wouldn't it be nice if you could:
  
   Repeat for each line tLine in tLines index tIndex
   End repeat
  
   Where tIndex goes from 1 to (in this case) the number of lines in
 tLines.
   With such an elegant repeat loop in LC it kills me to do a:
  
  
   Local tIndex
   put 1 into tIndex
   Repeat for each line tLine in tLines
   Add 1 to tIndex
   End repeat
  
  
   Ralph DiMola
   IT Director
   Evergreen Information Services
   rdim...@evergreeninfo.net
  
  
  
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
  
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Peter Haworth
Wow, didn't know that, thanks.

The dictionary doesn't give any clue that's possible, just uses container
as what follows in.  Does that mean that anywhere the dictionary uses the
word container, it can be a function call?

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

On Sun, Apr 5, 2015 at 1:24 PM, Mike Bonner bonnm...@gmail.com wrote:

 As long as you wrap your function in parens so that it forces evaluation
 first, then yeah.  Have the function do your filter, and then return the
 filtered data.  (not positive you even need the extra parens, but its a
 habit for me in cases like this.)

 repeat for each doesn't really care where the list comes from, so an inline
 function call is just fine.

 On Sun, Apr 5, 2015 at 2:18 PM, Peter Haworth p...@lcsql.com wrote:

  Hi Mike,
  I like that.  Are you saying you can do that now?
 
  Pete
  lcSQL Software http://www.lcsql.com
  Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
  SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
 
  On Sun, Apr 5, 2015 at 12:31 PM, Mike Bonner bonnm...@gmail.com wrote:
 
   While not exactly whats been requested, this works pretty well:
  
   repeat for each line tLine in (myFilter(sData,abc*,with))
  
   I like the way a where clause reads as in the OP, but being able to use
  an
   inline function for data generation is rather powerful, and if all you
  need
   is a filter, setting up a function to do so is pretty straight forward.
  
   On Sun, Apr 5, 2015 at 1:03 PM, Ralph DiMola 
 rdim...@evergreeninfo.net
   wrote:
  
Wouldn't it be nice if you could:
   
Repeat for each line tLine in tLines index tIndex
End repeat
   
Where tIndex goes from 1 to (in this case) the number of lines in
  tLines.
With such an elegant repeat loop in LC it kills me to do a:
   
   
Local tIndex
put 1 into tIndex
Repeat for each line tLine in tLines
Add 1 to tIndex
End repeat
   
   
Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net
   
   
   
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
   
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
  
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Repeat syntax addition

2015-04-05 Thread Mike Bonner
Most likely yeah.  I wouldn't swear 100% (I like to TRY first lol) but it
SHOULD work.

On Sun, Apr 5, 2015 at 2:40 PM, Peter Haworth p...@lcsql.com wrote:

 Wow, didn't know that, thanks.

 The dictionary doesn't give any clue that's possible, just uses container
 as what follows in.  Does that mean that anywhere the dictionary uses the
 word container, it can be a function call?

 Pete
 lcSQL Software http://www.lcsql.com
 Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
 SQLiteAdmin http://www.lcsql.com/sqliteadmin.html

 On Sun, Apr 5, 2015 at 1:24 PM, Mike Bonner bonnm...@gmail.com wrote:

  As long as you wrap your function in parens so that it forces evaluation
  first, then yeah.  Have the function do your filter, and then return the
  filtered data.  (not positive you even need the extra parens, but its a
  habit for me in cases like this.)
 
  repeat for each doesn't really care where the list comes from, so an
 inline
  function call is just fine.
 
  On Sun, Apr 5, 2015 at 2:18 PM, Peter Haworth p...@lcsql.com wrote:
 
   Hi Mike,
   I like that.  Are you saying you can do that now?
  
   Pete
   lcSQL Software http://www.lcsql.com
   Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
   SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
  
   On Sun, Apr 5, 2015 at 12:31 PM, Mike Bonner bonnm...@gmail.com
 wrote:
  
While not exactly whats been requested, this works pretty well:
   
repeat for each line tLine in (myFilter(sData,abc*,with))
   
I like the way a where clause reads as in the OP, but being able to
 use
   an
inline function for data generation is rather powerful, and if all
 you
   need
is a filter, setting up a function to do so is pretty straight
 forward.
   
On Sun, Apr 5, 2015 at 1:03 PM, Ralph DiMola 
  rdim...@evergreeninfo.net
wrote:
   
 Wouldn't it be nice if you could:

 Repeat for each line tLine in tLines index tIndex
 End repeat

 Where tIndex goes from 1 to (in this case) the number of lines in
   tLines.
 With such an elegant repeat loop in LC it kills me to do a:


 Local tIndex
 put 1 into tIndex
 Repeat for each line tLine in tLines
 Add 1 to tIndex
 End repeat


 Ralph DiMola
 IT Director
 Evergreen Information Services
 rdim...@evergreeninfo.net



 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
   
   ___
   use-livecode mailing list
   use-livecode@lists.runrev.com
   Please visit this url to subscribe, unsubscribe and manage your
   subscription preferences:
   http://lists.runrev.com/mailman/listinfo/use-livecode
  
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode