Re: Euphoria 4.0.1
- Posted by Vinoba Mar 13, 2011
- 2584 views
Vinoba, I'm sorry but I am totally lost on what you are asking for. Can you write a simple requirement for the function or give the function in say C or Pascal so we can understand what you are saying?
We should probably fork this conversation since it isn't related solely to Euphoria 4.0.1.
I am only trying to point out the fallacy of saying that the simple math functions (+ - * / ) work on sequence against sequence AND sequence against a single element. It does work in an immediate mode as Matt has tried to demonstrate, but hen you have a moderately complicated business need such that you and I have to design a function for an end user, we run into a problem as we have to access each element of a sequence separately and at time the sequence may be a sequence and at times the "sequence" may only be a single value.
Look at the function I wrote above and now we are going to expand it to a moderately relaistic level
500 items in a store. Each item has a separate price Some have discounts (on varying days) Whole section of items (e.g. all tiles) have one single discount as a special which will last only till Friday and then not. Customers come in and buy - sometime 5 items and sometimes 100 items and in small and large quantities. Whilst the cashier is busy, the manger comes to her and says "give him 10% discount on all lumber and 5% on all trusses", the demure old lady next in queue is waiting to buy one screwdriver only with its special discount today. What I have described is a normal store. Yes they all have nicely programmed cash machines so you and I do have to write a program for them, but supposing you were writing an application?
Somewhere in this situation we are faced with having to operate on single values in a sequence and a function with parameters defined as (sequence a, sequence b, sequence c, sequence x, sequence y, sequence z ) does not work if we have to build a loop around each sequence items, because here, there and everywhere, now and then and tomorrow, the sequence supplied will not be sequence but a single element.
Similar problem would arise in a 80 employee office getting payroll. some have exact percentage deductions, some have special deductions, some have holiday pay etc. To accommodate all this in a FUNCTION, you have to work in a loop of a sequence of names or numbers and apply sequences of pay/hour etc. You end up with a loop and your parameter definitions (sequence a,sequence b,sequence c,sequence x,sequence y, sequence z, ) bombs.