HashMap = HashTable = Map = Table = Dictionary = Hash
And if you're feeling adventurous, Object.send :remove_const, :Hash keys(map) -> vector
flatmap(func, vector) -> vector
tostring(anything) -> string
sort(sort-func, vector) -> vector
compare-strings(string, string) -> first-is-greater, theyre-equal, or last-is-greater
unique(compare-func, vector) -> vector
concat(separator, vector) -> vector
and assume you have some way of connecting a list of these filter functions together like pipes, where the output of each function becomes the input of the next: reduce(composing-func, list-of-filter-functions, initial-input) -> final-result
Here, the composing-func takes two arguments: input, which is the output of the last iteration (or initial-input); and filter, which represents each function that will be applied in turn to produce some output. Notice that each filter function must take exactly one argument, which matches the return type of the previous filter-function in the pipeline. composing-func = (previous-result, filter) -> {
apply(filter, previous-result)
}
Now looking at our available functions, we can use currying and partial function application to pre-fill-in some arguments needed so that their input and output types line up: list-of-filter-functions = [
flatmap(keys),
map(tostring),
unique(compare-strings),
sort(compare-strings),
concat(",")
]
And actually, we're now done. All of our filter functions have been partially applied as a sort of initialization for a complicated pipeline. (map1.keys | map2.keys).map(&:to_s).sort.join(", ").instance_eval { empty? ? "<none>" : self } p ->(*_) {
_.reduce({}, :merge).tap { |_| return "<none>" if _.empty? }.keys.uniq.map(&:to_s).sort.join(", ")
}.({c:3,d:4,b:2}, {f:5,e:4,a:1})
p ->(*_) {
_.reduce({}, :merge).tap { |_| return "<none>" if _.empty? }.keys.uniq.map(&:to_s).sort.join(", ")
}.({}, {})
# "a, b, c, d, e, f"
# "<none>"
edit: a little bit better. func = ->(*_) {
return "<none>" if _.all?(&:empty?)
_.flat_map(&:keys).uniq.map(&:to_s).sort.join(", ")
}
func.({c:3,d:4,b:2}, {f:5,e:4,a:1})
#=> "a, b, c, d, e, f"
func.({}, {})
#=> "<none>"
https://gist.github.com/66b45e765a2aa6a97143
When you open a pull request from a branch, Github creates the separate pull request refs to track changes to that branch. I'm assuming they have some kind of after-receive hook that updates the ref whenever you push.
However, if you close the pull request (or delete the branch, which automatically closes the pull request), then rebase the branch locally and force push your branch, the pull request will not be updated, and you still see all the comments and historical data.
You can then open a new pull request from that branch, and go through the code review process again. If you mention #123 in the description of the new pull request, it'll create a link at the bottom of the discussion on the original, closed one. This helps keep the separate discussions tied together if you're coming back later and want to see all revisions of this branch.