This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"axes": [], | |
"data": [ | |
{ | |
"format": { | |
"feature": "world-countries", | |
"type": "topojson" | |
}, | |
"name": "countries", | |
"transform": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ftrain(l): | |
'''Convert an iterable to a nested list based on ordered comparison''' | |
i = iter(l) | |
tree, seen = ftrain_helper(i, i.next()) | |
# This might not be the desired behavior, but it's not terrible | |
# You could also emit a warning or an exception here | |
while(not seen is None): | |
rest_tree, seen = ftrain_helper(i, seen) | |
tree = [tree] + rest_tree | |
return tree |
NewerOlder