Post Reply 
newRPL: Structured data object?
10-09-2015, 03:55 PM
Post: #1
newRPL: Structured data object?
Would it be a good idea to extend the RPL language by adding a structured data object?
The idea would be something similar to a database, with "records", and each record would have named fields.
If the database is stored in a variable DB, you do:

<< DB :field:1 GET >> to get field 'field' in record 1 of the database object.

PUT would be extended in a similar way, using tags for the field names.

Internally, it can be something like this:
  • Prolog
  • List of field names
  • Array of offsets to ea. record
  • Records in no particular order

If there's 3 field names, for example, each record will consist of 3 objects.
The field names must be in the same order as assigned to the objects, so if the field names are 'a', 'b' and 'c', a record's first object will correspond to 'a', second to 'b' and third to 'c'.
The syntax to edit this type of object is still to be determined, first I'd like to see if there's a need for it.
I could see it being used to define menus and GUI objects, as input for INFORM, for example, it would be much more readable to have field names.
Perhaps a syntax could be:

:{ 'Type' 'Text' 'Value'
:[ :Type:"Title" :Text:"My Inform text" ]:
:[ :Type:"Menu" :Value::{ 'Text' 'Action' 'ActionLS' 'ActionRS' :[ :Text:"SIN" :Action:<< SIN >> :ActionLS:<< ASIN >> :ActionRS:<< ∑ >> ]: }: ]:
:[ :Type: "EditBox" :Text:"Enter variable" :Value:"" ]:
}:

The brackets :{ }: for databases and :[ ]: for records were made up just now without thinking too much, I'm open to suggestions.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)