Skip to main content

Right hand side vs. Left hand side

What: Different sides to an operator e.g. == Why: Proper treatment of the sides of an operator e.g. == results in much functionality Time To Complete: 3 hours

<a
href="https://www.geeksforgeeks.org/">Alt Text
Alt Text

.left and .right

In Free Form Programming Language (ff) the dot operator, namely the dot on your keyboard, allows for accessing parts of an expression!

For a given equation e.g. eq, in the ff program below, the lhs or x^2-1+y can be accessed by the expression eq.left and a/b+c by the expression eq.right.

eq = (x^2-1+y == a/b+c);

lhs = eq.left;

show lhs;

rhs = eq.right;

show rhs;

save as lhsrhs;

Output

"lhs" → -1 + x^2 + y
"rhs" → a/b + c

The programmer is not required to use a symbol e.g. eq for this . access, as long as using the ( ) operator the results would be the same:

tmp = (x^2-1+y == a/b+c).left;

show tmp;

save as lhsrhs;

Output

"tmp" → -1 + x^2 + y

In Free Form Programming Language (ff), the Symbol ⊕ is one of several unassigned operators.

As you can see the . operator works perfectly even if the operator in use is not defined! This is a core language aspect of ff that allows undefined variables as well as undefined functions and undefined operators alike.

eq = (x^2-1+y)  ⊕  (a/b+c);

lhs = eq.left;

show lhs;

rhs = eq.right;

show rhs;

save as lhsrhs;

Output

"lhs" → -1 + x^2 + y
"rhs" → a/b + c

Try different operators.

eq = (x^2-1+y)  <=  (a/b+c);

lhs = eq.left;

show lhs;

rhs = eq.right;

show rhs;

save as lhsrhs;

Output

"lhs" → -1 + x^2 + y
"rhs" → a/b + c

© 2012-Present CCN Studios

Creative Commons Attribution-NonCommercial-ShareAlike 4.0