Recursive Calcis

From ZCubes Wiki
Jump to navigation Jump to search

Recursive Calcis

For decades, spreadsheets have dominated the landscape.

With recursive spreadsheets, Z offers a computational surface with incredible power and detail. A cell can have anything, practically any data structure, while keeping the tabular simplicity.

Simple! Incredible!

Normally, spreadsheets are tables of cells. Cells can contain a single value, but not a complex structure.

In Calcis in Z, a cell can contain literally anything.

So far, users were forced to translate their problems to a 2-D table, to express and solve a problem. This made spreadsheets very complex, and hard to use when it came to reasonably complex problems. Mult-dimensional data and data structures were hard to make, manage and use. This required us to go into more complex languages to solve the problems.

With Recursive Calcis, there is a new way to represent data, rich with powerful functions and techniques.

A Calci Cell can now contain ANYTHING. The consistency of Grids, Cubes, Cells, Matrices, is just amazing. The power is incredible.

For you what does it mean?

Now an Omni-Functional Document can represent and solve literally any problem you can imagine.

Recursive Calcis

Simple Arrays

To insert a 4x4 matrix, initialized to numbers 2..200, enter

=|4,4,2..200|

into a cell.

From another cell, =and click on any cell within the matrix displayed to reference it.


Cell Reference To Array In A Cell

Complex Objects

A complex object can contain data of any complexity, as well as methods/member functions.

Consider this complex object.

NFTStore = {
  artPieces: [
    {
      pieceName: "Emo Flamingos",
      price: 30,
      ownerList: [
        {
          name: "Fida Ernest",
          userID: 23849,
          purchaseDate: "09/13/2021",
        },
        {
          name: "Eric Karger",
          userID: 23510,
          purchaseDate: "09/13/2021",
        },
      ],
    },
    {
      pieceName: "Where is my bit wallet",
      price: 100,
      ownerList: [],
    },
  ],
  storeCredits: 1000,
};		

To enter complex data into a cell, a simple technique is to prefix the code with ==. If NFTStore is already loaded in the platform, we can type into a cell ==NFTStore. Instead, the entire code above can be entered into a cell with == prefixed.

Once done, the cell is available for computation. Let us say this is stored inside cell A1.

Using the fabulous # operator, we can we even extract parts of this object.

For example,

=[A1]#"artPieces.price"

will extract prices of all artPieces in the object.

Please note that if this cell had a collection of such objects, we could have used =B3#"artPieces.price" to extract the info from all the objects.

For advanced users,

([NFTStore]#"artPieces.price,artPieces.ownerList.name,artPieces.ownerList.userID");

can extract price, name and userids into a table.

Advanced query into Recursive Calcis

Array of Objects (Record Set Equivalent)

Consider the following:

rs=
		[{
		  "id": 1,
		  "first_name": "Jeanette",
		  "last_name": "Penddreth",
		  "email": "jpenddreth0@census.gov",
		  "gender": "Female",
		  "ip_address": "26.58.193.2"
		}, {
		  "id": 2,
		  "first_name": "Giavani",
		  "last_name": "Frediani",
		  "email": "gfrediani1@senate.gov",
		  "gender": "Male",
		  "ip_address": "229.179.4.212"
		}, {
		  "id": 3,
		  "first_name": "Noell",
		  "last_name": "Bea",
		  "email": "nbea2@imageshack.us",
		  "gender": "Female",
		  "ip_address": "180.66.162.255"
		}, {
		  "id": 4,
		  "first_name": "Willard",
		  "last_name": "Valek",
		  "email": "wvalek3@vk.com",
		  "gender": "Male",
		  "ip_address": "67.76.188.26"
		}]

rs could be initiated through code or uploads into an array, or simply by entering into a cell with == prefix. In Calci, == indicates Javascript/z^3 code follows the sign, instead of a simple formula which is prefixed by a single =.

=A1#"email"

gives the result of the all emails in the array of objects entered into cell A1.

Array of Objects Query

=A1#"ip_address,email"

gives

Array of Objects Query 2

See Also

The Powerful # Hash Operator

Fabulous ! Operator