Is this mad?
Jim Ault
JimAultWins at yahoo.com
Thu Apr 17 11:26:35 EDT 2008
On 4/17/08 5:38 AM, "Beynon, Rob" <R.Beynon at liverpool.ac.uk> wrote:
> Sometimes when writing code, I write things like
> Repeat for each line protein in allProteins
> Repeat for each char aminoAcid in protein
> Etc etc
>
> I'd really like this to look like this, defining a new function 'synonym'
> make protein a synonym of line
> make aminoAcid a synonym of char
> Repeat for each protein in allProteins
> Repeat for each aminoAcid in protein
> Etc etc
> Does the extensibility/flexibility make code easier or harder to read/use?
It is not 'mad', but also not within the syntax of Rev.
In the case of a repeat loop the syntax for Rev is
REPEAT FOR EACH LINE varYouWantToUse IN containerOrVariable
REPEAT FOR EACH ITEM varYouWantToUse IN containerOrVariable
REPEAT FOR EACH CHAR varYouWantToUse IN containerOrVariable
so you cannot directly use
REPEAT FOR EACH chunkSynonym IN containerOrVariable
Your " Repeat for each protein in allProteins" omits a key word
You could, of course, set up function or procedure handlers and globals, but
then you would be getting further away from English-like syntax. The same
goes for the "do" command.
'make' is not a reserved word in Rev so you can use it to be a handler or
function
Hope this helps.
Jim Ault
Las Vegas
More information about the use-livecode
mailing list