tree: employee{ red_team name: "Michael Scott" title: "Regional Manager"
/[
employee{ red_team name: "Dwight Scrute" title: "Assistant to the Regional Mgr"}
employee{ blue_team name: "Jim Halpert"
title: "Head of Sales"
top_customers: [
customer{ first_name: "John" last_name: "Doe" orders_placed: 4500 }
customer{ first_name: "Jane" last_name: "Doe" orders_placed: 2300 }]
/[
employee{ red_team name: "Andy Bernard"
title: "Sales Rep"
top_customers: [
customer{ first_name: "Sam" last_name: "Winchester" orders_placed: 1000 }
customer{ first_name: "Dean" last_name: "Winchester" orders_placed: 5 }]}
employee{ blue_team name: "Phyllis Lapin"
title:"Sales Rep"
top_customers: [
customer{ first_name: "Hansel" last_name: "Schmidt" orders_placed: 500 }
customer{ first_name: "Gretel" last_name: "Schmidt" orders_placed: 630 }]}]}
employee{ blue_team name: "Pam Beesly" title: "Office Administrator"}
]}
The card accessor examples below use the above data named tree
.
.
followed by their name.
tree.name
/* returns:
"Michael Scott"
*/
*
.
tree*
/* returns:
[ "red_team" "name" "title" ]
*/
tree.["name" "title"]
/* returns:
[ "Michael Scott" "Regional Manager" ]
*/
/
followed by the item index.
Numerical indexing starts at 1 not 0 because indexes are not offsets.
tree/1
/* returns:
employee{
red_team
name: "Dwight Scrute"
title: "Assistant to the Regional Mgr"}
*/
/
accessor.
If the data is a primitive this will remove the type and convert the primitive to a byte array.
integer: 511
integer/
// returns [:255 1]
.
followed by their name.
tree.red_team
/*
does not return void
(other reader implementations may use
true/false with this example returning true)
*/
#
.
tree#
/* returns:
employee
*/
#
followed by the type name.
So to see a list of the names of jim's employees:
tree/2#employee.name
/* returns:
["Andy Bernard" "Phyllis Lapin"]
*/
@
followed by each the key/tag/index to be selected from each card.
So to see a list of jim's employees' top customer lists:
tree/2@top_customers
/* returns:
[
[
customer{ first_name: "Sam" last_name: "Winchester" orders_placed: 1000 }
customer{ first_name: "Dean" last_name: "Winchester" orders_placed: 5 }]
[
customer{ first_name: "Hansel" last_name: "Schmidt" orders_placed: 500 }
customer{ first_name: "Gretel" last_name: "Schmidt" orders_placed: 630 }]]
*/