assistance-engine/ingestion/docs/5_Data_Model.txt

49 lines
2.8 KiB
Plaintext

Introduction
The data model in AVAP™ defines how data is organized and manipulated within the language. Similar to Python, AVAP™ uses a flexible and dynamic data model that allows for working with a wide variety of data types and data structures.
Data Types
In AVAP™, just like in Python, data types are categories that represent different kinds of values that can be stored and manipulated in a program. Some of the most common data types in AVAP™ include:
Integers (int): Represent whole numbers, positive or negative, without a fractional part.
Floating-point numbers (float): Represent numbers with both integer and fractional parts.
Strings (str): Represent sequences of Unicode characters.
Booleans (bool): Represent truth values, either True or False.
Lists (list): Ordered and mutable collections of elements.
Tuples (tuple): Ordered and immutable collections of elements.
Dictionaries (dict): Unordered collections of key-value pairs.
Sets (set): Unordered collections of unique elements.
Data Structures
In addition to individual data types, AVAP™ provides various data structures that allow for more complex organization and manipulation of data:
Lists: Created using square brackets [ ] and can contain any data type, including other lists.
Tuples: Created using parentheses ( ) and are immutable, meaning they cannot be modified once created.
Dictionaries: Created using curly braces and store key-value pairs, where each key is unique within the dictionary.
Sets: Created using curly braces and contain unique elements, meaning there are no duplicates in a set.
Data Structures
In addition to individual data types, AVAP™ provides various data structures that allow for more complex organization and manipulation of data:
Lists: Created using square brackets [ ] and can contain any data type, including other lists.
Tuples: Created using parentheses ( ) and are immutable, meaning they cannot be modified once created.
Dictionaries: Created using curly braces and store key-value pairs, where each key is unique within the dictionary.
Sets: Created using curly braces and contain unique elements, meaning there are no duplicates in a set.
Practical Example
Below is a practical example that illustrates the use of the data model in AVAP™:
# Definition of a list
example_list = [1, 2, 3, 4, 5]
# Accessing individual elements
print(example_list[0]) # Output: 1
# Slicing to get a sublist
sublist = example_list[2:4]
print(sublist) # Output: [3, 4]
# List methods
example_list.append(6)
print(example_list) # Output: [1, 2, 3, 4, 5, 6]
Conclusions
The data model in AVAP™ provides a flexible and dynamic structure for working with data in the language. By understanding the available data types, data structures, operations, and methods, developers can write efficient and effective code that manipulates and processes data effectively.