DEV Community

Cover image for Extracting Data with Hyperlambda's Semantic Slots
Thomas Hansen
Thomas Hansen

Posted on

Extracting Data with Hyperlambda's Semantic Slots

Hyperlambda is a powerful and flexible programming language that is designed to be easy to read and understand. It provides a number of functions and slots for working with databases, including the data.connect and data.read functions.

The data.connect function is used to establish a connection to a database catalog, which is a container for one or more tables of data. The data.read function is used to semantically extract data from a database by specifying the columns to select, the tables to join, and the conditions to filter the data.

One of the main advantages of using the data.read function in Hyperlambda is that it allows you to write semantically rich code that is easy to understand and traverse, without requiring the use of complex and hard-to-read SQL statements. Instead of writing raw SQL queries, you can use the columns, table, join, type, and on clauses to specify the data you want to extract in a semantic and intuitive way.

Here is an example of how to use the data.read function to select the name and email columns from the customers table in a CRM database catalog, and join it with the orders table to extract the price column:

data.connect:crm_catalog
   data.read
      columns
         customers.name
         customers.email
         orders.price
      table:customers
         join:orders
            type:inner
            on
               and
                  customers.customer_id:orders.customer_id
Enter fullscreen mode Exit fullscreen mode

This code first connects to the CRM database catalog using the data.connect function. Then, it uses the data.read function to select the name and email columns from the customers table, and the price column from the orders table.

What is this?

The above was written entirely created by OpenAI's ChatGPT. It took me about 20 minutes to teach it the basics of the [data.read] slot, at which point it was able to use it correctly in a Hyperlambda code example, and wrap the code in a blog article.

Ignoring the fact that Hyperlambda technically doesn't have functions, even though it's a functional programming language, based upon "slots" instead of functions - The above is more or less 100% correct, and can be used as an example article to teach yourself Hyperlambda data extraction.

I suspect ChatGPT's primary advantage in the future, is that we can teach it things, allowing us to create human like interfaces, "outsourcing" ourselves to the machine, resulting in better support mechanisms, more humanly friendly interfaces, allowing us to teach it how to teach others what we want to teach.

For instance, I would love to be able to teach its model every single nuance of Hyperlambda, such that it could become a Hyperlambda assistant for others, allowing others to create better Hyperlambda code. Unfortunately, I am not sure if that's even possible today. I have seen some signs of that it "persists" knowledge it is given. But at the same time it claims itself it does not do this.

Can somebody confirm if it is possible to "permanently teach" it things? If this is possible, I am ready to teach it Hyperlambda, allowing it to teach others later as needed, and implement its API into Magic

Top comments (0)