1. Home
  2. FARGUMENTS directive

FARGUMENTS directive

Forms lists of arguments involved in an expression.

Options

EXPRESSION = expression structure Expression whose arguments are required
NRESULTS = scalar Number of results generated by the expression
NCALCULATIONS = scalar Number of calculations in the expression

Parameters

ICALCULATION = scalars The calculation from which to save the result and arguments
RESULT = dummies Stores the result structure for calculation ICALCULATION
ARGUMENTS = pointers Stores the arguments in calculation ICALCULATION

Description

The FARGUMENTS directive allows you to access the data structures involved in a Genstat expression. For example, the expression

P = R / N

defines a calculation involving the data structures R and N, and stores the results in the data structure P. An expression can contain lists, to define several calculations. For example,

P1,P2 = R1,R2 / N1,N2

has two results, P1 and P2, that are calculated as R1/N1 and R2/N2 respectively. Some expressions may have no results, for example

LOG(P1/(1-P1))

This could then be used as part of a CALCULATE statement, as in the following program

EXPRESSION [VALUE=LOG(P1/(1-P1))] Transformation

CALCULATE Y = #Transformation

If you are writing a procedure that takes an expression as one of its inputs, you may want to know what results it is generating and what data structures it is using to calculate them. The FARGUMENTS allows you to find this out.

The expression to study is specified by the EXPRESSION option. The NRESULTS option can save the number of results, and the NCALCULATIONS option can save the number of calculations. The parameters of FARGUMENTS allow you to save information about each of the calculations in the expression: the ICALCULATION parameter specifies the number of the calculation, the RESULT parameter can specify a dummy to be set to the structure that is given the result, and the ARGUMENTS parameter can specify a pointer to save the arguments.

Options: EXPRESSION, NRESULTS, NCALCULATIONS.

Parameters: ICALCULATION, RESULT, ARGUMENTS.

See also

Directives: EXPRESSION, DUMMY, POINTER, SCALAR, FCLASSIFICATION.

Commands for: Calculations and manipulation.

Example

" Example 1:4.8.2 "
EXPRESSION Sum; VALUE=!e(S=A+B+C+D)
FARGUMENTS [EXPRESSION=Sum] 1; RESULT=SumRes; ARGUMENTS=SumArgs
PRINT      !p(SumRes)
PRINT      SumArgs
SCALAR     L1,L2,P1,P2
EXPRESSION Transformation; VALUE=!e(L1,L2=LOG(P1,P2/(1-P1,P2)))
FARGUMENTS [EXPRESSION=Transformation; NRESULTS=Nt]
FARGUMENTS [EXPRESSION=Transformation] 1...Nt; RESULT=TRes[1...Nt];\
           ARGUMENTS=TArgs[1...Nt]
FOR [NTIMES=Nt; INDEX=i]
  PRINT    !p(TRes[i])
  PRINT    TArgs[i]
  PRINT    TArgs[i][]
ENDFOR
Updated on June 19, 2019

Was this article helpful?