Skip to content

Instantly share code, notes, and snippets.

@krupenik
Last active December 21, 2015 04:19
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 krupenik/6248650 to your computer and use it in GitHub Desktop.
Save krupenik/6248650 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
src = [["Ukraine", ["Kyiv", "Kharkov"]], ["France", ["Paris", "Marseilles"]], ["Poland", ["Warsaw", "Krakow"]]]
dst = src.flat_map { |(country, cities)| cities.map { |city| "#{country}/#{city}" }}
puts dst.map { |i| [i, dst - [i]]}.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment