TYL PROGRAMMING LANGUAGE
▶ ACCESS & EDIT RECORDS
Adding/Removing List Keys
To add a static list key to a record:
geology { name: 'Geology'}
eon [ 'Phanerozoic' 'Proterozoic' 'Archean' ]
geology <- 'eon' eon
print geology.eon
[ 'Phanerozoic', 'Proterozoic', 'Archean' ]
To add a dynamic list key to a record:
geology { name: 'Geology'}
geology <- eon [ 'Phanerozoic' 'Proterozoic' 'Archean' ]
print geology 'eon'
[ 'Phanerozoic', 'Proterozoic', 'Archean' ]
Editing List Keys
Consider this code:
geology { name 'Geology' }
! adding static and dynamic list keys to geology record
staticeon [ 'Phanerozoic' 'Proterozoic' 'Archean' ]
geology <- 'staticeon' staticeon
geology <- dynamiceon [ 'Phanerozoic' 'Proterozoic' 'Archean' ]
print geology
print
! editing staticeon property
print 'set first item of staticeon to:  ' + geology.staticeon 0 'X'
print 'removed second item of staticeon:  ' + geology.staticeon 1 ->
! editing dynamiceon property
items geology 'dynamiceon'
print 'set first item of dynamiceon to:  ' + items 0 'Y'
print 'removed third item of dynamiceon: ' + items 2 ->
geology 'dynamiceon' items
print
print geology
{
 name: 'Geology'
 staticeon: [ 'Phanerozoic', 'Proterozoic', 'Archean' ]
 dynamiceon: [ 'Phanerozoic', 'Proterozoic', 'Archean' ]
}

set first item of staticeon to: X
removed second item of staticeon: Proterozoic
set first item of dynamiceon to: Y
removed third item of dynamiceon: Archean

{
 name: 'Geology'
 staticeon: [ 'X', 'Archean' ]
 dynamiceon: [ 'Y', 'Proterozoic' ]
}
geology.staticeon list was added statically, therefore it can be accessed and edited directly.
Editing geology dynamiceon list key is done by assigning it to a list variable and reassigning back to the list key.
PART 3
PART 5