Closed GoogleCodeExporter closed 9 years ago
I'm not sure about 2.)
- First the syntax:-
An operation like "addition" for example could be confusing. Somebody could
associate it with adding a component to the list. The multiplication might be
associated with multiplying the number of list components (python folks for
example).
- It is not a generic case for all lists. It is an operation for the numeric
lists only.
- could be achieved with one line of code if we introduce some functions like
"range" or "index" then
int list a = {1,2,3}
foreach (int i; index(a)) a[i] = a[i]+3;
or
foreach (int i; range(0,len(a))) a[i] = a[i]+3;
(the above are just ideas)
Original comment by krustev....@gmail.com
on 14 Apr 2012 at 6:32
ad 2.)
suggestion:
* all index operations should stay within the [] operator as it is already the
case
* all other operations on lists of numbers are done in the mathematical sense
(e.g. as it is implemented in Matlab)
Finally it is just a question of definition. I'm not sure if we should be
compatible to each available programming language.
The main reason for this request is because of performance, code simplicity and
readability. Mathematical operations on lists within a mathematical task (and
geometry is the main task in Toped ;) will be done regular. Thus, the support
of regular actions motivates their usage and elevates the scripting language to
a higher level.
Actually exact your implementation of the "scalar addition" is done in the
UDF-library (not yet checked in). But the main disadvantage is by sure that for
each list operation the number of computing tasks is much much higher than with
an predefined internal operator.
For now I don't have so large applications that performance is an issue. So,
I'm fine with the implementation as a script. But as you know, everything under
development rises with exponential progression (at least stated by R. Kurzweil)
;)
Original comment by analogc...@gmx.net
on 14 Apr 2012 at 8:29
Updates implementing 1.) - in r2127
About 2.)
I understand the rationale behind the request and I agree with it - hence the
discussion is about the way to do it. I agree also that we don't have to be
compatible with all languages/scripts around but hey, this includes Matlab :).
Yet we can get ideas from there, what we do.
Seriously, the important point here is that those operations relate to a
certain type of lists - i.e. numerical ones.
I have number of suggestions:
- this seems to deserve a separate thread - so let's raise a separate issue
(scalar operations over lists) and continue the discussion there
- looking at it I found some dodgy points in our "foreach" implementation. I'll
do some additional tests and will eventually raise a separate issue about it.
- I'll change the status to "Fixed", check the implementation of 1.) and
eventually close this issue.
Original comment by krustev....@gmail.com
on 15 Apr 2012 at 9:58
Original comment by krustev....@gmail.com
on 15 Apr 2012 at 10:27
[deleted comment]
About 2 - After the latest updates in Issue 141, now the original example can
be resolved using:
int list a = {1,2,3};
foreach(int i; a) i = i+3; //same for -, /, * or any other more complex
operation
I guess we have to close this issue now.
Original comment by krustev....@gmail.com
on 9 May 2012 at 12:14
Original comment by krustev....@gmail.com
on 13 May 2012 at 8:16
Original issue reported on code.google.com by
analogc...@gmx.net
on 30 Mar 2012 at 7:48