Hi Arnoux,

Arnoux Vincent wrote:
> A few anti-slashes have been added (dunno know why...) :
> 
> Hi List,
> I have a list of objects:
> l: copy []
> obj: make object! [ a: none calc: does [self/a: (self/a + 1)]]
> append l make obj [a: 1]
> append l make obj [a: 2]
> 
> I would like to write a function like:
> inc-obj: func [arg][
>     arg/calc
> ]
> 
> That would allow me to do:
> foreach o l [
>     inc-obj o
> ]

Up to here, no problem. (though I don't know why you don't want to use

   foreach o l [ o/calc ]

> And output:
> probe (first l)/a
> 2
> probe (second l)/a
> 3

But this won't work, because parens!s are not allowed in paths ... however 
you can do any of the following ...

   probe l/1/a
   == 2
   probe l/2/a
   == 3

   num: 1

   probe l/:num/a
   == 2

and becoming somewhat esoteric ...

   probe get in first l 'a
   == 2


I hope that's enough for now ...

Ingo

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to