Is it possible to maybe get some syntactic sugar to do just that?

I know thats one of the things that first attracted me to python.

for item in array:
    <do stuff>

Its also possible to do `for i in range(len(stuff))`, but thats less
readable and less fun :-)

Would that be a feature request?  Or is Mozart/Oz pretty much stable and solid?
(It wouldn't affect the kernel language I don't think, just add more sugar)

~Alex

On Mon, Jul 20, 2009 at 5:51 PM, Jorge Marques
Pelizzoni<[email protected]> wrote:
> Nope, but as arrays offer efficient random subscripting you might as well 
> write:
>
> for I in {Array.low A}..{Array.high A} do {Browse A.I} end
>
> Cheers,
>
> Jorge.
>
> 2009/7/20 Oliver Mooney <[email protected]>:
>> Dear all,
>> Does the Loop construct work with Arrays created using NewArray? If not is
>> there any built-in functionality for cycling through the contents of an
>> Array? For example,
>> TestArray = {NewArray 1 10 1}
>> for X in TestArray do {Browse X} end
>> This raises a type error:
>> %*************************** type error *************************
>> %**
>> %** Expected type: record or chunk
>> %** At argument:   1
>> %** In statement:  1 . 1 = _<optimized>
>> %**
>> %** Call Stack:
>> %** procedure 'ForProc' in file "/Users/Oliver/Documents/CTM ex 7.6.oz",
>> line 22, column 0, PC = 2435632
>> %**--------------------------------------------------------------
>> Thanks,
>> Oliver.
>> _________________________________________________________________________________
>> mozart-users mailing list
>> [email protected]
>> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>>
> _________________________________________________________________________________
> mozart-users mailing list                               
> [email protected]
> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to