uid / snapdown

Draw snapshot diagrams with plain text
MIT License
3 stars 0 forks source link

Visualization of key/value pair fields #17

Open dwhatley19 opened 3 years ago

dwhatley19 commented 3 years ago

Reading 2 has a diagram illustrating the usage of "key/value pair" field types:

Screen Shot 2020-08-04 at 11 59 20 AM

The proposed Snapdown syntax for this diagram is:

turtles -> (Map<String,Turtle> (String "Buster") = (Turtle), (String "Buckminster") = (Turtle), (String "Bob") = (Turtle))

Alternatively, one can write:

#1 -> (Turtle)
#2 -> (Turtle)
#3 -> (Turtle)
turtles -> (Map<String,Turtle> (String "Buster") = #1, (String "Buckminster") = #2, (String "Bob") = #3)
dwhatley19 commented 3 years ago

Simple cases (e.g. above diagram) are resolved. More complicated cases, as in the diagram in the answer explanation of http://web.mit.edu/6.031/www/sp20/classes/02-basic-java/#@ex-java_collections-x_marks_the_spot

still need proposed syntax and layout.

dwhatley19 commented 3 years ago

Syntax has been revised to:

turtles -> (Map<String,Turtle>
  (String "Buster"): (Turtle),
  (String "Buckminster"): (Turtle)
  (String "Bob"): (Turtle))