|
|||
|
One thing I used to do a lot was to call a function returning an array and
get the element I wanted straight away. eg a := Function()[1] This doesn't work very well I have to do LOCAL b AS ARRAY b := Function() a := b[1] Any ideas please? |
|
|
||||
|
||||
|
|
|
|||
|
Perhaps also using Arrayget(Function(), 1) should work. But Robert did
always warn to have too complex expressions and better use temporary variables to avoid problems with the garbage collector. In the last years I have changed my style of coding: better more rows of code with short clear statements. Arne Ortlinghaus "Martin" <nospam@spam.spam> schrieb im Newsbeitrag news:fgpbpm$6vn$1$8300dec7@news.demon.co.uk... > One thing I used to do a lot was to call a function returning an array and > get the element I wanted straight away. > > eg > > a := Function()[1] > > This doesn't work very well > > I have to do > > LOCAL b AS ARRAY > > b := Function() > a := b[1] > > Any ideas please? > |
|
|||
|
>>Perhaps also using Arrayget(Function(), 1) should work. But Robert did
>>always warn to have too complex expressions and better use temporary >>variables to avoid problems with the garbage collector. In the last years >>I have changed my style of coding: better more rows of code with short >>clear statements. Didn't even think about it - went to a temporary variable |
|
|||
|
richard.townsendrose@googlemail.com wrote:
> martin > > try declaring the function as an array > > function fred as array > local anarray as array > anarray:={1,2,3,4,5} > return anarray Remember that is not really strongly typed (as array pascal would be, or strongly typing an argument if it had one) |
|
|||
|
Martin wrote:
> One thing I used to do a lot was to call a function returning an array and > get the element I wanted straight away. Which build (e.g. are you saying it used to do it a lot and it does not work in Vo2.8 gold) Have you reported it to grafx? What does it do (for those of us who are in the middle of other things) |
|
|||
|
Martin.
Irrespective of whether this should work or not, it is a horrible syntax and I certainly wouldn't want to work with it. What is so wrong with: > b := Function() > a := b[1] This is at least thoroughly clear and will give you much better compile time error handling. Geoff |
|
|||
|
>>Martin.
>> >>Irrespective of whether this should work or not, it is a horrible syntax >>and I certainly wouldn't want to work with it. What is so wrong with: >> >>> b := Function() >>> a := b[1] >> >>This is at least thoroughly clear and will give you much better compile >>time error handling. >> >>Geoff >> Converted from code where every LOCAL takes 14bytes |
|
|||
|
Martin.
What do you mean by this? The 14 bytes is created whether you declare a local variable or not because one has to be created internally if you don't but who cares! A whole 14 bytes? <g> But as code goes it is hard to read, poor for maintenance and terrible for debugging. Cheers, Geoff "Martin" <nospam@spam.spam> wrote in message news:fgsqrk$ght$1$8300dec7@news.demon.co.uk: > >>Martin. > >> > >>Irrespective of whether this should work or not, it is a horrible syntax > >>and I certainly wouldn't want to work with it. What is so wrong with: > >> > >>> b := Function() > >>> a := b[1] > >> > >>This is at least thoroughly clear and will give you much better compile > >>time error handling. > >> > >>Geoff > >> > > Converted from code where every LOCAL takes 14bytes |
|
|||
|
>>Martin.
>> >>What do you mean by this? >> >>The 14 bytes is created whether you declare a local variable or not >>because one has to be created internally if you don't but who cares! A >>whole 14 bytes? <g> Clipper where DGROUP is precious |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: MAX of _TEMPORARY_ array? | Venky Chakravarthy | Newsgroup comp.soft-sys.sas | 0 | 06-27-2005 09:19 PM |
| Re: MAX of _TEMPORARY_ array? | nospam@HOWLES.COM (Howard Schreier | Newsgroup comp.soft-sys.sas | 0 | 06-27-2005 04:51 PM |
| Re: MAX of _TEMPORARY_ array? | Jack Hamilton | Newsgroup comp.soft-sys.sas | 0 | 06-25-2005 06:25 AM |
| SAS Access to Oracle | ma015b8234 | Newsgroup comp.soft-sys.sas | 0 | 06-02-2005 06:23 PM |
| Re: find maximum vaule in sas array | Paul M. Dorfman | Newsgroup comp.soft-sys.sas | 0 | 04-27-2005 05:27 AM |