An honest question: How come I don’t see more scala + clojure interop code?


An honest question: How come I don’t see more scala + clojure interop code?

Perhaps I'm just not looking in the right places, but from my vantage point there doesn't seem to be much talk of using scala + clojure for one project. Is there a reason for this? I'm surprised, for example that I can't even find a boot scala plugin, when the two languages seem so darn similar. I can imagine a flow of having like this idea of "to type later" where clojure would be the quick prototyping half of your project and scala would be the more final, production part of your project. thoughts?

Submitted February 12, 2017 at 11:24PM by barry0bama
via reddit http://ift.tt/2lDjAkQ

Given a `[]string` and `map[string]interface{}`, can we traverse the map?


Given a `[]string` and `map[string]interface{}`, can we traverse the map?

I'd like to write a function which accepts a slice of keys and returns the result of traversing a map for each of those keys.

For example, given this map:

m := map[string]interface{}{ "apples": []string{"delicious", "green", "red"}, "oranges": map[string]interface{}{ "foo": 123456, "bar": "hello, world", }, } 

we can get the value of the "bar" key in the "oranges" map by writing:

m["oranges"].(map[string]interface{})["bar"] 

We can continue getting at deeply nested keys with the general approach of:

m["first-key"] .(map[string]interface{})["second-key"] .(map[string]interface{})["third-key"] {...} 

Now imagine that we have a slice that represents the strings forming the deeply-nested key (e.g. ["oranges", "bar"]), and a map we want to traverse.

Is there a way to write a function which does that? Here's a Go Playground link that I've been working from.

Submitted February 12, 2017 at 11:09PM by jxf
via reddit http://ift.tt/2lDqh6o