Skip to content

Instantly share code, notes, and snippets.

@yogidevbear
Last active March 9, 2017 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogidevbear/4b386f10c63ba008d3f7b49524262cf0 to your computer and use it in GitHub Desktop.
Save yogidevbear/4b386f10c63ba008d3f7b49524262cf0 to your computer and use it in GitHub Desktop.
What is the best way to return a formatted data structure (like option_1.txt or option_2.txt) from the initial flat data structure (initial_flat_structure.txt) using Clojure?
(def initial_data [
{ :entry "E1", :judge "J1", :comment "E1J1C1" },
{ :entry "E1", :judge "J2", :comment "E1J2C1" },
{ :entry "E1", :judge "J1", :comment "E1J1C2" },
{ :entry "E2", :judge "J1", :comment "" },
{ :entry "E2", :judge "J2", :comment "" },
{ :entry "E3", :judge "J1", :comment "E3J1C1" },
{ :entry "E3", :judge "J1", :comment "E3J1C2" },
{ :entry "E3", :judge "J2", :comment "" }
])
[
{ "entry":"Entry 1", "judge":"John", "comment":"Entry 1 Comment 1 John" },
{ "entry":"Entry 1", "judge":"Alison", "comment":"Entry 1 Comment 1 Alison" },
{ "entry":"Entry 1", "judge":"John", "comment":"Entry 1 Comment 2 John" },
{ "entry":"Entry 2", "judge":"John", "comment":"" },
{ "entry":"Entry 2", "judge":"Alison", "comment":"" },
{ "entry":"Entry 3", "judge":"John", "comment":"Entry 3 Comment 1 John" },
{ "entry":"Entry 3", "judge":"John", "comment":"Entry 3 Comment 2 John" },
{ "entry":"Entry 3", "judge":"Alison", "comment":"" }
]
[
{
"entry":"Entry 1",
"judge":"John",
"comments":[
"Entry 1 Comment 1 John",
"Entry 1 Comment 2 John"
]
},
{
"entry":"Entry 1",
"judge":"Alison",
"comments":[
"Entry 1 Comment 1 Alison"
]
},
{
"entry":"Entry 2",
"judge":"John",
"comments":[]
},
{
"entry":"Entry 2",
"judge":"Alison",
"comments":[]
},
{
"entry":"Entry 3",
"judge":"John",
"comments":[
"Entry 3 Comment 1 John",
"Entry 3 Comment 2 John"
]
},
{
"entry":"Entry 3",
"judge":"Alison",
"comments":[]
}
]
[
{
"entry":"Entry 1",
"judges":[
"John":{
"comments":[
"Entry 1 Comment 1 John",
"Entry 1 Comment 2 John"
]
},
"Alison":{
"comments":[
"Entry 1 Comment 1 Alison"
]
}
]
},
{
"entry":"Entry 2",
"judges":[
"John":{
"comments":[]
},
"Alison":{
"comments":[]
}
]
},
{
"entry":"Entry 3",
"judges":[
"John":{
"comments":[
"Entry 3 Comment 1 John",
"Entry 3 Comment 2 John"
]
},
"Alison":{
"comments":[]
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment