Binding Strength: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 49: Line 49:
In particular,
In particular,


* A dyadic operator written as &nbsp;&nbsp; <aplcl>&hellip; dop 1 2 3 4</aplcl> &nbsp;&nbsp; is interpreted as having a right operand ('''short''' right scope) of <aplcl>1</aplcl> and a right argument ('''long''' right scope) of <aplcl>2 3 4</aplcl>.
* A dyadic operator written as &nbsp;&nbsp; <apll>&hellip; dop 1 2 3 4</apll> &nbsp;&nbsp; is interpreted as having a right operand ('''short''' right scope) of <apll>1</apll> and a right argument ('''long''' right scope) of <apll>2 3 4</apll>.
* A hyperator written as either &nbsp;&nbsp; <aplcl>1 2 3 4 mhmo</aplcl> &nbsp;&nbsp; or &nbsp;&nbsp; <aplcl>1 2 3 4 mhdo &hellip;</aplcl> &nbsp;&nbsp; is interpreted as having a left hyperand ('''short''' left scope) of <aplcl>4</aplcl> and a left operand ('''long''' left scope) of <aplcl>1 2 3</aplcl>.
* A hyperator written as either &nbsp;&nbsp; <apll>1 2 3 4 mhmo</apll> &nbsp;&nbsp; or &nbsp;&nbsp; <apll>1 2 3 4 mhdo &hellip;</apll> &nbsp;&nbsp; is interpreted as having a left hyperand ('''short''' left scope) of <apll>4</apll> and a left operand ('''long''' left scope) of <apll>1 2 3</apll>.
* A dyadic hyperator written as &nbsp;&nbsp; <aplcl>&hellip; dhmo 1 2 3 4</aplcl> &nbsp;&nbsp; is interpreted as having a right hyperand ('''short''' right scope) of <aplcl>1</aplcl> and a right argument ('''long''' right scope) of <aplcl>2 3 4</aplcl>.
* A dyadic hyperator written as &nbsp;&nbsp; <apll>&hellip; dhmo 1 2 3 4</apll> &nbsp;&nbsp; is interpreted as having a right hyperand ('''short''' right scope) of <apll>1</apll> and a right argument ('''long''' right scope) of <apll>2 3 4</apll>.
* A dyadic hyperator written as &nbsp;&nbsp; <aplcl>&hellip; dhdo 1 2 3 4</aplcl> &nbsp;&nbsp; is interpreted as having a right hyperand ('''short''' right scope) of <aplcl>1</aplcl>, a right operand ('''short''' right scope) of <aplcl>2</aplcl>, and a right argument ('''long''' right scope) of <aplcl>3 4</aplcl>.
* A dyadic hyperator written as &nbsp;&nbsp; <apll>&hellip; dhdo 1 2 3 4</apll> &nbsp;&nbsp; is interpreted as having a right hyperand ('''short''' right scope) of <apll>1</apll>, a right operand ('''short''' right scope) of <apll>2</apll>, and a right argument ('''long''' right scope) of <apll>3 4</apll>.


To reduce confusion, use parentheses such as <aplcl>(LO (LH dhdo 1) 2) 3 4</aplcl>.
To reduce confusion, use parentheses such as <apll>(LO (LH dhdo 1) 2) 3 4</apll>.


Abbreviations:
Abbreviations:
Line 62: Line 62:
* <apll>dhmo</apll> Dyadic Hyperand Monadic Operand ...
* <apll>dhmo</apll> Dyadic Hyperand Monadic Operand ...
* <apll>dhdo</apll> Dyadic Hyperand Dyadic Operand ...
* <apll>dhdo</apll> Dyadic Hyperand Dyadic Operand ...
Also, see [[Hyperators#Syntax_Glitch|Syntax Glitch]].


==References==
==References==


<references />
<references />

Latest revision as of 06:17, 10 September 2019

Table

The rules for how Variables, Functions, Operators, Hyperators and other syntactic elements combine are covered in the following table which is an extension of the one used in APL2[1]:


# Category Description Example
12: Brackets left Brackets to what is on their left "? […]"
11: Specification left Left arrow to what is on its left "? ←"
10: Right hyperand, right operand Dyadic hyperator to its right hyperand "HYP ?"
9: Right hyperand, left operand Dyadic hyperator to its right hyperand "HYP ?"
8: Left hyperand, right operand Hyperator to its left hyperand "? HYP"
7: Left hyperand, left operand Hyperator to its left hyperand "? HYP"
6: Right operand Dyadic operator to its right operand "DOP ?"
5: Vector notation Array to an array "A A"
4: Left operand Operator to its left operand "? MOP"
4: Train right Train to its right paren "… F)"
3: Train left Train to its left paren "(F …"
3: Left argument Function to its left argument "A F"
2: Right argument Function to its right argument "F A"
1: Specification right Left arrow to what is on its right "← ?"
0: Brackets right Brackets to what is on their right "[…] ?"

One way to look at these rules is described in the APL2 Reference Manual as "Binding defines how names and symbols group for evaluation. Given three names (or symbols), binding strength determines if the center one is associated with the name (or symbol) on the left or the right."[1]

Vector Notation

As the above table indicates, Vector Notation has a lower Binding Strength than both a right operand to its operator and either hyperand to its hyperator. One consequence of this is a change introduced in NARS2000 Version 0.5.10 w.r.t. Numeric Strands, in conjunction with the short scope of the three elements: Right Operands, Left Hyperands, and Right Hyperands.

In particular,

  • A dyadic operator written as    … dop 1 2 3 4    is interpreted as having a right operand (short right scope) of 1 and a right argument (long right scope) of 2 3 4.
  • A hyperator written as either    1 2 3 4 mhmo    or    1 2 3 4 mhdo …    is interpreted as having a left hyperand (short left scope) of 4 and a left operand (long left scope) of 1 2 3.
  • A dyadic hyperator written as    … dhmo 1 2 3 4    is interpreted as having a right hyperand (short right scope) of 1 and a right argument (long right scope) of 2 3 4.
  • A dyadic hyperator written as    … dhdo 1 2 3 4    is interpreted as having a right hyperand (short right scope) of 1, a right operand (short right scope) of 2, and a right argument (long right scope) of 3 4.

To reduce confusion, use parentheses such as (LO (LH dhdo 1) 2) 3 4.

Abbreviations:

  • dop Dyadic Operator
  • mhmo Monadic Hyperand Monadic Operand Hyperator
  • mhdo Monadic Hyperand Dyadic Operand ...
  • dhmo Dyadic Hyperand Monadic Operand ...
  • dhdo Dyadic Hyperand Dyadic Operand ...

Also, see Syntax Glitch.

References