Documentation

Basic Types

Table of Contents

sneq has the following basic types for data:

bool: Booleans

  • True or False

str: Strings

  • Unicode characters are permitted.

dec: Decimal numbers

  • All untyped numbers are decimals by default
  • Emin = 9999, Emax = 9999
  • Precision = 28
  • Rounds down

int: Integer numbers

  • Maximum integer value is 9223372036854775807
  • Minimum integer value is -9223372036854775807

list: Lists of simple types

  • Immutable
  • You can expand lists by creating a new list via concatenation (+), but you can not mutate a list by index i.e. foo[3] = 10
  • Reference indexes in the list with square brackets e.g. a_list[0]
  • Although lists do not have to be of the same type, some operators will fail if they are not
  • Maximum number of elements allowed is 99999

dict: Key-value objects ("dictionary")

  • Immutable
  • You can expand dicts by creating a new dict via merge (+), but you can not mutate a dict by index (foo['bar'] = 10 will not work)
  • Key collisions on merge (+) create a new dictionary with the old value replaced
  • You can approximate a dictionary update mutation by merging with colliding keys: foo['bar'] = 10 will not work but:
# The merge will approximate the update foo['bar'] = 10
foo = { 'bar': 5, 'val': 23 }
foo = foo + {'bar': 10}

# Now foo == { 'bar': 10, 'val': 23 }
  • Ordered
  • Reference values in the dict with square brackets e.g. a_dict['foo']
  • Keys must be strings
  • Maximum number of keys allowed is 99999

function: A function

  • User declared functions only take keyword arguments, e.g. foo(bar="Hello World").
  • Functions are the only data type passed by reference rather than value, but the referenced data is considered immutable.
  • Dicts and lists passed to functions are copy by value.
  • Functions do not have access to contextual constant memory like form and reservation.
  • All user declared functions are pure.
  • All functions must return a value.
  • All invocation of functions must assign a value, if you want to throw that away use _, e.g. _ = foo().

none: Nil-value

  • Accessed via None

datetime: Date time object

  • Localized to your site timezone.
  • Except for comparisons, can only be meaningfully accessed via the datetime library.

All data types with the exception of functions are passed by value, not by reference. This includes lists and dictionaries!