On Wed, 07 Jan 2015, Lewis Balentine wrote:
> Do I have it correct now ??
> The program runs and operates as expected.
> My concern is more to the proper nomenclature than function.
> 

Array.Sort() is a *method* :-)

It rearranges the elements of the object it is applied to and returns that
object afterwards. That is, you will always have

  aArray == aArray.Sort()

where == should be read as "are the same object", despite == not being a
Gambas operator (I use it here to distinguish between the same-object
relation and an assignment).

So, the actual work is done on the object you use to the method on and the
return value is just for brevity in certain applications like

  Print aArray.Sort().Join(",")

  ' or

  For Each sElt In aArray.Sort()
    Print sElt
  Next

  ' or

  With EliminateSuccessiveDuplicates(aArray.Sort())
    Print .Count;; "unique elements:"
    For iInd = 0 To .Max
      Print .[iInd]
    Next
  End With

If you want truly function-like semantics, then you can use the idiom

  aArray.Copy().Sort()

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to