Methods returning results by reference and tuples

General discussions related to APLNext's VisualAPL.

Moderators: Tech Support, phpbb_admin

Methods returning results by reference and tuples

Postby joe_blaze » September 11th, 2008, 2:32 am

The attached .pdf illustrates a Cielo Explorer session in which a .Net method is called which returns one of its results by reference.

The .GetType() results are illustrated for information only and are not required for the project. In the example, since the result of the .Net method Math.DivRem() is a singleton (scalar) of type 'tuple', the APL shape of the tuple is empty, whereas the Count property of the tuple indicates 2 items in the enumeration.

The nice feature of returning a tuple is that the programmer is not required to initialize a reference variable before calling the method which returns a result by reference. Had the programmer been required to initialize a reference variable, the type and dimension of the reference variable would also have to be specified. This is avoided by using type-safe tuples as the result. Using .Net 'reflection', VisualAPL automatically properly coerces the tuple items to the correct datatype(s) for the programmer.

After debugging your code in the fully-interactive Cielo Explorer, the APL code may be saved as a VisualAPL script file, or compiled into a .Net assembly (.dll) for use within any .Net project.
Attachments
VisualAPL Calling a Method which returns results by reference.pdf
(153.96 KiB) Downloaded 333 times
joe_blaze
 
Posts: 384
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361

Return to VisualAPL

Who is online

Users browsing this forum: No registered users and 23 guests

cron